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])
12 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
17 AC_LIBLTDL_CONVENIENCE
21 AC_CONFIG_SUBDIRS(libltdl)
22 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
26 AM_INIT_AUTOMAKE(dist-bzip2)
29 AC_PREFIX_DEFAULT("/opt/collectd")
34 # Checks for programs.
42 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
50 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
51 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
53 AC_MSG_CHECKING([for kernel type ($host_os)])
56 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
60 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
70 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
76 AC_MSG_RESULT([$ac_system])
78 if test "x$ac_system" = "xLinux"
80 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
81 if test -z "$KERNEL_DIR"
83 KERNEL_DIR="/lib/modules/`uname -r`/source"
86 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
87 AC_SUBST(KERNEL_CFLAGS)
90 if test "x$ac_system" = "xSolaris"
92 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
95 # Where to install .pc files.
96 pkgconfigdir="${libdir}/pkgconfig"
97 AC_SUBST(pkgconfigdir)
99 # Check for standards compliance mode
100 AC_ARG_ENABLE(standards,
101 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
102 [enable_standards="$enableval"],
103 [enable_standards="no"])
104 if test "x$enable_standards" = "xyes"
106 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
107 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Define to enforce POSIX.1-2001 compliance.])
108 AC_DEFINE(_XOPEN_SOURCE, 600, [Define to enforce X/Open 6 (XSI) compliance.])
109 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
111 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
114 # Checks for header files.
121 AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
124 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
129 # include <sys/types.h>
132 AC_CHECK_HEADERS(netinet/in.h, [], [],
137 # include <sys/types.h>
139 #if HAVE_NETINET_IN_SYSTM_H
140 # include <netinet/in_systm.h>
143 AC_CHECK_HEADERS(netinet/ip.h, [], [],
148 # include <sys/types.h>
150 #if HAVE_NETINET_IN_SYSTM_H
151 # include <netinet/in_systm.h>
153 #if HAVE_NETINET_IN_H
154 # include <netinet/in.h>
157 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
162 # include <sys/types.h>
164 #if HAVE_NETINET_IN_SYSTM_H
165 # include <netinet/in_systm.h>
167 #if HAVE_NETINET_IN_H
168 # include <netinet/in.h>
170 #if HAVE_NETINET_IP_H
171 # include <netinet/ip.h>
174 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
179 # include <sys/types.h>
181 #if HAVE_NETINET_IN_SYSTM_H
182 # include <netinet/in_systm.h>
184 #if HAVE_NETINET_IN_H
185 # include <netinet/in.h>
187 #if HAVE_NETINET_IP_H
188 # include <netinet/ip.h>
191 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
196 # include <sys/types.h>
198 #if HAVE_NETINET_IN_SYSTM_H
199 # include <netinet/in_systm.h>
201 #if HAVE_NETINET_IN_H
202 # include <netinet/in.h>
205 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
210 # include <sys/types.h>
212 #if HAVE_NETINET_IN_SYSTM_H
213 # include <netinet/in_systm.h>
215 #if HAVE_NETINET_IN_H
216 # include <netinet/in.h>
218 #if HAVE_NETINET_IP6_H
219 # include <netinet/ip6.h>
222 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
227 # include <sys/types.h>
229 #if HAVE_NETINET_IN_SYSTM_H
230 # include <netinet/in_systm.h>
232 #if HAVE_NETINET_IN_H
233 # include <netinet/in.h>
235 #if HAVE_NETINET_IP_H
236 # include <netinet/ip.h>
239 AC_CHECK_HEADERS(netinet/udp.h, [], [],
244 # include <sys/types.h>
246 #if HAVE_NETINET_IN_SYSTM_H
247 # include <netinet/in_systm.h>
249 #if HAVE_NETINET_IN_H
250 # include <netinet/in.h>
252 #if HAVE_NETINET_IP_H
253 # include <netinet/ip.h>
258 AC_CHECK_HEADERS(sys/dkstat.h)
259 if test "x$ac_system" = "xDarwin"
261 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)
262 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
264 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
267 # include <sys/types.h>
270 # include <sys/param.h>
274 AC_MSG_CHECKING([for sysctl kern.cp_times])
275 if test -x /sbin/sysctl
277 /sbin/sysctl kern.cp_times 2>/dev/null
281 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
282 [Define if sysctl supports kern.cp_times])
291 AC_CHECK_HEADERS(linux/major.h libgen.h)
293 # For the battery plugin
294 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
296 #if HAVE_IOKIT_IOKITLIB_H
297 # include <IOKit/IOKitLib.h>
299 #if HAVE_IOKIT_IOTYPES_H
300 # include <IOKit/IOTypes.h>
304 # For the swap module
305 have_linux_wireless_h="no"
306 if test "x$ac_system" = "xLinux"
308 AC_CHECK_HEADERS(linux/wireless.h,
309 [have_linux_wireless_h="yes"],
310 [have_linux_wireless_h="no"],
313 #include <sys/ioctl.h>
314 #include <sys/socket.h>
318 # For the swap module
319 have_sys_swap_h="yes"
320 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
322 #undef _FILE_OFFSET_BITS
323 #undef _LARGEFILE64_SOURCE
325 # include <sys/types.h>
328 # include <sys/param.h>
332 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
335 if test "x$GCC" = "xyes"
337 hint_64="CFLAGS='-m64'"
339 hint_64="CFLAGS='-xarch=v9'"
341 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
345 # For the processes plugin
347 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
349 # For interface plugin
350 AC_CHECK_HEADERS(ifaddrs.h)
351 AC_CHECK_HEADERS(net/if.h, [], [],
354 # include <sys/types.h>
356 #if HAVE_SYS_SOCKET_H
357 # include <sys/socket.h>
360 AC_CHECK_HEADERS(linux/if.h, [], [],
363 # include <sys/types.h>
365 #if HAVE_SYS_SOCKET_H
366 # include <sys/socket.h>
369 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
372 # include <sys/types.h>
374 #if HAVE_SYS_SOCKET_H
375 # include <sys/socket.h>
378 # include <linux/if.h>
383 have_net_ip_vs_h="no"
385 if test "x$ac_system" = "xLinux"
387 SAVE_CFLAGS="$CFLAGS"
388 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
390 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
391 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
393 CFLAGS="$SAVE_CFLAGS"
397 AC_CHECK_HEADERS(sys/ucred.h, [], [],
400 # include <sys/types.h>
403 # include <sys/param.h>
407 # For mount interface
408 AC_CHECK_HEADERS(sys/mount.h, [], [],
411 # include <sys/types.h>
414 # include <sys/param.h>
418 # For the email plugin
419 AC_CHECK_HEADERS(linux/un.h, [], [],
421 #if HAVE_SYS_SOCKET_H
422 # include <sys/socket.h>
426 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)
429 AC_CHECK_HEADERS(arpa/nameser.h)
430 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
432 #if HAVE_ARPA_NAMESER_H
433 # include <arpa/nameser.h>
437 AC_CHECK_HEADERS(net/if_arp.h, [], [],
438 [#if HAVE_SYS_SOCKET_H
439 # include <sys/socket.h>
442 AC_CHECK_HEADERS(net/ppp_defs.h)
443 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
444 [#if HAVE_NET_PPP_DEFS_H
445 # include <net/ppp_defs.h>
448 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
453 # include <sys/types.h>
455 #if HAVE_SYS_SOCKET_H
456 # include <sys/socket.h>
461 #if HAVE_NETINET_IN_H
462 # include <netinet/in.h>
466 # For the multimeter plugin
468 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
471 # Checks for typedefs, structures, and compiler characteristics.
480 # Checks for library functions.
482 AC_PROG_GCC_TRADITIONAL
483 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
487 SAVE_CFLAGS="$CFLAGS"
488 # Emulate behavior of src/Makefile.am
489 if test "x$GCC" = "xyes"
491 CFLAGS="$CFLAGS -Wall -Werror"
494 AC_CACHE_CHECK([for strtok_r],
495 [c_cv_have_strtok_r_default],
504 char buffer[] = "foo,bar,baz";
511 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
514 printf ("token = %s;\n", token);
517 [c_cv_have_strtok_r_default="yes"],
518 [c_cv_have_strtok_r_default="no"]
522 if test "x$c_cv_have_strtok_r_default" = "xno"
524 CFLAGS="$CFLAGS -D_REENTRANT=1"
526 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
527 [c_cv_have_strtok_r_reentrant],
536 char buffer[] = "foo,bar,baz";
543 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
546 printf ("token = %s;\n", token);
549 [c_cv_have_strtok_r_reentrant="yes"],
550 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
555 CFLAGS="$SAVE_CFLAGS"
556 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
558 CFLAGS="$CFLAGS -D_REENTRANT=1"
561 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
563 socket_needs_socket="no"
564 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
565 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
567 nanosleep_needs_rt="no"
568 nanosleep_needs_posix4="no"
569 AC_CHECK_FUNCS(nanosleep,
571 AC_CHECK_LIB(rt, nanosleep,
572 [nanosleep_needs_rt="yes"],
573 AC_CHECK_LIB(posix4, nanosleep,
574 [nanosleep_needs_posix4="yes"],
575 AC_MSG_ERROR(cannot find nanosleep))))
576 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
577 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$nanosleep_needs_posix4" = "xyes")
579 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
580 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
581 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
582 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
583 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
584 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
585 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
586 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
587 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
588 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
589 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
590 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
591 if test "x$have_swapctl" = "xyes"; then
592 AC_CACHE_CHECK([whether swapctl takes two arguments],
593 [c_cv_have_swapctl_two_args],
595 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
596 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
597 # undef _FILE_OFFSET_BITS
598 # undef _LARGEFILE64_SOURCE
600 #include <sys/stat.h>
601 #include <sys/swap.h>]],
603 int num = swapctl(0, NULL);
606 [c_cv_have_swapctl_two_args="yes"],
607 [c_cv_have_swapctl_two_args="no"]
610 AC_CACHE_CHECK([whether swapctl takes three arguments],
611 [c_cv_have_swapctl_three_args],
613 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
614 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
615 # undef _FILE_OFFSET_BITS
616 # undef _LARGEFILE64_SOURCE
618 #include <sys/stat.h>
619 #include <sys/swap.h>]],
621 int num = swapctl(0, NULL,0);
624 [c_cv_have_swapctl_three_args="yes"],
625 [c_cv_have_swapctl_three_args="no"]
629 # Check for different versions of `swapctl' here..
630 if test "x$have_swapctl" = "xyes"; then
631 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
632 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
633 [Define if the function swapctl exists and takes two arguments.])
635 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
636 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
637 [Define if the function swapctl exists and takes three arguments.])
642 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
645 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
647 if test "x$withval" = "xno"; then
649 else if test "x$withval" = "xyes"; then
656 if test "x$nan_type" = "xnone"; then
657 AC_CACHE_CHECK([whether NAN is defined by default],
658 [c_cv_have_nan_default],
664 static float foo = NAN;
672 [c_cv_have_nan_default="yes"],
673 [c_cv_have_nan_default="no"]
676 if test "x$c_cv_have_nan_default" = "xyes"
681 if test "x$nan_type" = "xnone"; then
682 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
683 [c_cv_have_nan_isoc],
688 #define __USE_ISOC99 1
690 static float foo = NAN;
698 [c_cv_have_nan_isoc="yes"],
699 [c_cv_have_nan_isoc="no"]
702 if test "x$c_cv_have_nan_isoc" = "xyes"
707 if test "x$nan_type" = "xnone"; then
708 SAVE_LDFLAGS=$LDFLAGS
709 LDFLAGS="$LDFLAGS -lm"
710 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
711 [c_cv_have_nan_zero],
720 #define NAN (0.0 / 0.0)
722 # define isnan(f) ((f) != (f))
724 static float foo = NAN;
732 [c_cv_have_nan_zero="yes"],
733 [c_cv_have_nan_zero="no"]
736 LDFLAGS=$SAVE_LDFLAGS
737 if test "x$c_cv_have_nan_zero" = "xyes"
743 if test "x$nan_type" = "xdefault"; then
744 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
745 [Define if NAN is defined by default and can initialize static variables.])
746 else if test "x$nan_type" = "xisoc99"; then
747 AC_DEFINE(NAN_STATIC_ISOC, 1,
748 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
749 else if test "x$nan_type" = "xzero"; then
750 AC_DEFINE(NAN_ZERO_ZERO, 1,
751 [Define if NAN can be defined as (0.0 / 0.0)])
753 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
756 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
758 if test "x$withval" = "xnothing"; then
759 fp_layout_type="nothing"
760 else if test "x$withval" = "xendianflip"; then
761 fp_layout_type="endianflip"
762 else if test "x$withval" = "xintswap"; then
763 fp_layout_type="intswap"
765 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
768 [fp_layout_type="unknown"])
770 if test "x$fp_layout_type" = "xunknown"; then
771 AC_CACHE_CHECK([if doubles are stored in x86 representation],
772 [c_cv_fp_layout_need_nothing],
783 # include <inttypes.h>
786 # include <stdbool.h>
796 memcpy ((void *) &i0, (void *) &d, 8);
799 memcpy ((void *) c, (void *) &i1, 8);
801 if ((c[0] == 0x2f) && (c[1] == 0x25)
802 && (c[2] == 0xc0) && (c[3] == 0xc7)
803 && (c[4] == 0x43) && (c[5] == 0x2b)
804 && (c[6] == 0x1f) && (c[7] == 0x5b))
809 [c_cv_fp_layout_need_nothing="yes"],
810 [c_cv_fp_layout_need_nothing="no"]
813 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
814 fp_layout_type="nothing"
817 if test "x$fp_layout_type" = "xunknown"; then
818 AC_CACHE_CHECK([if endianflip converts to x86 representation],
819 [c_cv_fp_layout_need_endianflip],
830 # include <inttypes.h>
833 # include <stdbool.h>
835 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
836 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
837 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
838 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
839 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
840 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
841 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
842 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
851 memcpy ((void *) &i0, (void *) &d, 8);
853 i1 = endianflip (i0);
854 memcpy ((void *) c, (void *) &i1, 8);
856 if ((c[0] == 0x2f) && (c[1] == 0x25)
857 && (c[2] == 0xc0) && (c[3] == 0xc7)
858 && (c[4] == 0x43) && (c[5] == 0x2b)
859 && (c[6] == 0x1f) && (c[7] == 0x5b))
864 [c_cv_fp_layout_need_endianflip="yes"],
865 [c_cv_fp_layout_need_endianflip="no"]
868 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
869 fp_layout_type="endianflip"
872 if test "x$fp_layout_type" = "xunknown"; then
873 AC_CACHE_CHECK([if intswap converts to x86 representation],
874 [c_cv_fp_layout_need_intswap],
885 # include <inttypes.h>
888 # include <stdbool.h>
890 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
891 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
900 memcpy ((void *) &i0, (void *) &d, 8);
903 memcpy ((void *) c, (void *) &i1, 8);
905 if ((c[0] == 0x2f) && (c[1] == 0x25)
906 && (c[2] == 0xc0) && (c[3] == 0xc7)
907 && (c[4] == 0x43) && (c[5] == 0x2b)
908 && (c[6] == 0x1f) && (c[7] == 0x5b))
913 [c_cv_fp_layout_need_intswap="yes"],
914 [c_cv_fp_layout_need_intswap="no"]
917 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
918 fp_layout_type="intswap"
922 if test "x$fp_layout_type" = "xnothing"; then
923 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
924 [Define if doubles are stored in x86 representation.])
925 else if test "x$fp_layout_type" = "xendianflip"; then
926 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
927 [Define if endianflip is needed to convert to x86 representation.])
928 else if test "x$fp_layout_type" = "xintswap"; then
929 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
930 [Define if intswap is needed to convert to x86 representation.])
932 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
936 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
938 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
940 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
943 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
944 if test "x$have_getmntent" = "xno"; then
945 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
947 if test "x$have_getmntent" = "xno"; then
948 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
950 if test "x$have_getmntent" = "xno"; then
951 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
954 if test "x$have_getmntent" = "xc"; then
955 AC_CACHE_CHECK([whether getmntent takes one argument],
956 [c_cv_have_one_getmntent],
958 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
959 #include "$srcdir/src/utils_mount.h"]],
963 fh = setmntent ("/etc/mtab", "r");
967 [c_cv_have_one_getmntent="yes"],
968 [c_cv_have_one_getmntent="no"]
971 AC_CACHE_CHECK([whether getmntent takes two arguments],
972 [c_cv_have_two_getmntent],
974 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
975 #include "$srcdir/src/utils_mount.h"]],
980 fh = fopen ("/etc/mnttab", "r");
981 status = getmntent (fh, &mt);
984 [c_cv_have_two_getmntent="yes"],
985 [c_cv_have_two_getmntent="no"]
990 # Check for different versions of `getmntent' here..
992 if test "x$have_getmntent" = "xc"; then
993 if test "x$c_cv_have_one_getmntent" = "xyes"; then
994 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
995 [Define if the function getmntent exists and takes one argument.])
997 if test "x$c_cv_have_two_getmntent" = "xyes"; then
998 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
999 [Define if the function getmntent exists and takes two arguments.])
1002 if test "x$have_getmntent" = "xsun"; then
1003 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1004 [Define if the function getmntent exists. It's the version from libsun.])
1006 if test "x$have_getmntent" = "xseq"; then
1007 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1008 [Define if the function getmntent exists. It's the version from libseq.])
1010 if test "x$have_getmntent" = "xgen"; then
1011 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1012 [Define if the function getmntent exists. It's the version from libgen.])
1016 AC_MSG_CHECKING([if have htonll defined])
1021 #include <sys/types.h>
1022 #include <netinet/in.h>
1024 # include <inttypes.h>
1031 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1034 AC_MSG_RESULT([$have_htonll])
1036 # Check for structures
1037 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1038 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1041 #include <sys/types.h>
1042 #include <sys/socket.h>
1045 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1046 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1049 #include <sys/types.h>
1050 #include <sys/socket.h>
1051 #include <linux/if.h>
1052 #include <linux/netdevice.h>
1055 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1058 #include <netinet/in.h>
1062 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1064 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1065 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1066 have_struct_kinfo_proc_freebsd="yes"
1069 have_struct_kinfo_proc_freebsd="no"
1073 #include <sys/param.h>
1074 #include <sys/sysctl.h>
1075 #include <sys/user.h>
1078 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1080 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1081 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1082 have_struct_kinfo_proc_openbsd="yes"
1085 have_struct_kinfo_proc_openbsd="no"
1088 #include <sys/param.h>
1089 #include <sys/sysctl.h>
1093 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1094 [#define _BSD_SOURCE
1096 # include <stdint.h>
1098 #if HAVE_SYS_TYPES_H
1099 # include <sys/types.h>
1101 #if HAVE_NETINET_IN_SYSTM_H
1102 # include <netinet/in_systm.h>
1104 #if HAVE_NETINET_IN_H
1105 # include <netinet/in.h>
1107 #if HAVE_NETINET_IP_H
1108 # include <netinet/ip.h>
1110 #if HAVE_NETINET_UDP_H
1111 # include <netinet/udp.h>
1114 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1115 [#define _BSD_SOURCE
1117 # include <stdint.h>
1119 #if HAVE_SYS_TYPES_H
1120 # include <sys/types.h>
1122 #if HAVE_NETINET_IN_SYSTM_H
1123 # include <netinet/in_systm.h>
1125 #if HAVE_NETINET_IN_H
1126 # include <netinet/in.h>
1128 #if HAVE_NETINET_IP_H
1129 # include <netinet/ip.h>
1131 #if HAVE_NETINET_UDP_H
1132 # include <netinet/udp.h>
1136 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1146 # Checks for libraries begin here
1148 with_libresolv="yes"
1149 AC_CHECK_LIB(resolv, res_search,
1151 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1153 [with_libresolv="no"])
1154 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1156 dnl Check for HAL (hardware abstraction library)
1158 AC_CHECK_LIB(hal,libhal_device_property_exists,
1159 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1161 if test "x$with_libhal" = "xyes"; then
1162 if test "x$PKG_CONFIG" != "x"; then
1163 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1164 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1165 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1166 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1170 m4_divert_once([HELP_WITH], [
1171 collectd additional packages:])
1173 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1175 if test "x$ac_system" = "xAIX"
1180 with_perfstat="no (AIX only)"
1181 with_procinfo="no (AIX only)"
1184 if test "x$with_perfstat" = "xyes"
1186 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1187 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1189 if test "x$with_perfstat" = "xyes"
1191 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1193 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1195 # Processes plugin under AIX.
1196 if test "x$with_procinfo" = "xyes"
1198 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1200 if test "x$with_procinfo" = "xyes"
1202 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1205 if test "x$ac_system" = "xSolaris"
1210 with_kstat="no (Solaris only)"
1211 with_devinfo="no (Solaris only)"
1214 if test "x$with_kstat" = "xyes"
1216 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1218 if test "x$with_kstat" = "xyes"
1220 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1221 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1223 if test "x$with_kstat" = "xyes"
1225 AC_DEFINE(HAVE_LIBKSTAT, 1,
1226 [Define to 1 if you have the 'kstat' library (-lkstat)])
1228 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1229 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1232 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1239 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1242 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1243 if test "x$with_kvm_getprocs" = "xyes"
1245 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1246 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1249 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1251 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1252 if test "x$with_kvm_getswapinfo" = "xyes"
1254 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1255 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1258 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1260 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1261 if test "x$with_kvm_nlist" = "xyes"
1263 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1264 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1267 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1269 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1270 if test "x$with_kvm_openfiles" = "xyes"
1272 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1273 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1276 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1278 # --with-libcurl {{{
1279 with_curl_config="curl-config"
1282 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1284 if test "x$withval" = "xno"
1287 else if test "x$withval" = "xyes"
1291 if test -f "$withval" && test -x "$withval"
1293 with_curl_config="$withval"
1295 else if test -x "$withval/bin/curl-config"
1297 with_curl_config="$withval/bin/curl-config"
1306 if test "x$with_libcurl" = "xyes"
1308 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1309 curl_config_status=$?
1311 if test $curl_config_status -ne 0
1313 with_libcurl="no ($with_curl_config failed)"
1315 SAVE_CPPFLAGS="$CPPFLAGS"
1316 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1318 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1320 CPPFLAGS="$SAVE_CPPFLAGS"
1323 if test "x$with_libcurl" = "xyes"
1325 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1326 curl_config_status=$?
1328 if test $curl_config_status -ne 0
1330 with_libcurl="no ($with_curl_config failed)"
1332 AC_CHECK_LIB(curl, curl_easy_init,
1333 [with_libcurl="yes"],
1334 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1338 if test "x$with_libcurl" = "xyes"
1340 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1341 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1342 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1343 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1345 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1349 with_libdbi_cppflags=""
1350 with_libdbi_ldflags=""
1351 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1353 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1355 with_libdbi_cppflags="-I$withval/include"
1356 with_libdbi_ldflags="-L$withval/lib"
1359 with_libdbi="$withval"
1365 if test "x$with_libdbi" = "xyes"
1367 SAVE_CPPFLAGS="$CPPFLAGS"
1368 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1370 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1372 CPPFLAGS="$SAVE_CPPFLAGS"
1374 if test "x$with_libdbi" = "xyes"
1376 SAVE_CPPFLAGS="$CPPFLAGS"
1377 SAVE_LDFLAGS="$LDFLAGS"
1378 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1379 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1381 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1383 CPPFLAGS="$SAVE_CPPFLAGS"
1384 LDFLAGS="$SAVE_LDFLAGS"
1386 if test "x$with_libdbi" = "xyes"
1388 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1389 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1390 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1391 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1392 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1393 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1395 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1398 # --with-libesmtp {{{
1399 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1401 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1403 LDFLAGS="$LDFLAGS -L$withval/lib"
1404 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1407 with_libesmtp="$withval"
1413 if test "x$with_libesmtp" = "xyes"
1415 AC_CHECK_LIB(esmtp, smtp_create_session,
1417 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1418 ], [with_libesmtp="no (libesmtp not found)"])
1420 if test "x$with_libesmtp" = "xyes"
1422 AC_CHECK_HEADERS(libesmtp.h,
1424 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1425 ], [with_libesmtp="no (libesmtp.h not found)"])
1427 if test "x$with_libesmtp" = "xyes"
1433 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1434 [Wether or not to use the esmtp library])
1435 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1438 # --with-libganglia {{{
1439 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1441 if test -f "$withval" && test -x "$withval"
1443 with_libganglia_config="$withval"
1444 with_libganglia="yes"
1445 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1447 with_libganglia_config="$withval/bin/ganglia-config"
1448 with_libganglia="yes"
1449 else if test -d "$withval"
1451 GANGLIA_CPPFLAGS="-I$withval/include"
1452 GANGLIA_LDFLAGS="-L$withval/lib"
1453 with_libganglia="yes"
1455 with_libganglia_config="ganglia-config"
1456 with_libganglia="$withval"
1460 with_libganglia_config="ganglia-config"
1461 with_libganglia="yes"
1464 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1466 if test "x$GANGLIA_CPPFLAGS" = "x"
1468 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1471 if test "x$GANGLIA_LDFLAGS" = "x"
1473 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1476 if test "x$GANGLIA_LIBS" = "x"
1478 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1482 SAVE_CPPFLAGS="$CPPFLAGS"
1483 SAVE_LDFLAGS="$LDFLAGS"
1484 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1485 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1487 if test "x$with_libganglia" = "xyes"
1489 AC_CHECK_HEADERS(gm_protocol.h,
1491 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1492 [Define to 1 if you have the <gm_protocol.h> header file.])
1493 ], [with_libganglia="no (gm_protocol.h not found)"])
1496 if test "x$with_libganglia" = "xyes"
1498 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1500 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1501 [Define to 1 if you have the ganglia library (-lganglia).])
1502 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1505 CPPFLAGS="$SAVE_CPPFLAGS"
1506 LDFLAGS="$SAVE_LDFLAGS"
1508 AC_SUBST(GANGLIA_CPPFLAGS)
1509 AC_SUBST(GANGLIA_LDFLAGS)
1510 AC_SUBST(GANGLIA_LIBS)
1511 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1514 # --with-libgcrypt {{{
1515 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1516 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1517 GCRYPT_LIBS="$GCRYPT_LIBS"
1518 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1520 if test -f "$withval" && test -x "$withval"
1522 with_libgcrypt_config="$withval"
1523 with_libgcrypt="yes"
1524 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1526 with_libgcrypt_config="$withval/bin/gcrypt-config"
1527 with_libgcrypt="yes"
1528 else if test -d "$withval"
1530 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1531 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1532 with_libgcrypt="yes"
1534 with_libgcrypt_config="gcrypt-config"
1535 with_libgcrypt="$withval"
1539 with_libgcrypt_config="libgcrypt-config"
1540 with_libgcrypt="yes"
1543 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1545 if test "x$GCRYPT_CPPFLAGS" = "x"
1547 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1550 if test "x$GCRYPT_LDFLAGS" = "x"
1552 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1553 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1556 if test "x$GCRYPT_LIBS" = "x"
1558 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1562 SAVE_CPPFLAGS="$CPPFLAGS"
1563 SAVE_LDFLAGS="$LDFLAGS"
1564 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1565 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1567 if test "x$with_libgcrypt" = "xyes"
1569 if test "x$GCRYPT_CPPFLAGS" != "x"
1571 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1573 AC_CHECK_HEADERS(gcrypt.h,
1574 [with_libgcrypt="yes"],
1575 [with_libgcrypt="no (gcrypt.h not found)"])
1578 if test "x$with_libgcrypt" = "xyes"
1580 if test "x$GCRYPT_LDFLAGS" != "x"
1582 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1584 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1585 [with_libgcrypt="yes"],
1586 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1588 if test "$with_libgcrypt" != "no"; then
1589 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1593 CPPFLAGS="$SAVE_CPPFLAGS"
1594 LDFLAGS="$SAVE_LDFLAGS"
1596 if test "x$with_libgcrypt" = "xyes"
1598 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1601 AC_SUBST(GCRYPT_CPPFLAGS)
1602 AC_SUBST(GCRYPT_LDFLAGS)
1603 AC_SUBST(GCRYPT_LIBS)
1604 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1607 # --with-libiptc {{{
1608 with_own_libiptc="no"
1609 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1611 if test "x$withval" = "xshipped"
1613 with_own_libiptc="yes"
1615 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1617 LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS -I$withval/include"
1618 LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS -L$withval/lib"
1621 with_libiptc="$withval"
1625 if test "x$ac_system" = "xLinux"
1629 with_libiptc="no (Linux only)"
1632 SAVE_CPPFLAGS="$CPPFLAGS"
1633 SAVE_LDFLAGS="$LDFLAGS"
1634 CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
1635 LDFLAGS="$LDFLAGS $LIBIPTC_LDFLAGS"
1636 # check whether the header file for libiptc is available.
1637 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1639 AC_CHECK_HEADERS(libiptc/libiptc.h,
1641 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1645 with_own_libiptc="yes"
1648 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1650 AC_CHECK_HEADERS(libiptc/libip6tc.h,
1652 AC_DEFINE(HAVE_LIBIPTC_LIBIP6TC_H, 1, [Define to 1 if you have the <libiptc/libip6tc.h> header file.])
1656 with_own_libiptc="yes"
1659 # If the header file is available, check for the required type declaractions.
1660 # They may be missing in old versions of libiptc. In that case, they will be
1661 # declared in the iptables plugin.
1662 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1664 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [],
1667 # include "$srcdir/src/owniptc/libiptc.h"
1668 # include "$srcdir/src/owniptc/libip6tc.h"
1670 # include <libiptc/libiptc.h>
1671 # include <libiptc/libip6tc.h>
1675 # Check for the iptc_init symbol in the library.
1676 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1678 AC_CHECK_LIB(iptc, iptc_init,
1680 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1684 with_own_libiptc="yes"
1687 # The system wide version failed for some reason. Check if we have the required
1688 # headers to build the shipped version.
1689 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xyes"
1691 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1693 with_libiptc="no (Linux iptables headers not found)"
1694 with_own_libiptc="no"
1697 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1700 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1701 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1702 if test "x$with_libiptc" = "xyes"
1704 BUILD_WITH_LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS"
1705 BUILD_WITH_LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS"
1706 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1707 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1709 if test "x$with_own_libiptc" = "xyes"
1711 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1713 CPPFLAGS="$SAVE_CPPFLAGS"
1714 LDFLAGS="$SAVE_LDFLAGS"
1718 with_java_home="$JAVA_HOME"
1719 with_java_vmtype="client"
1724 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1726 if test "x$withval" = "xno"
1729 else if test "x$withval" = "xyes"
1733 with_java_home="$withval"
1738 if test "x$with_java" = "xyes"
1740 if test -d "$with_java_home"
1742 AC_MSG_CHECKING([for jni.h])
1743 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1744 if test "x$TMPDIR" != "x"
1746 AC_MSG_RESULT([found in $TMPDIR])
1747 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1749 AC_MSG_RESULT([not found])
1752 AC_MSG_CHECKING([for jni_md.h])
1753 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1754 if test "x$TMPDIR" != "x"
1756 AC_MSG_RESULT([found in $TMPDIR])
1757 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1759 AC_MSG_RESULT([not found])
1762 AC_MSG_CHECKING([for libjvm.so])
1763 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1764 if test "x$TMPDIR" != "x"
1766 AC_MSG_RESULT([found in $TMPDIR])
1767 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1769 AC_MSG_RESULT([not found])
1772 if test "x$JAVAC" = "x"
1774 AC_MSG_CHECKING([for javac])
1775 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1776 if test "x$TMPDIR" != "x"
1779 AC_MSG_RESULT([$JAVAC])
1781 AC_MSG_RESULT([not found])
1784 if test "x$JAR" = "x"
1786 AC_MSG_CHECKING([for jar])
1787 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1788 if test "x$TMPDIR" != "x"
1791 AC_MSG_RESULT([$JAR])
1793 AC_MSG_RESULT([not found])
1796 else if test "x$with_java_home" != "x"
1798 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1802 if test "x$JAVA_CPPFLAGS" != "x"
1804 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1806 if test "x$JAVA_CFLAGS" != "x"
1808 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1810 if test "x$JAVA_LDFLAGS" != "x"
1812 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1814 if test "x$JAVAC" = "x"
1816 with_javac_path="$PATH"
1817 if test "x$with_java_home" != "x"
1819 with_javac_path="$with_java_home:with_javac_path"
1820 if test -d "$with_java_home/bin"
1822 with_javac_path="$with_java_home/bin:with_javac_path"
1826 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1828 if test "x$JAVAC" = "x"
1830 with_java="no (javac not found)"
1832 if test "x$JAR" = "x"
1834 with_jar_path="$PATH"
1835 if test "x$with_java_home" != "x"
1837 with_jar_path="$with_java_home:$with_jar_path"
1838 if test -d "$with_java_home/bin"
1840 with_jar_path="$with_java_home/bin:$with_jar_path"
1844 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
1846 if test "x$JAR" = "x"
1848 with_java="no (jar not found)"
1851 SAVE_CPPFLAGS="$CPPFLAGS"
1852 SAVE_CFLAGS="$CFLAGS"
1853 SAVE_LDFLAGS="$LDFLAGS"
1854 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1855 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1856 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1858 if test "x$with_java" = "xyes"
1860 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1862 if test "x$with_java" = "xyes"
1864 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1866 [with_java="no (libjvm not found)"],
1869 if test "x$with_java" = "xyes"
1871 JAVA_LIBS="$JAVA_LIBS -ljvm"
1872 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1875 CPPFLAGS="$SAVE_CPPFLAGS"
1876 CFLAGS="$SAVE_CFLAGS"
1877 LDFLAGS="$SAVE_LDFLAGS"
1879 AC_SUBST(JAVA_CPPFLAGS)
1880 AC_SUBST(JAVA_CFLAGS)
1881 AC_SUBST(JAVA_LDFLAGS)
1883 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1886 # --with-libmemcached {{{
1887 with_libmemcached_cppflags=""
1888 with_libmemcached_ldflags=""
1889 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1891 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1893 with_libmemcached_cppflags="-I$withval/include"
1894 with_libmemcached_ldflags="-L$withval/lib"
1895 with_libmemcached="yes"
1897 with_libmemcached="$withval"
1901 with_libmemcached="yes"
1903 if test "x$with_libmemcached" = "xyes"
1905 SAVE_CPPFLAGS="$CPPFLAGS"
1906 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1908 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1910 CPPFLAGS="$SAVE_CPPFLAGS"
1912 if test "x$with_libmemcached" = "xyes"
1914 SAVE_CPPFLAGS="$CPPFLAGS"
1915 SAVE_LDFLAGS="$LDFLAGS"
1916 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1917 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1919 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1921 CPPFLAGS="$SAVE_CPPFLAGS"
1922 LDFLAGS="$SAVE_LDFLAGS"
1924 if test "x$with_libmemcached" = "xyes"
1926 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1927 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1928 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1929 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1930 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1931 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1932 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1934 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1937 # --with-libmodbus {{{
1938 with_libmodbus_config=""
1939 with_libmodbus_cflags=""
1940 with_libmodbus_libs=""
1941 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
1943 if test "x$withval" = "xno"
1946 else if test "x$withval" = "xyes"
1948 with_libmodbus="use_pkgconfig"
1949 else if test -d "$with_libmodbus/lib"
1951 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
1952 with_libmodbus_cflags="-I$withval/include"
1953 with_libmodbus_libs="-L$withval/lib -lmodbus"
1954 with_libmodbus="yes"
1957 [with_libmodbus="use_pkgconfig"])
1959 # configure using pkg-config
1960 if test "x$with_libmodbus" = "xuse_pkgconfig"
1962 if test "x$PKG_CONFIG" = "x"
1964 with_libmodbus="no (Don't have pkg-config)"
1967 if test "x$with_libmodbus" = "xuse_pkgconfig"
1969 AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
1970 $PKG_CONFIG --exists 'modbus' 2>/dev/null
1973 with_libmodbus="no (pkg-config doesn't know library)"
1976 if test "x$with_libmodbus" = "xuse_pkgconfig"
1978 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
1981 with_libmodbus="no ($PKG_CONFIG failed)"
1983 with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
1986 with_libmodbus="no ($PKG_CONFIG failed)"
1989 if test "x$with_libmodbus" = "xuse_pkgconfig"
1991 with_libmodbus="yes"
1994 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
1995 # the actual checks.
1996 if test "x$with_libmodbus" = "xyes"
1998 SAVE_CPPFLAGS="$CPPFLAGS"
1999 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2001 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2003 CPPFLAGS="$SAVE_CPPFLAGS"
2005 if test "x$with_libmodbus" = "xyes"
2007 SAVE_CPPFLAGS="$CPPFLAGS"
2008 SAVE_LDFLAGS="$LDFLAGS"
2010 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2011 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2013 AC_CHECK_LIB(modbus, modbus_init_tcp,
2014 [with_libmodbus="yes"],
2015 [with_libmodbus="no (symbol modbus_init_tcp not found)"])
2017 CPPFLAGS="$SAVE_CPPFLAGS"
2018 LDFLAGS="$SAVE_LDFLAGS"
2020 if test "x$with_libmodbus" = "xyes"
2022 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2023 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2024 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2025 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2029 # --with-libmysql {{{
2030 with_mysql_config="mysql_config"
2031 with_mysql_cflags=""
2033 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2035 if test "x$withval" = "xno"
2038 else if test "x$withval" = "xyes"
2042 if test -f "$withval" && test -x "$withval";
2044 with_mysql_config="$withval"
2045 else if test -x "$withval/bin/mysql_config"
2047 with_mysql_config="$withval/bin/mysql_config"
2055 if test "x$with_libmysql" = "xyes"
2057 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2058 mysql_config_status=$?
2060 if test $mysql_config_status -ne 0
2062 with_libmysql="no ($with_mysql_config failed)"
2064 SAVE_CPPFLAGS="$CPPFLAGS"
2065 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2068 have_mysql_mysql_h="no"
2069 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2071 if test "x$have_mysql_h" = "xno"
2073 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2076 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2078 with_libmysql="no (mysql.h not found)"
2081 CPPFLAGS="$SAVE_CPPFLAGS"
2084 if test "x$with_libmysql" = "xyes"
2086 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
2087 mysql_config_status=$?
2089 if test $mysql_config_status -ne 0
2091 with_libmysql="no ($with_mysql_config failed)"
2093 AC_CHECK_LIB(mysqlclient, mysql_init,
2094 [with_libmysql="yes"],
2095 [with_libmysql="no (symbol 'mysql_init' not found)"],
2098 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2099 [with_libmysql="yes"],
2100 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2104 if test "x$with_libmysql" = "xyes"
2106 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2107 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2108 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2109 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2111 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2114 # --with-libnetlink {{{
2115 with_libnetlink_cflags=""
2116 with_libnetlink_libs="-lnetlink"
2117 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2119 echo "libnetlink: withval = $withval"
2120 if test "x$withval" = "xyes"
2122 with_libnetlink="yes"
2123 else if test "x$withval" = "xno"
2125 with_libnetlink="no"
2127 if test -d "$withval/include"
2129 with_libnetlink_cflags="-I$withval/include"
2130 with_libnetlink_libs="-L$withval/lib -lnetlink"
2131 with_libnetlink="yes"
2133 AC_MSG_ERROR("no such directory: $withval/include")
2138 if test "x$ac_system" = "xLinux"
2140 with_libnetlink="yes"
2142 with_libnetlink="no (Linux only library)"
2145 if test "x$with_libnetlink" = "xyes"
2147 SAVE_CFLAGS="$CFLAGS"
2148 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2150 with_libnetlink="no (libnetlink.h not found)"
2152 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2154 with_libnetlink="yes"
2158 #include <sys/types.h>
2159 #include <asm/types.h>
2160 #include <sys/socket.h>
2161 #include <linux/netlink.h>
2162 #include <linux/rtnetlink.h>])
2163 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2165 #include <sys/types.h>
2166 #include <asm/types.h>
2167 #include <sys/socket.h>])
2171 #include <sys/types.h>
2172 #include <asm/types.h>
2173 #include <sys/socket.h>
2174 #include <linux/netlink.h>
2175 #include <linux/rtnetlink.h>
2179 int retval = TCA_STATS2;
2182 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2187 #include <sys/types.h>
2188 #include <asm/types.h>
2189 #include <sys/socket.h>
2190 #include <linux/netlink.h>
2191 #include <linux/rtnetlink.h>
2195 int retval = TCA_STATS;
2198 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2201 CFLAGS="$SAVE_CFLAGS"
2203 if test "x$with_libnetlink" = "xyes"
2205 AC_CHECK_LIB(netlink, rtnl_open,
2206 [with_libnetlink="yes"],
2207 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2208 [$with_libnetlink_libs])
2210 if test "x$with_libnetlink" = "xyes"
2212 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2213 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2214 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2215 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2217 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2220 # --with-libnetapp {{{
2221 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2222 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2223 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2224 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2225 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2226 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2227 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2229 if test -d "$withval"
2231 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2232 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2233 with_libnetapp="yes"
2235 with_libnetapp="$withval"
2239 with_libnetapp="yes"
2242 SAVE_CPPFLAGS="$CPPFLAGS"
2243 SAVE_LDFLAGS="$LDFLAGS"
2244 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2245 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2247 if test "x$with_libnetapp" = "xyes"
2249 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2251 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2253 AC_CHECK_HEADERS(netapp_api.h,
2254 [with_libnetapp="yes"],
2255 [with_libnetapp="no (netapp_api.h not found)"])
2258 if test "x$with_libnetapp" = "xyes"
2260 if test "x$LIBNETAPP_LDFLAGS" != "x"
2262 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2265 if test "x$LIBNETAPP_LIBS" = "x"
2267 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2269 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2271 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2272 [with_libnetapp="yes"],
2273 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2275 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2278 CPPFLAGS="$SAVE_CPPFLAGS"
2279 LDFLAGS="$SAVE_LDFLAGS"
2281 if test "x$with_libnetapp" = "xyes"
2283 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2286 AC_SUBST(LIBNETAPP_CPPFLAGS)
2287 AC_SUBST(LIBNETAPP_LDFLAGS)
2288 AC_SUBST(LIBNETAPP_LIBS)
2289 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2292 # --with-libnetsnmp {{{
2293 with_snmp_config="net-snmp-config"
2296 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2298 if test "x$withval" = "xno"
2300 with_libnetsnmp="no"
2301 else if test "x$withval" = "xyes"
2303 with_libnetsnmp="yes"
2305 if test -x "$withval"
2307 with_snmp_config="$withval"
2308 with_libnetsnmp="yes"
2310 with_snmp_config="$withval/bin/net-snmp-config"
2311 with_libnetsnmp="yes"
2315 [with_libnetsnmp="yes"])
2316 if test "x$with_libnetsnmp" = "xyes"
2318 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2319 snmp_config_status=$?
2321 if test $snmp_config_status -ne 0
2323 with_libnetsnmp="no ($with_snmp_config failed)"
2325 SAVE_CPPFLAGS="$CPPFLAGS"
2326 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2328 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2330 CPPFLAGS="$SAVE_CPPFLAGS"
2333 if test "x$with_libnetsnmp" = "xyes"
2335 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2336 snmp_config_status=$?
2338 if test $snmp_config_status -ne 0
2340 with_libnetsnmp="no ($with_snmp_config failed)"
2342 AC_CHECK_LIB(netsnmp, init_snmp,
2343 [with_libnetsnmp="yes"],
2344 [with_libnetsnmp="no (libnetsnmp not found)"],
2348 if test "x$with_libnetsnmp" = "xyes"
2350 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2351 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2352 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2353 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2355 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2358 # --with-liboconfig {{{
2359 with_own_liboconfig="no"
2360 liboconfig_LDFLAGS="$LDFLAGS"
2361 liboconfig_CPPFLAGS="$CPPFLAGS"
2362 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2364 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2366 if test -d "$withval/lib"
2368 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2370 if test -d "$withval/include"
2372 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2375 if test "x$withval" = "xno"
2377 AC_MSG_ERROR("liboconfig is required")
2381 with_liboconfig="yes"
2384 save_LDFLAGS="$LDFLAGS"
2385 save_CPPFLAGS="$CPPFLAGS"
2386 LDFLAGS="$liboconfig_LDFLAGS"
2387 CPPFLAGS="$liboconfig_CPPFLAGS"
2388 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2390 with_liboconfig="yes"
2391 with_own_liboconfig="no"
2394 with_liboconfig="yes"
2395 with_own_liboconfig="yes"
2396 LDFLAGS="$save_LDFLAGS"
2397 CPPFLAGS="$save_CPPFLAGS"
2400 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2401 if test "x$with_own_liboconfig" = "xyes"
2403 with_liboconfig="yes (shipped version)"
2407 # --with-liboping {{{
2408 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2410 if test "x$withval" = "xyes"
2413 else if test "x$withval" = "xno"
2418 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2419 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2422 [with_liboping="yes"])
2424 SAVE_CPPFLAGS="$CPPFLAGS"
2425 SAVE_LDFLAGS="$LDFLAGS"
2427 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2428 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2430 if test "x$with_liboping" = "xyes"
2432 if test "x$LIBOPING_CPPFLAGS" != "x"
2434 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2436 AC_CHECK_HEADERS(oping.h,
2437 [with_liboping="yes"],
2438 [with_liboping="no ('oping.h' not found)"])
2440 if test "x$with_liboping" = "xyes"
2442 if test "x$LIBOPING_LDFLAGS" != "x"
2444 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2446 AC_CHECK_LIB(oping, ping_construct,
2447 [with_liboping="yes"],
2448 [with_liboping="no (symbol 'ping_construct' not found)"])
2451 CPPFLAGS="$SAVE_CPPFLAGS"
2452 LDFLAGS="$SAVE_LDFLAGS"
2454 if test "x$with_liboping" = "xyes"
2456 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2457 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2458 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2459 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2461 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2465 with_oracle_cppflags=""
2467 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2469 if test "x$withval" = "xyes"
2471 if test "x$ORACLE_HOME" = "x"
2473 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2476 else if test "x$withval" = "xno"
2481 ORACLE_HOME="$withval"
2485 if test "x$ORACLE_HOME" = "x"
2487 with_oracle="no (ORACLE_HOME is not set)"
2492 if test "x$ORACLE_HOME" != "x"
2494 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2496 if test -e "$ORACLE_HOME/lib/ldflags"
2498 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2500 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2501 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2503 if test "x$with_oracle" = "xyes"
2505 SAVE_CPPFLAGS="$CPPFLAGS"
2506 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2508 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2510 CPPFLAGS="$SAVE_CPPFLAGS"
2512 if test "x$with_oracle" = "xyes"
2514 SAVE_CPPFLAGS="$CPPFLAGS"
2515 SAVE_LDFLAGS="$LDFLAGS"
2516 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2517 LDFLAGS="$LDFLAGS $with_oracle_libs"
2519 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2521 CPPFLAGS="$SAVE_CPPFLAGS"
2522 LDFLAGS="$SAVE_LDFLAGS"
2524 if test "x$with_oracle" = "xyes"
2526 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2527 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2528 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2529 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2533 # --with-libowcapi {{{
2534 with_libowcapi_cppflags=""
2535 with_libowcapi_libs="-lowcapi"
2536 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2538 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2540 with_libowcapi_cppflags="-I$withval/include"
2541 with_libowcapi_libs="-L$withval/lib -lowcapi"
2542 with_libowcapi="yes"
2544 with_libowcapi="$withval"
2548 with_libowcapi="yes"
2550 if test "x$with_libowcapi" = "xyes"
2552 SAVE_CPPFLAGS="$CPPFLAGS"
2553 CPPFLAGS="$with_libowcapi_cppflags"
2555 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2557 CPPFLAGS="$SAVE_CPPFLAGS"
2559 if test "x$with_libowcapi" = "xyes"
2561 SAVE_LDFLAGS="$LDFLAGS"
2562 SAVE_CPPFLAGS="$CPPFLAGS"
2563 LDFLAGS="$with_libowcapi_libs"
2564 CPPFLAGS="$with_libowcapi_cppflags"
2566 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2568 LDFLAGS="$SAVE_LDFLAGS"
2569 CPPFLAGS="$SAVE_CPPFLAGS"
2571 if test "x$with_libowcapi" = "xyes"
2573 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2574 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2575 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2576 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2580 # --with-libpcap {{{
2581 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2583 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2585 LDFLAGS="$LDFLAGS -L$withval/lib"
2586 CPPFLAGS="$CPPFLAGS -I$withval/include"
2589 with_libpcap="$withval"
2595 if test "x$with_libpcap" = "xyes"
2597 AC_CHECK_LIB(pcap, pcap_open_live,
2599 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2600 ], [with_libpcap="no (libpcap not found)"])
2602 if test "x$with_libpcap" = "xyes"
2604 AC_CHECK_HEADERS(pcap.h,
2606 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2607 ], [with_libpcap="no (pcap.h not found)"])
2609 if test "x$with_libpcap" = "xyes"
2615 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2616 [Wether or not to use the pcap library])
2617 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2620 # --with-libperl {{{
2621 perl_interpreter="perl"
2622 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2624 if test -x "$withval"
2626 perl_interpreter="$withval"
2628 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2630 LDFLAGS="$LDFLAGS -L$withval/lib"
2631 CPPFLAGS="$CPPFLAGS -I$withval/include"
2632 perl_interpreter="$withval/bin/perl"
2635 with_libperl="$withval"
2642 AC_MSG_CHECKING([for perl])
2643 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2644 if test -x "$perl_interpreter"
2646 AC_MSG_RESULT([yes ($perl_interpreter)])
2652 AC_SUBST(PERL, "$perl_interpreter")
2654 if test "x$with_libperl" = "xyes" \
2655 && test -n "$perl_interpreter"
2657 SAVE_CFLAGS="$CFLAGS"
2658 SAVE_LDFLAGS="$LDFLAGS"
2659 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2660 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2661 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2662 CFLAGS="$CFLAGS $PERL_CFLAGS"
2663 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2665 AC_CACHE_CHECK([for libperl],
2666 [c_cv_have_libperl],
2670 #define PERL_NO_GET_CONTEXT
2677 load_module (PERL_LOADMOD_NOIMPORT,
2678 newSVpv ("Collectd::Plugin::FooBar", 24),
2681 [c_cv_have_libperl="yes"],
2682 [c_cv_have_libperl="no"]
2686 if test "x$c_cv_have_libperl" = "xyes"
2688 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2689 AC_SUBST(PERL_CFLAGS)
2690 AC_SUBST(PERL_LDFLAGS)
2695 CFLAGS="$SAVE_CFLAGS"
2696 LDFLAGS="$SAVE_LDFLAGS"
2697 else if test -z "$perl_interpreter"; then
2698 with_libperl="no (no perl interpreter found)"
2699 c_cv_have_libperl="no"
2701 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2703 if test "x$with_libperl" = "xyes"
2705 SAVE_CFLAGS="$CFLAGS"
2706 SAVE_LDFLAGS="$LDFLAGS"
2707 CFLAGS="$CFLAGS $PERL_CFLAGS"
2708 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2710 AC_CACHE_CHECK([if perl supports ithreads],
2711 [c_cv_have_perl_ithreads],
2719 #if !defined(USE_ITHREADS)
2720 # error "Perl does not support ithreads!"
2721 #endif /* !defined(USE_ITHREADS) */
2724 [c_cv_have_perl_ithreads="yes"],
2725 [c_cv_have_perl_ithreads="no"]
2729 if test "x$c_cv_have_perl_ithreads" = "xyes"
2731 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2734 CFLAGS="$SAVE_CFLAGS"
2735 LDFLAGS="$SAVE_LDFLAGS"
2738 if test "x$with_libperl" = "xyes"
2740 SAVE_CFLAGS="$CFLAGS"
2741 SAVE_LDFLAGS="$LDFLAGS"
2742 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2743 # (see issues #41 and #42)
2744 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2745 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2747 AC_CACHE_CHECK([for broken Perl_load_module()],
2748 [c_cv_have_broken_perl_load_module],
2752 #define PERL_NO_GET_CONTEXT
2759 load_module (PERL_LOADMOD_NOIMPORT,
2760 newSVpv ("Collectd::Plugin::FooBar", 24),
2763 [c_cv_have_broken_perl_load_module="no"],
2764 [c_cv_have_broken_perl_load_module="yes"]
2768 CFLAGS="$SAVE_CFLAGS"
2769 LDFLAGS="$SAVE_LDFLAGS"
2771 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2772 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2774 if test "x$with_libperl" = "xyes"
2776 SAVE_CFLAGS="$CFLAGS"
2777 SAVE_LDFLAGS="$LDFLAGS"
2778 CFLAGS="$CFLAGS $PERL_CFLAGS"
2779 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2782 [struct mgvtbl.svt_local],
2783 [have_struct_mgvtbl_svt_local="yes"],
2784 [have_struct_mgvtbl_svt_local="no"],
2791 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2793 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2794 [Define if Perl's struct mgvtbl has member svt_local.])
2797 CFLAGS="$SAVE_CFLAGS"
2798 LDFLAGS="$SAVE_LDFLAGS"
2803 with_pg_config="pg_config"
2804 with_libpq_includedir=""
2805 with_libpq_libdir=""
2806 with_libpq_cppflags=""
2807 with_libpq_ldflags=""
2808 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2811 if test "x$withval" = "xno"
2814 else if test "x$withval" = "xyes"
2818 if test -f "$withval" && test -x "$withval";
2820 with_pg_config="$withval"
2821 else if test -x "$withval/bin/pg_config"
2823 with_pg_config="$withval/bin/pg_config"
2831 if test "x$with_libpq" = "xyes"
2833 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2836 if test $pg_config_status -eq 0
2838 if test -n "$with_libpq_includedir"; then
2839 for dir in $with_libpq_includedir; do
2840 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2844 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2847 SAVE_CPPFLAGS="$CPPFLAGS"
2848 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2850 AC_CHECK_HEADERS(libpq-fe.h, [],
2851 [with_libpq="no (libpq-fe.h not found)"], [])
2853 CPPFLAGS="$SAVE_CPPFLAGS"
2855 if test "x$with_libpq" = "xyes"
2857 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2860 if test $pg_config_status -eq 0
2862 if test -n "$with_libpq_libdir"; then
2863 for dir in $with_libpq_libdir; do
2864 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2868 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2871 SAVE_LDFLAGS="$LDFLAGS"
2872 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2874 AC_CHECK_LIB(pq, PQconnectdb,
2876 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2878 AC_CHECK_LIB(pq, PQserverVersion,
2880 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2882 LDFLAGS="$SAVE_LDFLAGS"
2884 if test "x$with_libpq" = "xyes"
2886 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2887 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2888 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2889 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2891 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2894 # --with-libpthread {{{
2895 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2896 [ if test "x$withval" != "xno" \
2897 && test "x$withval" != "xyes"
2899 LDFLAGS="$LDFLAGS -L$withval/lib"
2900 CPPFLAGS="$CPPFLAGS -I$withval/include"
2901 with_libpthread="yes"
2903 if test "x$withval" = "xno"
2905 with_libpthread="no (disabled)"
2908 ], [with_libpthread="yes"])
2909 if test "x$with_libpthread" = "xyes"
2911 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2914 if test "x$with_libpthread" = "xyes"
2916 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2918 if test "x$with_libpthread" = "xyes"
2924 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2925 [Wether or not to use pthread (POSIX threads) library])
2926 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2931 with_python_path="$PATH"
2932 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
2934 if test "x$withval" = "xyes" || test "x$withval" = "xno"
2936 with_python="$withval"
2937 else if test -x "$withval"
2939 with_python_prog="$withval"
2940 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
2942 else if test -d "$withval"
2944 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
2947 AC_MSG_WARN([Argument not recognized: $withval])
2949 ], [with_python="yes"])
2952 SAVE_CPPFLAGS="$CPPFLAGS"
2953 SAVE_LDFLAGS="$LDFLAGS"
2956 PATH="$with_python_path"
2958 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
2960 AC_MSG_CHECKING([for python])
2961 with_python_prog="`which python 2>/dev/null`"
2962 if test "x$with_python_prog" = "x"
2964 AC_MSG_RESULT([not found])
2965 with_python="no (interpreter not found)"
2967 AC_MSG_RESULT([$with_python_prog])
2971 if test "x$with_python" = "xyes"
2973 AC_MSG_CHECKING([for Python CPPFLAGS])
2974 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
2975 python_config_status=$?
2977 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
2979 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
2982 AC_MSG_RESULT([$python_include_path])
2986 if test "x$with_python" = "xyes"
2988 CPPFLAGS="-I$python_include_path $CPPFLAGS"
2989 AC_CHECK_HEADERS(Python.h,
2990 [with_python="yes"],
2991 [with_python="no ('Python.h' not found)"])
2994 if test "x$with_python" = "xyes"
2996 AC_MSG_CHECKING([for Python LDFLAGS])
2997 python_library_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0))" | "$with_python_prog" 2>&1`
2998 python_config_status=$?
3000 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3002 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3005 AC_MSG_RESULT([$python_library_path])
3009 if test "x$with_python" = "xyes"
3011 AC_MSG_CHECKING([for Python LIBS])
3012 python_library_flags=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0))" | "$with_python_prog" 2>&1`
3013 python_config_status=$?
3015 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3017 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3020 AC_MSG_RESULT([$python_library_flags])
3024 if test "x$with_python" = "xyes"
3026 LDFLAGS="-L$python_library_path $LDFLAGS"
3027 LIBS="$python_library_flags $LIBS"
3029 AC_CHECK_FUNC(PyObject_CallFunction,
3030 [with_python="yes"],
3031 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3035 CPPFLAGS="$SAVE_CPPFLAGS"
3036 LDFLAGS="$SAVE_LDFLAGS"
3039 if test "x$with_python" = "xyes"
3041 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3042 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3043 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3044 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3045 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3046 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3050 # --with-librouteros {{{
3051 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3053 if test "x$withval" = "xyes"
3055 with_librouteros="yes"
3056 else if test "x$withval" = "xno"
3058 with_librouteros="no"
3060 with_librouteros="yes"
3061 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3062 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3065 [with_librouteros="yes"])
3067 SAVE_CPPFLAGS="$CPPFLAGS"
3068 SAVE_LDFLAGS="$LDFLAGS"
3070 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3071 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3073 if test "x$with_librouteros" = "xyes"
3075 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3077 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3079 AC_CHECK_HEADERS(routeros_api.h,
3080 [with_librouteros="yes"],
3081 [with_librouteros="no ('routeros_api.h' not found)"])
3083 if test "x$with_librouteros" = "xyes"
3085 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3087 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3089 AC_CHECK_LIB(routeros, ros_interface,
3090 [with_librouteros="yes"],
3091 [with_librouteros="no (symbol 'ros_interface' not found)"])
3094 CPPFLAGS="$SAVE_CPPFLAGS"
3095 LDFLAGS="$SAVE_LDFLAGS"
3097 if test "x$with_librouteros" = "xyes"
3099 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3100 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3101 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3102 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3104 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3108 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3111 librrd_threadsafe="yes"
3112 librrd_rrdc_update="no"
3113 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3114 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3116 librrd_cflags="-I$withval/include"
3117 librrd_ldflags="-L$withval/lib"
3120 with_librrd="$withval"
3122 ], [with_librrd="yes"])
3123 if test "x$with_librrd" = "xyes"
3125 SAVE_CPPFLAGS="$CPPFLAGS"
3126 SAVE_LDFLAGS="$LDFLAGS"
3128 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3129 LDFLAGS="$LDFLAGS $librrd_ldflags"
3131 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3133 CPPFLAGS="$SAVE_CPPFLAGS"
3134 LDFLAGS="$SAVE_LDFLAGS"
3136 if test "x$with_librrd" = "xyes"
3138 SAVE_CPPFLAGS="$CPPFLAGS"
3139 SAVE_LDFLAGS="$LDFLAGS"
3141 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3142 LDFLAGS="$LDFLAGS $librrd_ldflags"
3144 AC_CHECK_LIB(rrd_th, rrd_update_r,
3146 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3148 [librrd_threadsafe="no"
3149 AC_CHECK_LIB(rrd, rrd_update,
3151 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3153 [with_librrd="no (symbol 'rrd_update' not found)"],
3158 if test "x$librrd_threadsafe" = "xyes"
3160 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3162 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3165 CPPFLAGS="$SAVE_CPPFLAGS"
3166 LDFLAGS="$SAVE_LDFLAGS"
3168 if test "x$with_librrd" = "xyes"
3170 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3171 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3172 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3173 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3175 if test "x$librrd_threadsafe" = "xyes"
3177 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3181 # --with-libsensors {{{
3182 with_sensors_cflags=""
3183 with_sensors_ldflags=""
3184 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3186 if test "x$withval" = "xno"
3188 with_libsensors="no"
3190 with_libsensors="yes"
3191 if test "x$withval" != "xyes"
3193 with_sensors_cflags="-I$withval/include"
3194 with_sensors_ldflags="-L$withval/lib"
3195 with_libsensors="yes"
3200 if test "x$ac_system" = "xLinux"
3202 with_libsensors="yes"
3204 with_libsensors="no (Linux only library)"
3207 if test "x$with_libsensors" = "xyes"
3209 SAVE_CPPFLAGS="$CPPFLAGS"
3210 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3212 # AC_CHECK_HEADERS(sensors/sensors.h,
3214 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3216 # [with_libsensors="no (sensors/sensors.h not found)"])
3217 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3219 CPPFLAGS="$SAVE_CPPFLAGS"
3221 if test "x$with_libsensors" = "xyes"
3223 SAVE_CPPFLAGS="$CPPFLAGS"
3224 SAVE_LDFLAGS="$LDFLAGS"
3225 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3226 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3228 AC_CHECK_LIB(sensors, sensors_init,
3230 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3232 [with_libsensors="no (libsensors not found)"])
3234 CPPFLAGS="$SAVE_CPPFLAGS"
3235 LDFLAGS="$SAVE_LDFLAGS"
3237 if test "x$with_libsensors" = "xyes"
3239 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3240 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3241 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3242 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3244 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3247 # --with-libstatgrab {{{
3248 with_libstatgrab_cflags=""
3249 with_libstatgrab_ldflags=""
3250 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3252 if test "x$withval" != "xno" \
3253 && test "x$withval" != "xyes"
3255 with_libstatgrab_cflags="-I$withval/include"
3256 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3257 with_libstatgrab="yes"
3258 with_libstatgrab_pkg_config="no"
3260 with_libstatgrab="$withval"
3261 with_libstatgrab_pkg_config="yes"
3265 with_libstatgrab="yes"
3266 with_libstatgrab_pkg_config="yes"
3269 if test "x$with_libstatgrab" = "xyes" \
3270 && test "x$with_libstatgrab_pkg_config" = "xyes"
3272 if test "x$PKG_CONFIG" != "x"
3274 AC_MSG_CHECKING([pkg-config for libstatgrab])
3276 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3279 with_libstatgrab_pkg_config="no"
3280 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
3281 temp_result="not found"
3283 AC_MSG_RESULT([$temp_result])
3285 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3286 with_libstatgrab_pkg_config="no"
3287 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3291 if test "x$with_libstatgrab" = "xyes" \
3292 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3293 && test "x$with_libstatgrab_cflags" = "x"
3295 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3296 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3299 with_libstatgrab_cflags="$temp_result"
3301 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3302 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3304 AC_MSG_RESULT([$temp_result])
3307 if test "x$with_libstatgrab" = "xyes" \
3308 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3309 && test "x$with_libstatgrab_ldflags" = "x"
3311 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3312 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3315 with_libstatgrab_ldflags="$temp_result"
3317 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3318 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3320 AC_MSG_RESULT([$temp_result])
3323 if test "x$with_libstatgrab" = "xyes"
3325 SAVE_CPPFLAGS="$CPPFLAGS"
3326 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3328 AC_CHECK_HEADERS(statgrab.h,
3329 [with_libstatgrab="yes"],
3330 [with_libstatgrab="no (statgrab.h not found)"])
3332 CPPFLAGS="$SAVE_CPPFLAGS"
3335 if test "x$with_libstatgrab" = "xyes"
3337 SAVE_CFLAGS="$CFLAGS"
3338 SAVE_LDFLAGS="$LDFLAGS"
3340 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3341 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3343 AC_CHECK_LIB(statgrab, sg_init,
3344 [with_libstatgrab="yes"],
3345 [with_libstatgrab="no (symbol sg_init not found)"])
3347 CFLAGS="$SAVE_CFLAGS"
3348 LDFLAGS="$SAVE_LDFLAGS"
3351 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3352 if test "x$with_libstatgrab" = "xyes"
3354 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3355 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3356 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3357 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3358 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3362 # --with-libtokyotyrant {{{
3363 with_libtokyotyrant_cppflags=""
3364 with_libtokyotyrant_ldflags=""
3365 with_libtokyotyrant_libs=""
3366 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3368 if test "x$withval" = "xno"
3370 with_libtokyotyrant="no"
3371 else if test "x$withval" = "xyes"
3373 with_libtokyotyrant="yes"
3375 with_libtokyotyrant_cppflags="-I$withval/include"
3376 with_libtokyotyrant_ldflags="-L$withval/include"
3377 with_libtokyotyrant_libs="-ltokyotyrant"
3378 with_libtokyotyrant="yes"
3382 with_libtokyotyrant="yes"
3385 if test "x$with_libtokyotyrant" = "xyes"
3387 if $PKG_CONFIG --exists tokyotyrant
3389 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3390 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3391 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3395 SAVE_CPPFLAGS="$CPPFLAGS"
3396 SAVE_LDFLAGS="$LDFLAGS"
3397 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3398 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3400 if test "x$with_libtokyotyrant" = "xyes"
3402 AC_CHECK_HEADERS(tcrdb.h,
3404 AC_DEFINE(HAVE_TCRDB_H, 1,
3405 [Define to 1 if you have the <tcrdb.h> header file.])
3406 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3409 if test "x$with_libtokyotyrant" = "xyes"
3411 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3413 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3414 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3416 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3417 [$with_libtokyotyrant_libs])
3420 CPPFLAGS="$SAVE_CPPFLAGS"
3421 LDFLAGS="$SAVE_LDFLAGS"
3423 if test "x$with_libtokyotyrant" = "xyes"
3425 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3426 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3427 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3428 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3429 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3430 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3432 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3435 # --with-libupsclient {{{
3436 with_libupsclient_config=""
3437 with_libupsclient_cflags=""
3438 with_libupsclient_libs=""
3439 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
3441 if test "x$withval" = "xno"
3443 with_libupsclient="no"
3444 else if test "x$withval" = "xyes"
3446 with_libupsclient="use_pkgconfig"
3448 if test -x "$withval"
3450 with_libupsclient_config="$withval"
3451 with_libupsclient="use_libupsclient_config"
3452 else if test -x "$withval/bin/libupsclient-config"
3454 with_libupsclient_config="$withval/bin/libupsclient-config"
3455 with_libupsclient="use_libupsclient_config"
3457 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3458 with_libupsclient_cflags="-I$withval/include"
3459 with_libupsclient_libs="-L$withval/lib -lupsclient"
3460 with_libupsclient="yes"
3464 [with_libupsclient="use_pkgconfig"])
3466 # configure using libupsclient-config
3467 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3469 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3470 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3473 with_libupsclient="no ($with_libupsclient_config failed)"
3475 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3478 with_libupsclient="no ($with_libupsclient_config failed)"
3481 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3483 with_libupsclient="yes"
3486 # configure using pkg-config
3487 if test "x$with_libupsclient" = "xuse_pkgconfig"
3489 if test "x$PKG_CONFIG" = "x"
3491 with_libupsclient="no (Don't have pkg-config)"
3494 if test "x$with_libupsclient" = "xuse_pkgconfig"
3496 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3497 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3500 with_libupsclient="no (pkg-config doesn't know library)"
3503 if test "x$with_libupsclient" = "xuse_pkgconfig"
3505 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3508 with_libupsclient="no ($PKG_CONFIG failed)"
3510 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3513 with_libupsclient="no ($PKG_CONFIG failed)"
3516 if test "x$with_libupsclient" = "xuse_pkgconfig"
3518 with_libupsclient="yes"
3521 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3522 # the actual checks.
3523 if test "x$with_libupsclient" = "xyes"
3525 SAVE_CPPFLAGS="$CPPFLAGS"
3526 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3528 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3530 CPPFLAGS="$SAVE_CPPFLAGS"
3532 if test "x$with_libupsclient" = "xyes"
3534 SAVE_CPPFLAGS="$CPPFLAGS"
3535 SAVE_LDFLAGS="$LDFLAGS"
3537 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3538 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3540 AC_CHECK_LIB(upsclient, upscli_connect,
3541 [with_libupsclient="yes"],
3542 [with_libupsclient="no (symbol upscli_connect not found)"])
3544 CPPFLAGS="$SAVE_CPPFLAGS"
3545 LDFLAGS="$SAVE_LDFLAGS"
3547 if test "x$with_libupsclient" = "xyes"
3549 SAVE_CPPFLAGS="$CPPFLAGS"
3550 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3552 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3553 [#include <stdlib.h>
3555 #include <upsclient.h>])
3557 CPPFLAGS="$SAVE_CPPFLAGS"
3559 if test "x$with_libupsclient" = "xyes"
3561 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3562 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3563 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3564 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3568 # --with-libxmms {{{
3569 with_xmms_config="xmms-config"
3572 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3574 if test "x$withval" != "xno" \
3575 && test "x$withval" != "xyes"
3577 if test -f "$withval" && test -x "$withval";
3579 with_xmms_config="$withval"
3580 else if test -x "$withval/bin/xmms-config"
3582 with_xmms_config="$withval/bin/xmms-config"
3585 else if test "x$withval" = "xno"
3595 if test "x$with_libxmms" = "xyes"
3597 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3598 xmms_config_status=$?
3600 if test $xmms_config_status -ne 0
3605 if test "x$with_libxmms" = "xyes"
3607 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3608 xmms_config_status=$?
3610 if test $xmms_config_status -ne 0
3615 if test "x$with_libxmms" = "xyes"
3617 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3619 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3620 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3621 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3622 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3629 with_libxmms_numeric=0
3630 if test "x$with_libxmms" = "xyes"
3632 with_libxmms_numeric=1
3634 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3635 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3638 # --with-libyajl {{{
3639 with_libyajl_cppflags=""
3640 with_libyajl_ldflags=""
3641 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3643 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3645 with_libyajl_cppflags="-I$withval/include"
3646 with_libyajl_ldflags="-L$withval/lib"
3649 with_libyajl="$withval"
3655 if test "x$with_libyajl" = "xyes"
3657 SAVE_CPPFLAGS="$CPPFLAGS"
3658 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3660 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3662 CPPFLAGS="$SAVE_CPPFLAGS"
3664 if test "x$with_libyajl" = "xyes"
3666 SAVE_CPPFLAGS="$CPPFLAGS"
3667 SAVE_LDFLAGS="$LDFLAGS"
3668 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3669 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3671 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3673 CPPFLAGS="$SAVE_CPPFLAGS"
3674 LDFLAGS="$SAVE_LDFLAGS"
3676 if test "x$with_libyajl" = "xyes"
3678 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3679 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3680 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3681 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3682 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3683 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3684 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3686 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3689 # --with-libvarnish {{{
3690 with_libvarnish_cppflags=""
3691 with_libvarnish_cflags=""
3692 with_libvarnish_libs=""
3693 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
3695 if test "x$withval" = "xno"
3697 with_libvarnish="no"
3698 else if test "x$withval" = "xyes"
3700 with_libvarnish="use_pkgconfig"
3701 else if test -d "$with_libvarnish/lib"
3703 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
3704 with_libvarnish_cflags="-I$withval/include"
3705 with_libvarnish_libs="-L$withval/lib -lvarnish -lvarnishcompat -lvarnishapi"
3706 with_libvarnish="yes"
3709 [with_libvarnish="use_pkgconfig"])
3711 # configure using pkg-config
3712 if test "x$with_libvarnish" = "xuse_pkgconfig"
3714 if test "x$PKG_CONFIG" = "x"
3716 with_libvarnish="no (Don't have pkg-config)"
3719 if test "x$with_libvarnish" = "xuse_pkgconfig"
3721 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
3722 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
3725 with_libvarnish="no (pkg-config doesn't know library)"
3728 if test "x$with_libvarnish" = "xuse_pkgconfig"
3730 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
3733 with_libvarnish="no ($PKG_CONFIG failed)"
3735 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
3738 with_libvarnish="no ($PKG_CONFIG failed)"
3741 if test "x$with_libvarnish" = "xuse_pkgconfig"
3743 with_libvarnish="yes"
3746 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
3747 # the actual checks.
3748 if test "x$with_libvarnish" = "xyes"
3750 SAVE_CPPFLAGS="$CPPFLAGS"
3751 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
3752 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
3754 CPPFLAGS="$SAVE_CPPFLAGS"
3756 if test "x$with_libvarnish" = "xyes"
3758 SAVE_CPPFLAGS="$CPPFLAGS"
3759 #SAVE_LDFLAGS="$LDFLAGS"
3761 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
3762 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
3764 AC_CHECK_LIB(varnishapi, VSL_OpenStats,
3765 [with_libvarnish="yes"],
3766 [with_libvarnish="no (symbol VSL_OpenStats not found)"],
3767 [$with_libvarnish_libs])
3769 CPPFLAGS="$SAVE_CPPFLAGS"
3770 #LDFLAGS="$SAVE_LDFLAGS"
3772 if test "x$with_libvarnish" = "xyes"
3774 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
3775 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
3776 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
3777 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
3781 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3782 with_libxml2="no (pkg-config isn't available)"
3783 with_libxml2_cflags=""
3784 with_libxml2_ldflags=""
3785 with_libvirt="no (pkg-config isn't available)"
3786 with_libvirt_cflags=""
3787 with_libvirt_ldflags=""
3788 if test "x$PKG_CONFIG" != "x"
3790 pkg-config --exists 'libxml-2.0' 2>/dev/null
3795 with_libxml2="no (pkg-config doesn't know library)"
3798 pkg-config --exists libvirt 2>/dev/null
3803 with_libvirt="no (pkg-config doesn't know library)"
3806 if test "x$with_libxml2" = "xyes"
3808 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
3813 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
3819 if test "x$with_libxml2" = "xyes"
3821 SAVE_CPPFLAGS="$CPPFLAGS"
3822 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3824 AC_CHECK_HEADERS(libxml/parser.h, [],
3825 [with_libxml2="no (libxml/parser.h not found)"])
3827 CPPFLAGS="$SAVE_CPPFLAGS"
3829 if test "x$with_libxml2" = "xyes"
3831 SAVE_CFLAGS="$CFLAGS"
3832 SAVE_LDFLAGS="$LDFLAGS"
3834 CFLAGS="$CFLAGS $with_libxml2_cflags"
3835 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3837 AC_CHECK_LIB(xml2, xmlXPathEval,
3838 [with_libxml2="yes"],
3839 [with_libxml2="no (symbol xmlXPathEval not found)"])
3841 CFLAGS="$SAVE_CFLAGS"
3842 LDFLAGS="$SAVE_LDFLAGS"
3844 dnl Add the right compiler flags and libraries.
3845 if test "x$with_libxml2" = "xyes"; then
3846 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3847 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3848 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3849 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3851 if test "x$with_libvirt" = "xyes"
3853 with_libvirt_cflags="`pkg-config --cflags libvirt`"
3858 with_libvirt_ldflags="`pkg-config --libs libvirt`"
3864 if test "x$with_libvirt" = "xyes"
3866 SAVE_CPPFLAGS="$CPPFLAGS"
3867 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3869 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3870 [with_libvirt="no (libvirt/libvirt.h not found)"])
3872 CPPFLAGS="$SAVE_CPPFLAGS"
3874 if test "x$with_libvirt" = "xyes"
3876 SAVE_CFLAGS="$CFLAGS"
3877 SAVE_LDFLAGS="$LDFLAGS"
3879 CFLAGS="$CFLAGS $with_libvirt_cflags"
3880 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3882 AC_CHECK_LIB(virt, virDomainBlockStats,
3883 [with_libvirt="yes"],
3884 [with_libvirt="no (symbol virDomainBlockStats not found)"])
3886 CFLAGS="$SAVE_CFLAGS"
3887 LDFLAGS="$SAVE_LDFLAGS"
3889 dnl Add the right compiler flags and libraries.
3890 if test "x$with_libvirt" = "xyes"; then
3891 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3892 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3893 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3894 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3898 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3899 with_libopenipmipthread="yes"
3900 with_libopenipmipthread_cflags=""
3901 with_libopenipmipthread_libs=""
3903 AC_MSG_CHECKING([for pkg-config])
3905 if test "x$PKG_CONFIG" = "x"
3907 with_libopenipmipthread="no"
3910 temp_result="$PKG_CONFIG"
3912 AC_MSG_RESULT([$temp_result])
3914 if test "x$with_libopenipmipthread" = "xyes"
3916 AC_MSG_CHECKING([for libOpenIPMIpthread])
3917 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3920 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3922 AC_MSG_RESULT([$with_libopenipmipthread])
3925 if test "x$with_libopenipmipthread" = "xyes"
3927 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3928 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3931 with_libopenipmipthread_cflags="$temp_result"
3933 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3934 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3936 AC_MSG_RESULT([$temp_result])
3939 if test "x$with_libopenipmipthread" = "xyes"
3941 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3942 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3945 with_libopenipmipthread_ldflags="$temp_result"
3947 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3948 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3950 AC_MSG_RESULT([$temp_result])
3953 if test "x$with_libopenipmipthread" = "xyes"
3955 SAVE_CPPFLAGS="$CPPFLAGS"
3956 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3958 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3959 [with_libopenipmipthread="yes"],
3960 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3961 [#include <OpenIPMI/ipmiif.h>
3962 #include <OpenIPMI/ipmi_err.h>
3963 #include <OpenIPMI/ipmi_posix.h>
3964 #include <OpenIPMI/ipmi_conn.h>
3967 CPPFLAGS="$SAVE_CPPFLAGS"
3970 if test "x$with_libopenipmipthread" = "xyes"
3972 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3973 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3974 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3975 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3979 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3980 [with_libnotify="yes"],
3981 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3983 # Check for enabled/disabled features
3986 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3987 # ------------------------------------------------------------
3989 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3994 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3999 m4_define([EnDis],[disabled])dnl
4000 m4_define([YesNo],[no])dnl
4006 m4_define([EnDis],[enabled])dnl
4007 m4_define([YesNo],[yes])dnl
4010 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4014 m4_if([$3], [feature], [],
4018 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4024 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4026 enable_$1='[YesNo]'dnl
4028 if test "x$enable_$1" = "xno"
4032 if test "x$enable_$1" = "xyes"
4036 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4041 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4042 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4044 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4046 # AC_PLUGIN(name, default, info)
4047 # ------------------------------------------------------------
4054 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4056 if test "x$enableval" = "xyes"
4059 else if test "x$enableval" = "xforce"
4064 enable_plugin="no (disabled on command line)"
4068 if test "x$enable_all_plugins" = "xauto"
4070 if test "x$2" = "xyes"
4077 enable_plugin="$enable_all_plugins"
4080 if test "x$enable_plugin" = "xyes"
4082 if test "x$2" = "xyes" || test "x$force" = "xyes"
4084 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4085 if test "x$2" != "xyes"
4087 dependency_warning="yes"
4089 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4090 dependency_error="yes"
4091 enable_plugin="no (dependency error)"
4094 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4095 enable_$1="$enable_plugin"
4097 )# AC_PLUGIN(name, default, info)
4099 m4_divert_once([HELP_ENABLE], [
4100 collectd features:])
4101 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4102 AC_COLLECTD([debug], [enable], [feature], [debugging])
4103 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4104 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4106 dependency_warning="no"
4107 dependency_error="no"
4112 plugin_conntrack="no"
4113 plugin_contextswitch="no"
4116 plugin_curl_json="no"
4117 plugin_curl_xml="no"
4121 plugin_interface="no"
4128 plugin_multimeter="no"
4132 plugin_processes="no"
4133 plugin_protocols="no"
4137 plugin_tcpconns="no"
4144 plugin_wireless="no"
4148 if test "x$ac_system" = "xLinux"
4150 plugin_battery="yes"
4151 plugin_conntrack="yes"
4152 plugin_contextswitch="yes"
4154 plugin_cpufreq="yes"
4156 plugin_entropy="yes"
4157 plugin_interface="yes"
4162 plugin_fscache="yes"
4163 plugin_processes="yes"
4164 plugin_protocols="yes"
4167 plugin_tcpconns="yes"
4168 plugin_thermal="yes"
4171 plugin_vserver="yes"
4172 plugin_wireless="yes"
4174 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
4180 if test "x$ac_system" = "xOpenBSD"
4182 plugin_tcpconns="yes"
4186 if test "x$with_libiokit" = "xyes"
4188 plugin_battery="yes"
4193 if test "x$with_perfstat" = "xyes"
4199 plugin_interface="yes"
4203 if test "x$with_procinfo" = "xyes"
4205 plugin_processes="yes"
4209 if test "x$with_kstat" = "xyes"
4212 plugin_zfs_arc="yes"
4215 if test "x$with_devinfo$with_kstat" = "xyesyes"
4219 plugin_interface="yes"
4224 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
4230 if test "x$with_libstatgrab" = "xyes"
4234 plugin_interface="yes"
4241 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4247 if test "x$with_libopenipmipthread" = "xyes"
4252 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4254 plugin_curl_json="yes"
4257 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4259 plugin_curl_xml="yes"
4262 if test "x$have_processor_info" = "xyes"
4266 if test "x$have_sysctl" = "xyes"
4273 if test "x$have_sysctlbyname" = "xyes"
4277 plugin_tcpconns="yes"
4280 # Df plugin: Check if we know how to determine mount points first.
4281 #if test "x$have_listmntent" = "xyes"; then
4284 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4288 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4292 #if test "x$have_getmntent" = "xseq"
4296 if test "x$c_cv_have_one_getmntent" = "xyes"
4301 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4302 if test "x$plugin_df" = "xyes"
4305 if test "x$have_statfs" = "xyes"
4309 if test "x$have_statvfs" = "xyes"
4315 if test "x$have_getifaddrs" = "xyes"
4317 plugin_interface="yes"
4320 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4322 plugin_libvirt="yes"
4325 if test "x$have_getloadavg" = "xyes"
4330 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4335 # Mac OS X memory interface
4336 if test "x$have_host_statistics" = "xyes"
4341 if test "x$have_termios_h" = "xyes"
4343 plugin_multimeter="yes"
4347 if test "x$have_thread_info" = "xyes"
4349 plugin_processes="yes"
4352 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4354 plugin_processes="yes"
4357 if test "x$with_kvm_getswapinfo" = "xyes"
4362 if test "x$have_swapctl" = "xyes"
4367 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4369 plugin_tcpconns="yes"
4372 if test "x$have_getutent" = "xyes"
4376 if test "x$have_getutxent" = "xyes"
4381 m4_divert_once([HELP_ENABLE], [
4384 AC_ARG_ENABLE([all-plugins],
4385 AC_HELP_STRING([--enable-all-plugins],
4386 [enable all plugins (auto by def)]),
4388 if test "x$enableval" = "xyes"
4390 enable_all_plugins="yes"
4391 else if test "x$enableval" = "xauto"
4393 enable_all_plugins="auto"
4395 enable_all_plugins="no"
4398 [enable_all_plugins="auto"])
4400 m4_divert_once([HELP_ENABLE], [])
4402 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4403 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4404 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4405 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4406 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4407 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4408 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4409 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4410 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4411 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4412 AC_PLUGIN([csv], [yes], [CSV output plugin])
4413 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4414 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4415 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4416 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4417 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4418 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4419 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4420 AC_PLUGIN([email], [yes], [EMail statistics])
4421 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4422 AC_PLUGIN([exec], [yes], [Execution of external programs])
4423 AC_PLUGIN([filecount], [yes], [Count files in directories])
4424 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4425 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4426 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4427 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4428 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4429 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4430 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4431 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4432 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4433 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4434 AC_PLUGIN([load], [$plugin_load], [System load])
4435 AC_PLUGIN([logfile], [yes], [File logging plugin])
4436 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4437 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4438 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4439 AC_PLUGIN([match_regex], [yes], [The regex match])
4440 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4441 AC_PLUGIN([match_value], [yes], [The value match])
4442 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4443 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4444 AC_PLUGIN([memcached], [yes], [memcached statistics])
4445 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4446 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4447 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4448 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4449 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4450 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4451 AC_PLUGIN([network], [yes], [Network communication plugin])
4452 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4453 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4454 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4455 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4456 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4457 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4458 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4459 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4460 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4461 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4462 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4463 # FIXME: Check for libevent, too.
4464 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4465 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4466 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4467 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4468 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4469 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4470 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4471 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4472 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4473 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4474 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4475 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4476 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4477 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4478 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4479 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4480 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4481 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4482 AC_PLUGIN([target_notification], [yes], [The notification target])
4483 AC_PLUGIN([target_replace], [yes], [The replace target])
4484 AC_PLUGIN([target_scale],[yes], [The scale target])
4485 AC_PLUGIN([target_set], [yes], [The set target])
4486 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
4487 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4488 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4489 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4490 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4491 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4492 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4493 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4494 AC_PLUGIN([users], [$plugin_users], [User statistics])
4495 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4496 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
4497 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4498 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4499 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4500 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4501 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4502 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4504 dnl Default configuration file
4505 # Load either syslog or logfile
4506 LOAD_PLUGIN_SYSLOG=""
4507 LOAD_PLUGIN_LOGFILE=""
4509 AC_MSG_CHECKING([which default log plugin to load])
4510 default_log_plugin="none"
4511 if test "x$enable_syslog" = "xyes"
4513 default_log_plugin="syslog"
4515 LOAD_PLUGIN_SYSLOG="##"
4518 if test "x$enable_logfile" = "xyes"
4520 if test "x$default_log_plugin" = "xnone"
4522 default_log_plugin="logfile"
4524 LOAD_PLUGIN_LOGFILE="#"
4527 LOAD_PLUGIN_LOGFILE="##"
4529 AC_MSG_RESULT([$default_log_plugin])
4531 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4532 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4534 DEFAULT_LOG_LEVEL="info"
4535 if test "x$enable_debug" = "xyes"
4537 DEFAULT_LOG_LEVEL="debug"
4539 AC_SUBST(DEFAULT_LOG_LEVEL)
4541 # Load only one of rrdtool, network, csv in the default config.
4542 LOAD_PLUGIN_RRDTOOL=""
4543 LOAD_PLUGIN_NETWORK=""
4546 AC_MSG_CHECKING([which default write plugin to load])
4547 default_write_plugin="none"
4548 if test "x$enable_rrdtool" = "xyes"
4550 default_write_plugin="rrdtool"
4552 LOAD_PLUGIN_RRDTOOL="##"
4555 if test "x$enable_network" = "xyes"
4557 if test "x$default_write_plugin" = "xnone"
4559 default_write_plugin="network"
4561 LOAD_PLUGIN_NETWORK="#"
4564 LOAD_PLUGIN_NETWORK="##"
4567 if test "x$enable_csv" = "xyes"
4569 if test "x$default_write_plugin" = "xnone"
4571 default_write_plugin="csv"
4576 LOAD_PLUGIN_CSV="##"
4578 AC_MSG_RESULT([$default_write_plugin])
4580 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4581 AC_SUBST(LOAD_PLUGIN_NETWORK)
4582 AC_SUBST(LOAD_PLUGIN_CSV)
4585 if test "x$ac_system" = "xLinux" \
4586 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
4588 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4592 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4594 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4596 PERL_BINDINGS_OPTIONS="$withval"
4597 with_perl_bindings="yes"
4599 PERL_BINDINGS_OPTIONS=""
4600 with_perl_bindings="$withval"
4604 PERL_BINDINGS_OPTIONS=""
4605 if test -n "$perl_interpreter"
4607 with_perl_bindings="yes"
4609 with_perl_bindings="no (no perl interpreter found)"
4612 if test "x$with_perl_bindings" = "xyes"
4614 PERL_BINDINGS="perl"
4618 AC_SUBST(PERL_BINDINGS)
4619 AC_SUBST(PERL_BINDINGS_OPTIONS)
4621 dnl libcollectdclient
4622 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4623 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4624 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4626 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4628 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4630 AC_SUBST(LCC_VERSION_MAJOR)
4631 AC_SUBST(LCC_VERSION_MINOR)
4632 AC_SUBST(LCC_VERSION_PATCH)
4633 AC_SUBST(LCC_VERSION_EXTRA)
4634 AC_SUBST(LCC_VERSION_STRING)
4636 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4638 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)
4640 if test "x$with_librrd" = "xyes" \
4641 && test "x$librrd_threadsafe" != "xyes"
4643 with_librrd="yes (warning: librrd is not thread-safe)"
4646 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
4648 with_libiptc="yes (shipped version)"
4651 if test "x$with_libperl" = "xyes"
4653 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4655 enable_perl="no (needs libperl)"
4658 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4660 enable_perl="no (libperl doesn't support ithreads)"
4663 if test "x$with_perl_bindings" = "xyes" \
4664 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4666 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4673 libcurl . . . . . . . $with_libcurl
4674 libdbi . . . . . . . $with_libdbi
4675 libesmtp . . . . . . $with_libesmtp
4676 libganglia . . . . . $with_libganglia
4677 libgcrypt . . . . . . $with_libgcrypt
4678 libiokit . . . . . . $with_libiokit
4679 libiptc . . . . . . . $with_libiptc
4680 libjvm . . . . . . . $with_java
4681 libkstat . . . . . . $with_kstat
4682 libkvm . . . . . . . $with_libkvm
4683 libmemcached . . . . $with_libmemcached
4684 libmodbus . . . . . . $with_libmodbus
4685 libmysql . . . . . . $with_libmysql
4686 libnetapp . . . . . . $with_libnetapp
4687 libnetlink . . . . . $with_libnetlink
4688 libnetsnmp . . . . . $with_libnetsnmp
4689 libnotify . . . . . . $with_libnotify
4690 liboconfig . . . . . $with_liboconfig
4691 libopenipmi . . . . . $with_libopenipmipthread
4692 liboping . . . . . . $with_liboping
4693 libpcap . . . . . . . $with_libpcap
4694 libperfstat . . . . . $with_perfstat
4695 libperl . . . . . . . $with_libperl
4696 libpq . . . . . . . . $with_libpq
4697 libpthread . . . . . $with_libpthread
4698 librouteros . . . . . $with_librouteros
4699 librrd . . . . . . . $with_librrd
4700 libsensors . . . . . $with_libsensors
4701 libstatgrab . . . . . $with_libstatgrab
4702 libtokyotyrant . . . $with_libtokyotyrant
4703 libupsclient . . . . $with_libupsclient
4704 libvarnish . . . . . $with_libvarnish
4705 libvirt . . . . . . . $with_libvirt
4706 libxml2 . . . . . . . $with_libxml2
4707 libxmms . . . . . . . $with_libxmms
4708 libyajl . . . . . . . $with_libyajl
4709 libevent . . . . . . $with_libevent
4710 protobuf-c . . . . . $have_protoc_c
4711 oracle . . . . . . . $with_oracle
4712 python . . . . . . . $with_python
4715 daemon mode . . . . . $enable_daemon
4716 debug . . . . . . . . $enable_debug
4719 perl . . . . . . . . $with_perl_bindings
4722 apache . . . . . . . $enable_apache
4723 apcups . . . . . . . $enable_apcups
4724 apple_sensors . . . . $enable_apple_sensors
4725 ascent . . . . . . . $enable_ascent
4726 battery . . . . . . . $enable_battery
4727 bind . . . . . . . . $enable_bind
4728 conntrack . . . . . . $enable_conntrack
4729 contextswitch . . . . $enable_contextswitch
4730 cpu . . . . . . . . . $enable_cpu
4731 cpufreq . . . . . . . $enable_cpufreq
4732 csv . . . . . . . . . $enable_csv
4733 curl . . . . . . . . $enable_curl
4734 curl_json . . . . . . $enable_curl_json
4735 curl_xml . . . . . . $enable_curl_xml
4736 dbi . . . . . . . . . $enable_dbi
4737 df . . . . . . . . . $enable_df
4738 disk . . . . . . . . $enable_disk
4739 dns . . . . . . . . . $enable_dns
4740 email . . . . . . . . $enable_email
4741 entropy . . . . . . . $enable_entropy
4742 exec . . . . . . . . $enable_exec
4743 filecount . . . . . . $enable_filecount
4744 fscache . . . . . . . $enable_fscache
4745 gmond . . . . . . . . $enable_gmond
4746 hddtemp . . . . . . . $enable_hddtemp
4747 interface . . . . . . $enable_interface
4748 ipmi . . . . . . . . $enable_ipmi
4749 iptables . . . . . . $enable_iptables
4750 ipvs . . . . . . . . $enable_ipvs
4751 irq . . . . . . . . . $enable_irq
4752 java . . . . . . . . $enable_java
4753 libvirt . . . . . . . $enable_libvirt
4754 load . . . . . . . . $enable_load
4755 logfile . . . . . . . $enable_logfile
4756 madwifi . . . . . . . $enable_madwifi
4757 match_empty_counter . $enable_match_empty_counter
4758 match_hashed . . . . $enable_match_hashed
4759 match_regex . . . . . $enable_match_regex
4760 match_timediff . . . $enable_match_timediff
4761 match_value . . . . . $enable_match_value
4762 mbmon . . . . . . . . $enable_mbmon
4763 memcachec . . . . . . $enable_memcachec
4764 memcached . . . . . . $enable_memcached
4765 memory . . . . . . . $enable_memory
4766 modbus . . . . . . . $enable_modbus
4767 multimeter . . . . . $enable_multimeter
4768 mysql . . . . . . . . $enable_mysql
4769 netapp . . . . . . . $enable_netapp
4770 netlink . . . . . . . $enable_netlink
4771 network . . . . . . . $enable_network
4772 nfs . . . . . . . . . $enable_nfs
4773 nginx . . . . . . . . $enable_nginx
4774 notify_desktop . . . $enable_notify_desktop
4775 notify_email . . . . $enable_notify_email
4776 ntpd . . . . . . . . $enable_ntpd
4777 nut . . . . . . . . . $enable_nut
4778 olsrd . . . . . . . . $enable_olsrd
4779 onewire . . . . . . . $enable_onewire
4780 openvpn . . . . . . . $enable_openvpn
4781 oracle . . . . . . . $enable_oracle
4782 perl . . . . . . . . $enable_perl
4783 pinba . . . . . . . . $enable_pinba
4784 ping . . . . . . . . $enable_ping
4785 postgresql . . . . . $enable_postgresql
4786 powerdns . . . . . . $enable_powerdns
4787 processes . . . . . . $enable_processes
4788 protocols . . . . . . $enable_protocols
4789 python . . . . . . . $enable_python
4790 routeros . . . . . . $enable_routeros
4791 rrdcached . . . . . . $enable_rrdcached
4792 rrdtool . . . . . . . $enable_rrdtool
4793 sensors . . . . . . . $enable_sensors
4794 serial . . . . . . . $enable_serial
4795 snmp . . . . . . . . $enable_snmp
4796 swap . . . . . . . . $enable_swap
4797 syslog . . . . . . . $enable_syslog
4798 table . . . . . . . . $enable_table
4799 tail . . . . . . . . $enable_tail
4800 tape . . . . . . . . $enable_tape
4801 target_notification . $enable_target_notification
4802 target_replace . . . $enable_target_replace
4803 target_scale . . . . $enable_target_scale
4804 target_set . . . . . $enable_target_set
4805 target_v5upgrade . . $enable_target_v5upgrade
4806 tcpconns . . . . . . $enable_tcpconns
4807 teamspeak2 . . . . . $enable_teamspeak2
4808 ted . . . . . . . . . $enable_ted
4809 thermal . . . . . . . $enable_thermal
4810 tokyotyrant . . . . . $enable_tokyotyrant
4811 unixsock . . . . . . $enable_unixsock
4812 uptime . . . . . . . $enable_uptime
4813 users . . . . . . . . $enable_users
4814 uuid . . . . . . . . $enable_uuid
4815 varnish . . . . . . . $enable_varnish
4816 vmem . . . . . . . . $enable_vmem
4817 vserver . . . . . . . $enable_vserver
4818 wireless . . . . . . $enable_wireless
4819 write_http . . . . . $enable_write_http
4820 xmms . . . . . . . . $enable_xmms
4821 zfs_arc . . . . . . . $enable_zfs_arc
4825 if test "x$dependency_error" = "xyes"; then
4826 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4829 if test "x$dependency_warning" = "xyes"; then
4830 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4833 # vim: set fdm=marker :