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 AC_CACHE_CHECK([for strtok_r],
488 [c_cv_have_strtok_r_default],
497 char buffer[] = "foo,bar,baz";
504 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
507 printf ("token = %s;\n", token);
510 [c_cv_have_strtok_r_default="yes"],
511 [c_cv_have_strtok_r_default="no"]
515 if test "x$c_cv_have_strtok_r_default" = "xno"
517 SAVE_CFLAGS="$CFLAGS"
518 CFLAGS="$CFLAGS -D_REENTRANT=1"
520 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
521 [c_cv_have_strtok_r_reentrant],
530 char buffer[] = "foo,bar,baz";
537 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
540 printf ("token = %s;\n", token);
543 [c_cv_have_strtok_r_reentrant="yes"],
544 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
549 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
551 socket_needs_socket="no"
552 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
553 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
555 nanosleep_needs_rt="no"
556 nanosleep_needs_posix4="no"
557 AC_CHECK_FUNCS(nanosleep,
559 AC_CHECK_LIB(rt, nanosleep,
560 [nanosleep_needs_rt="yes"],
561 AC_CHECK_LIB(posix4, nanosleep,
562 [nanosleep_needs_posix4="yes"],
563 AC_MSG_ERROR(cannot find nanosleep))))
564 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
565 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$nanosleep_needs_posix4" = "xyes")
567 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
568 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
569 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
570 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
571 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
572 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
573 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
574 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
575 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
576 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
577 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
578 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
581 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
584 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
586 if test "x$withval" = "xno"; then
588 else if test "x$withval" = "xyes"; then
595 if test "x$nan_type" = "xnone"; then
596 AC_CACHE_CHECK([whether NAN is defined by default],
597 [c_cv_have_nan_default],
603 static float foo = NAN;
611 [c_cv_have_nan_default="yes"],
612 [c_cv_have_nan_default="no"]
615 if test "x$c_cv_have_nan_default" = "xyes"
620 if test "x$nan_type" = "xnone"; then
621 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
622 [c_cv_have_nan_isoc],
627 #define __USE_ISOC99 1
629 static float foo = NAN;
637 [c_cv_have_nan_isoc="yes"],
638 [c_cv_have_nan_isoc="no"]
641 if test "x$c_cv_have_nan_isoc" = "xyes"
646 if test "x$nan_type" = "xnone"; then
647 SAVE_LDFLAGS=$LDFLAGS
648 LDFLAGS="$LDFLAGS -lm"
649 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
650 [c_cv_have_nan_zero],
659 #define NAN (0.0 / 0.0)
661 # define isnan(f) ((f) != (f))
663 static float foo = NAN;
671 [c_cv_have_nan_zero="yes"],
672 [c_cv_have_nan_zero="no"]
675 LDFLAGS=$SAVE_LDFLAGS
676 if test "x$c_cv_have_nan_zero" = "xyes"
682 if test "x$nan_type" = "xdefault"; then
683 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
684 [Define if NAN is defined by default and can initialize static variables.])
685 else if test "x$nan_type" = "xisoc99"; then
686 AC_DEFINE(NAN_STATIC_ISOC, 1,
687 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
688 else if test "x$nan_type" = "xzero"; then
689 AC_DEFINE(NAN_ZERO_ZERO, 1,
690 [Define if NAN can be defined as (0.0 / 0.0)])
692 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
695 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
697 if test "x$withval" = "xnothing"; then
698 fp_layout_type="nothing"
699 else if test "x$withval" = "xendianflip"; then
700 fp_layout_type="endianflip"
701 else if test "x$withval" = "xintswap"; then
702 fp_layout_type="intswap"
704 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
707 [fp_layout_type="unknown"])
709 if test "x$fp_layout_type" = "xunknown"; then
710 AC_CACHE_CHECK([if doubles are stored in x86 representation],
711 [c_cv_fp_layout_need_nothing],
722 # include <inttypes.h>
725 # include <stdbool.h>
735 memcpy ((void *) &i0, (void *) &d, 8);
738 memcpy ((void *) c, (void *) &i1, 8);
740 if ((c[0] == 0x2f) && (c[1] == 0x25)
741 && (c[2] == 0xc0) && (c[3] == 0xc7)
742 && (c[4] == 0x43) && (c[5] == 0x2b)
743 && (c[6] == 0x1f) && (c[7] == 0x5b))
748 [c_cv_fp_layout_need_nothing="yes"],
749 [c_cv_fp_layout_need_nothing="no"]
752 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
753 fp_layout_type="nothing"
756 if test "x$fp_layout_type" = "xunknown"; then
757 AC_CACHE_CHECK([if endianflip converts to x86 representation],
758 [c_cv_fp_layout_need_endianflip],
769 # include <inttypes.h>
772 # include <stdbool.h>
774 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
775 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
776 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
777 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
778 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
779 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
780 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
781 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
790 memcpy ((void *) &i0, (void *) &d, 8);
792 i1 = endianflip (i0);
793 memcpy ((void *) c, (void *) &i1, 8);
795 if ((c[0] == 0x2f) && (c[1] == 0x25)
796 && (c[2] == 0xc0) && (c[3] == 0xc7)
797 && (c[4] == 0x43) && (c[5] == 0x2b)
798 && (c[6] == 0x1f) && (c[7] == 0x5b))
803 [c_cv_fp_layout_need_endianflip="yes"],
804 [c_cv_fp_layout_need_endianflip="no"]
807 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
808 fp_layout_type="endianflip"
811 if test "x$fp_layout_type" = "xunknown"; then
812 AC_CACHE_CHECK([if intswap converts to x86 representation],
813 [c_cv_fp_layout_need_intswap],
824 # include <inttypes.h>
827 # include <stdbool.h>
829 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
830 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
839 memcpy ((void *) &i0, (void *) &d, 8);
842 memcpy ((void *) c, (void *) &i1, 8);
844 if ((c[0] == 0x2f) && (c[1] == 0x25)
845 && (c[2] == 0xc0) && (c[3] == 0xc7)
846 && (c[4] == 0x43) && (c[5] == 0x2b)
847 && (c[6] == 0x1f) && (c[7] == 0x5b))
852 [c_cv_fp_layout_need_intswap="yes"],
853 [c_cv_fp_layout_need_intswap="no"]
856 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
857 fp_layout_type="intswap"
861 if test "x$fp_layout_type" = "xnothing"; then
862 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
863 [Define if doubles are stored in x86 representation.])
864 else if test "x$fp_layout_type" = "xendianflip"; then
865 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
866 [Define if endianflip is needed to convert to x86 representation.])
867 else if test "x$fp_layout_type" = "xintswap"; then
868 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
869 [Define if intswap is needed to convert to x86 representation.])
871 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
875 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
877 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
879 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
882 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
883 if test "x$have_getmntent" = "xno"; then
884 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
886 if test "x$have_getmntent" = "xno"; then
887 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
889 if test "x$have_getmntent" = "xno"; then
890 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
893 if test "x$have_getmntent" = "xc"; then
894 AC_CACHE_CHECK([whether getmntent takes one argument],
895 [c_cv_have_one_getmntent],
897 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
898 #include "$srcdir/src/utils_mount.h"]],
902 fh = setmntent ("/etc/mtab", "r");
906 [c_cv_have_one_getmntent="yes"],
907 [c_cv_have_one_getmntent="no"]
910 AC_CACHE_CHECK([whether getmntent takes two arguments],
911 [c_cv_have_two_getmntent],
913 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
914 #include "$srcdir/src/utils_mount.h"]],
919 fh = fopen ("/etc/mnttab", "r");
920 status = getmntent (fh, &mt);
923 [c_cv_have_two_getmntent="yes"],
924 [c_cv_have_two_getmntent="no"]
929 # Check for different versions of `getmntent' here..
931 if test "x$have_getmntent" = "xc"; then
932 if test "x$c_cv_have_one_getmntent" = "xyes"; then
933 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
934 [Define if the function getmntent exists and takes one argument.])
936 if test "x$c_cv_have_two_getmntent" = "xyes"; then
937 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
938 [Define if the function getmntent exists and takes two arguments.])
941 if test "x$have_getmntent" = "xsun"; then
942 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
943 [Define if the function getmntent exists. It's the version from libsun.])
945 if test "x$have_getmntent" = "xseq"; then
946 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
947 [Define if the function getmntent exists. It's the version from libseq.])
949 if test "x$have_getmntent" = "xgen"; then
950 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
951 [Define if the function getmntent exists. It's the version from libgen.])
955 AC_MSG_CHECKING([if have htonll defined])
960 #include <sys/types.h>
961 #include <netinet/in.h>
963 # include <inttypes.h>
970 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
973 AC_MSG_RESULT([$have_htonll])
975 # Check for structures
976 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
977 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
980 #include <sys/types.h>
981 #include <sys/socket.h>
984 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
985 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
988 #include <sys/types.h>
989 #include <sys/socket.h>
990 #include <linux/if.h>
991 #include <linux/netdevice.h>
994 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
997 #include <netinet/in.h>
1001 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1003 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1004 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1005 have_struct_kinfo_proc_freebsd="yes"
1008 have_struct_kinfo_proc_freebsd="no"
1012 #include <sys/param.h>
1013 #include <sys/sysctl.h>
1014 #include <sys/user.h>
1017 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1019 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1020 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1021 have_struct_kinfo_proc_openbsd="yes"
1024 have_struct_kinfo_proc_openbsd="no"
1027 #include <sys/param.h>
1028 #include <sys/sysctl.h>
1032 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1033 [#define _BSD_SOURCE
1035 # include <stdint.h>
1037 #if HAVE_SYS_TYPES_H
1038 # include <sys/types.h>
1040 #if HAVE_NETINET_IN_SYSTM_H
1041 # include <netinet/in_systm.h>
1043 #if HAVE_NETINET_IN_H
1044 # include <netinet/in.h>
1046 #if HAVE_NETINET_IP_H
1047 # include <netinet/ip.h>
1049 #if HAVE_NETINET_UDP_H
1050 # include <netinet/udp.h>
1053 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1054 [#define _BSD_SOURCE
1056 # include <stdint.h>
1058 #if HAVE_SYS_TYPES_H
1059 # include <sys/types.h>
1061 #if HAVE_NETINET_IN_SYSTM_H
1062 # include <netinet/in_systm.h>
1064 #if HAVE_NETINET_IN_H
1065 # include <netinet/in.h>
1067 #if HAVE_NETINET_IP_H
1068 # include <netinet/ip.h>
1070 #if HAVE_NETINET_UDP_H
1071 # include <netinet/udp.h>
1075 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1085 # Checks for libraries begin here
1087 with_libresolv="yes"
1088 AC_CHECK_LIB(resolv, res_search,
1090 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1092 [with_libresolv="no"])
1093 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1095 dnl Check for HAL (hardware abstraction library)
1097 AC_CHECK_LIB(hal,libhal_device_property_exists,
1098 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1100 if test "x$with_libhal" = "xyes"; then
1101 if test "x$PKG_CONFIG" != "x"; then
1102 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1103 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1104 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1105 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1109 m4_divert_once([HELP_WITH], [
1110 collectd additional packages:])
1112 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1114 if test "x$ac_system" = "xAIX"
1119 with_perfstat="no (AIX only)"
1120 with_procinfo="no (AIX only)"
1123 if test "x$with_perfstat" = "xyes"
1125 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1126 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1128 if test "x$with_perfstat" = "xyes"
1130 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1132 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1134 # Processes plugin under AIX.
1135 if test "x$with_procinfo" = "xyes"
1137 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1139 if test "x$with_procinfo" = "xyes"
1141 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1144 if test "x$ac_system" = "xSolaris"
1149 with_kstat="no (Solaris only)"
1150 with_devinfo="no (Solaris only)"
1153 if test "x$with_kstat" = "xyes"
1155 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1157 if test "x$with_kstat" = "xyes"
1159 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1160 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1162 if test "x$with_kstat" = "xyes"
1164 AC_DEFINE(HAVE_LIBKSTAT, 1,
1165 [Define to 1 if you have the 'kstat' library (-lkstat)])
1167 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1168 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1171 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1178 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1181 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1182 if test "x$with_kvm_getprocs" = "xyes"
1184 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1185 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1188 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1190 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1191 if test "x$with_kvm_getswapinfo" = "xyes"
1193 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1194 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1197 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1199 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1200 if test "x$with_kvm_nlist" = "xyes"
1202 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1203 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1206 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1208 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1209 if test "x$with_kvm_openfiles" = "xyes"
1211 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1212 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1215 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1217 # --with-libcurl {{{
1218 with_curl_config="curl-config"
1221 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1223 if test "x$withval" = "xno"
1226 else if test "x$withval" = "xyes"
1230 if test -f "$withval" && test -x "$withval"
1232 with_curl_config="$withval"
1234 else if test -x "$withval/bin/curl-config"
1236 with_curl_config="$withval/bin/curl-config"
1245 if test "x$with_libcurl" = "xyes"
1247 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1248 curl_config_status=$?
1250 if test $curl_config_status -ne 0
1252 with_libcurl="no ($with_curl_config failed)"
1254 SAVE_CPPFLAGS="$CPPFLAGS"
1255 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1257 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1259 CPPFLAGS="$SAVE_CPPFLAGS"
1262 if test "x$with_libcurl" = "xyes"
1264 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1265 curl_config_status=$?
1267 if test $curl_config_status -ne 0
1269 with_libcurl="no ($with_curl_config failed)"
1271 AC_CHECK_LIB(curl, curl_easy_init,
1272 [with_libcurl="yes"],
1273 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1277 if test "x$with_libcurl" = "xyes"
1279 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1280 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1281 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1282 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1284 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1288 with_libdbi_cppflags=""
1289 with_libdbi_ldflags=""
1290 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1292 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1294 with_libdbi_cppflags="-I$withval/include"
1295 with_libdbi_ldflags="-L$withval/lib"
1298 with_libdbi="$withval"
1304 if test "x$with_libdbi" = "xyes"
1306 SAVE_CPPFLAGS="$CPPFLAGS"
1307 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1309 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1311 CPPFLAGS="$SAVE_CPPFLAGS"
1313 if test "x$with_libdbi" = "xyes"
1315 SAVE_CPPFLAGS="$CPPFLAGS"
1316 SAVE_LDFLAGS="$LDFLAGS"
1317 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1318 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1320 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1322 CPPFLAGS="$SAVE_CPPFLAGS"
1323 LDFLAGS="$SAVE_LDFLAGS"
1325 if test "x$with_libdbi" = "xyes"
1327 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1328 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1329 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1330 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1331 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1332 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1334 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1337 # --with-libesmtp {{{
1338 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1340 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1342 LDFLAGS="$LDFLAGS -L$withval/lib"
1343 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1346 with_libesmtp="$withval"
1352 if test "x$with_libesmtp" = "xyes"
1354 AC_CHECK_LIB(esmtp, smtp_create_session,
1356 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1357 ], [with_libesmtp="no (libesmtp not found)"])
1359 if test "x$with_libesmtp" = "xyes"
1361 AC_CHECK_HEADERS(libesmtp.h,
1363 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1364 ], [with_libesmtp="no (libesmtp.h not found)"])
1366 if test "x$with_libesmtp" = "xyes"
1372 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1373 [Wether or not to use the esmtp library])
1374 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1377 # --with-libganglia {{{
1378 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1380 if test -f "$withval" && test -x "$withval"
1382 with_libganglia_config="$withval"
1383 with_libganglia="yes"
1384 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1386 with_libganglia_config="$withval/bin/ganglia-config"
1387 with_libganglia="yes"
1388 else if test -d "$withval"
1390 GANGLIA_CPPFLAGS="-I$withval/include"
1391 GANGLIA_LDFLAGS="-L$withval/lib"
1392 with_libganglia="yes"
1394 with_libganglia_config="ganglia-config"
1395 with_libganglia="$withval"
1399 with_libganglia_config="ganglia-config"
1400 with_libganglia="yes"
1403 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1405 if test "x$GANGLIA_CPPFLAGS" = "x"
1407 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1410 if test "x$GANGLIA_LDFLAGS" = "x"
1412 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1415 if test "x$GANGLIA_LIBS" = "x"
1417 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1421 SAVE_CPPFLAGS="$CPPFLAGS"
1422 SAVE_LDFLAGS="$LDFLAGS"
1423 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1424 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1426 if test "x$with_libganglia" = "xyes"
1428 AC_CHECK_HEADERS(gm_protocol.h,
1430 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1431 [Define to 1 if you have the <gm_protocol.h> header file.])
1432 ], [with_libganglia="no (gm_protocol.h not found)"])
1435 if test "x$with_libganglia" = "xyes"
1437 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1439 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1440 [Define to 1 if you have the ganglia library (-lganglia).])
1441 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1444 CPPFLAGS="$SAVE_CPPFLAGS"
1445 LDFLAGS="$SAVE_LDFLAGS"
1447 AC_SUBST(GANGLIA_CPPFLAGS)
1448 AC_SUBST(GANGLIA_LDFLAGS)
1449 AC_SUBST(GANGLIA_LIBS)
1450 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1453 # --with-libgcrypt {{{
1454 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1455 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1456 GCRYPT_LIBS="$GCRYPT_LIBS"
1457 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1459 if test -f "$withval" && test -x "$withval"
1461 with_libgcrypt_config="$withval"
1462 with_libgcrypt="yes"
1463 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1465 with_libgcrypt_config="$withval/bin/gcrypt-config"
1466 with_libgcrypt="yes"
1467 else if test -d "$withval"
1469 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1470 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1471 with_libgcrypt="yes"
1473 with_libgcrypt_config="gcrypt-config"
1474 with_libgcrypt="$withval"
1478 with_libgcrypt_config="libgcrypt-config"
1479 with_libgcrypt="yes"
1482 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1484 if test "x$GCRYPT_CPPFLAGS" = "x"
1486 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1489 if test "x$GCRYPT_LDFLAGS" = "x"
1491 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1492 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1495 if test "x$GCRYPT_LIBS" = "x"
1497 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1501 SAVE_CPPFLAGS="$CPPFLAGS"
1502 SAVE_LDFLAGS="$LDFLAGS"
1503 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1504 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1506 if test "x$with_libgcrypt" = "xyes"
1508 if test "x$GCRYPT_CPPFLAGS" != "x"
1510 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1512 AC_CHECK_HEADERS(gcrypt.h,
1513 [with_libgcrypt="yes"],
1514 [with_libgcrypt="no (gcrypt.h not found)"])
1517 if test "x$with_libgcrypt" = "xyes"
1519 if test "x$GCRYPT_LDFLAGS" != "x"
1521 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1523 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1524 [with_libgcrypt="yes"],
1525 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1527 if test "$with_libgcrypt" != "no"; then
1528 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1532 CPPFLAGS="$SAVE_CPPFLAGS"
1533 LDFLAGS="$SAVE_LDFLAGS"
1535 if test "x$with_libgcrypt" = "xyes"
1537 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1540 AC_SUBST(GCRYPT_CPPFLAGS)
1541 AC_SUBST(GCRYPT_LDFLAGS)
1542 AC_SUBST(GCRYPT_LIBS)
1543 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1546 # --with-libiptc {{{
1547 with_own_libiptc="no"
1548 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1550 if test "x$withval" = "xshipped"
1552 with_own_libiptc="yes"
1554 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1556 LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS -I$withval/include"
1557 LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS -L$withval/lib"
1560 with_libiptc="$withval"
1564 if test "x$ac_system" = "xLinux"
1568 with_libiptc="no (Linux only)"
1571 SAVE_CPPFLAGS="$CPPFLAGS"
1572 SAVE_LDFLAGS="$LDFLAGS"
1573 CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
1574 LDFLAGS="$LDFLAGS $LIBIPTC_LDFLAGS"
1575 # check whether the header file for libiptc is available.
1576 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1578 AC_CHECK_HEADERS(libiptc/libiptc.h,
1580 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1584 with_own_libiptc="yes"
1587 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1589 AC_CHECK_HEADERS(libiptc/libip6tc.h,
1591 AC_DEFINE(HAVE_LIBIPTC_LIBIP6TC_H, 1, [Define to 1 if you have the <libiptc/libip6tc.h> header file.])
1595 with_own_libiptc="yes"
1598 # If the header file is available, check for the required type declaractions.
1599 # They may be missing in old versions of libiptc. In that case, they will be
1600 # declared in the iptables plugin.
1601 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1603 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [],
1606 # include "$srcdir/src/owniptc/libiptc.h"
1607 # include "$srcdir/src/owniptc/libip6tc.h"
1609 # include <libiptc/libiptc.h>
1610 # include <libiptc/libip6tc.h>
1614 # Check for the iptc_init symbol in the library.
1615 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1617 AC_CHECK_LIB(iptc, iptc_init,
1619 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1623 with_own_libiptc="yes"
1626 # The system wide version failed for some reason. Check if we have the required
1627 # headers to build the shipped version.
1628 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xyes"
1630 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1632 with_libiptc="no (Linux iptables headers not found)"
1633 with_own_libiptc="no"
1636 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1639 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1640 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1641 if test "x$with_libiptc" = "xyes"
1643 BUILD_WITH_LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS"
1644 BUILD_WITH_LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS"
1645 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1646 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1648 if test "x$with_own_libiptc" = "xyes"
1650 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1652 CPPFLAGS="$SAVE_CPPFLAGS"
1653 LDFLAGS="$SAVE_LDFLAGS"
1657 with_java_home="$JAVA_HOME"
1658 with_java_vmtype="client"
1663 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1665 if test "x$withval" = "xno"
1668 else if test "x$withval" = "xyes"
1672 with_java_home="$withval"
1677 if test "x$with_java" = "xyes"
1679 if test -d "$with_java_home"
1681 AC_MSG_CHECKING([for jni.h])
1682 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1683 if test "x$TMPDIR" != "x"
1685 AC_MSG_RESULT([found in $TMPDIR])
1686 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1688 AC_MSG_RESULT([not found])
1691 AC_MSG_CHECKING([for jni_md.h])
1692 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1693 if test "x$TMPDIR" != "x"
1695 AC_MSG_RESULT([found in $TMPDIR])
1696 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1698 AC_MSG_RESULT([not found])
1701 AC_MSG_CHECKING([for libjvm.so])
1702 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1703 if test "x$TMPDIR" != "x"
1705 AC_MSG_RESULT([found in $TMPDIR])
1706 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1708 AC_MSG_RESULT([not found])
1711 if test "x$JAVAC" = "x"
1713 AC_MSG_CHECKING([for javac])
1714 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1715 if test "x$TMPDIR" != "x"
1718 AC_MSG_RESULT([$JAVAC])
1720 AC_MSG_RESULT([not found])
1723 if test "x$JAR" = "x"
1725 AC_MSG_CHECKING([for jar])
1726 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1727 if test "x$TMPDIR" != "x"
1730 AC_MSG_RESULT([$JAR])
1732 AC_MSG_RESULT([not found])
1735 else if test "x$with_java_home" != "x"
1737 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1741 if test "x$JAVA_CPPFLAGS" != "x"
1743 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1745 if test "x$JAVA_CFLAGS" != "x"
1747 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1749 if test "x$JAVA_LDFLAGS" != "x"
1751 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1753 if test "x$JAVAC" = "x"
1755 with_javac_path="$PATH"
1756 if test "x$with_java_home" != "x"
1758 with_javac_path="$with_java_home:with_javac_path"
1759 if test -d "$with_java_home/bin"
1761 with_javac_path="$with_java_home/bin:with_javac_path"
1765 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1767 if test "x$JAVAC" = "x"
1769 with_java="no (javac not found)"
1771 if test "x$JAR" = "x"
1773 with_jar_path="$PATH"
1774 if test "x$with_java_home" != "x"
1776 with_jar_path="$with_java_home:$with_jar_path"
1777 if test -d "$with_java_home/bin"
1779 with_jar_path="$with_java_home/bin:$with_jar_path"
1783 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
1785 if test "x$JAR" = "x"
1787 with_java="no (jar not found)"
1790 SAVE_CPPFLAGS="$CPPFLAGS"
1791 SAVE_CFLAGS="$CFLAGS"
1792 SAVE_LDFLAGS="$LDFLAGS"
1793 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1794 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1795 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1797 if test "x$with_java" = "xyes"
1799 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1801 if test "x$with_java" = "xyes"
1803 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1805 [with_java="no (libjvm not found)"],
1808 if test "x$with_java" = "xyes"
1810 JAVA_LIBS="$JAVA_LIBS -ljvm"
1811 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1814 CPPFLAGS="$SAVE_CPPFLAGS"
1815 CFLAGS="$SAVE_CFLAGS"
1816 LDFLAGS="$SAVE_LDFLAGS"
1818 AC_SUBST(JAVA_CPPFLAGS)
1819 AC_SUBST(JAVA_CFLAGS)
1820 AC_SUBST(JAVA_LDFLAGS)
1822 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1825 # --with-libmemcached {{{
1826 with_libmemcached_cppflags=""
1827 with_libmemcached_ldflags=""
1828 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1830 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1832 with_libmemcached_cppflags="-I$withval/include"
1833 with_libmemcached_ldflags="-L$withval/lib"
1834 with_libmemcached="yes"
1836 with_libmemcached="$withval"
1840 with_libmemcached="yes"
1842 if test "x$with_libmemcached" = "xyes"
1844 SAVE_CPPFLAGS="$CPPFLAGS"
1845 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1847 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1849 CPPFLAGS="$SAVE_CPPFLAGS"
1851 if test "x$with_libmemcached" = "xyes"
1853 SAVE_CPPFLAGS="$CPPFLAGS"
1854 SAVE_LDFLAGS="$LDFLAGS"
1855 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1856 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1858 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1860 CPPFLAGS="$SAVE_CPPFLAGS"
1861 LDFLAGS="$SAVE_LDFLAGS"
1863 if test "x$with_libmemcached" = "xyes"
1865 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1866 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1867 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1868 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1869 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1870 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1871 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1873 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1876 # --with-libmodbus {{{
1877 with_libmodbus_config=""
1878 with_libmodbus_cflags=""
1879 with_libmodbus_libs=""
1880 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
1882 if test "x$withval" = "xno"
1885 else if test "x$withval" = "xyes"
1887 with_libmodbus="use_pkgconfig"
1888 else if test -d "$with_libmodbus/lib"
1890 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
1891 with_libmodbus_cflags="-I$withval/include"
1892 with_libmodbus_libs="-L$withval/lib -lmodbus"
1893 with_libmodbus="yes"
1896 [with_libmodbus="use_pkgconfig"])
1898 # configure using pkg-config
1899 if test "x$with_libmodbus" = "xuse_pkgconfig"
1901 if test "x$PKG_CONFIG" = "x"
1903 with_libmodbus="no (Don't have pkg-config)"
1906 if test "x$with_libmodbus" = "xuse_pkgconfig"
1908 AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
1909 $PKG_CONFIG --exists 'modbus' 2>/dev/null
1912 with_libmodbus="no (pkg-config doesn't know library)"
1915 if test "x$with_libmodbus" = "xuse_pkgconfig"
1917 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
1920 with_libmodbus="no ($PKG_CONFIG failed)"
1922 with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
1925 with_libmodbus="no ($PKG_CONFIG failed)"
1928 if test "x$with_libmodbus" = "xuse_pkgconfig"
1930 with_libmodbus="yes"
1933 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
1934 # the actual checks.
1935 if test "x$with_libmodbus" = "xyes"
1937 SAVE_CPPFLAGS="$CPPFLAGS"
1938 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1940 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
1942 CPPFLAGS="$SAVE_CPPFLAGS"
1944 if test "x$with_libmodbus" = "xyes"
1946 SAVE_CPPFLAGS="$CPPFLAGS"
1947 SAVE_LDFLAGS="$LDFLAGS"
1949 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1950 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
1952 AC_CHECK_LIB(modbus, modbus_init_tcp,
1953 [with_libmodbus="yes"],
1954 [with_libmodbus="no (symbol modbus_init_tcp not found)"])
1956 CPPFLAGS="$SAVE_CPPFLAGS"
1957 LDFLAGS="$SAVE_LDFLAGS"
1959 if test "x$with_libmodbus" = "xyes"
1961 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
1962 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
1963 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
1964 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
1968 # --with-libmysql {{{
1969 with_mysql_config="mysql_config"
1970 with_mysql_cflags=""
1972 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1974 if test "x$withval" = "xno"
1977 else if test "x$withval" = "xyes"
1981 if test -f "$withval" && test -x "$withval";
1983 with_mysql_config="$withval"
1984 else if test -x "$withval/bin/mysql_config"
1986 with_mysql_config="$withval/bin/mysql_config"
1994 if test "x$with_libmysql" = "xyes"
1996 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1997 mysql_config_status=$?
1999 if test $mysql_config_status -ne 0
2001 with_libmysql="no ($with_mysql_config failed)"
2003 SAVE_CPPFLAGS="$CPPFLAGS"
2004 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2007 have_mysql_mysql_h="no"
2008 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2010 if test "x$have_mysql_h" = "xno"
2012 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2015 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2017 with_libmysql="no (mysql.h not found)"
2020 CPPFLAGS="$SAVE_CPPFLAGS"
2023 if test "x$with_libmysql" = "xyes"
2025 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
2026 mysql_config_status=$?
2028 if test $mysql_config_status -ne 0
2030 with_libmysql="no ($with_mysql_config failed)"
2032 AC_CHECK_LIB(mysqlclient, mysql_init,
2033 [with_libmysql="yes"],
2034 [with_libmysql="no (symbol 'mysql_init' not found)"],
2037 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2038 [with_libmysql="yes"],
2039 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2043 if test "x$with_libmysql" = "xyes"
2045 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2046 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2047 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2048 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2050 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2053 # --with-libnetlink {{{
2054 with_libnetlink_cflags=""
2055 with_libnetlink_libs="-lnetlink"
2056 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2058 echo "libnetlink: withval = $withval"
2059 if test "x$withval" = "xyes"
2061 with_libnetlink="yes"
2062 else if test "x$withval" = "xno"
2064 with_libnetlink="no"
2066 if test -d "$withval/include"
2068 with_libnetlink_cflags="-I$withval/include"
2069 with_libnetlink_libs="-L$withval/lib -lnetlink"
2070 with_libnetlink="yes"
2072 AC_MSG_ERROR("no such directory: $withval/include")
2077 if test "x$ac_system" = "xLinux"
2079 with_libnetlink="yes"
2081 with_libnetlink="no (Linux only library)"
2084 if test "x$with_libnetlink" = "xyes"
2086 SAVE_CFLAGS="$CFLAGS"
2087 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2089 with_libnetlink="no (libnetlink.h not found)"
2091 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2093 with_libnetlink="yes"
2097 #include <sys/types.h>
2098 #include <asm/types.h>
2099 #include <sys/socket.h>
2100 #include <linux/netlink.h>
2101 #include <linux/rtnetlink.h>])
2102 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2104 #include <sys/types.h>
2105 #include <asm/types.h>
2106 #include <sys/socket.h>])
2110 #include <sys/types.h>
2111 #include <asm/types.h>
2112 #include <sys/socket.h>
2113 #include <linux/netlink.h>
2114 #include <linux/rtnetlink.h>
2118 int retval = TCA_STATS2;
2121 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2126 #include <sys/types.h>
2127 #include <asm/types.h>
2128 #include <sys/socket.h>
2129 #include <linux/netlink.h>
2130 #include <linux/rtnetlink.h>
2134 int retval = TCA_STATS;
2137 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2140 CFLAGS="$SAVE_CFLAGS"
2142 if test "x$with_libnetlink" = "xyes"
2144 AC_CHECK_LIB(netlink, rtnl_open,
2145 [with_libnetlink="yes"],
2146 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2147 [$with_libnetlink_libs])
2149 if test "x$with_libnetlink" = "xyes"
2151 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2152 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2153 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2154 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2156 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2159 # --with-libnetapp {{{
2160 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2161 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2162 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2163 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2164 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2165 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2166 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2168 if test -d "$withval"
2170 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2171 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2172 with_libnetapp="yes"
2174 with_libnetapp="$withval"
2178 with_libnetapp="yes"
2181 SAVE_CPPFLAGS="$CPPFLAGS"
2182 SAVE_LDFLAGS="$LDFLAGS"
2183 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2184 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2186 if test "x$with_libnetapp" = "xyes"
2188 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2190 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2192 AC_CHECK_HEADERS(netapp_api.h,
2193 [with_libnetapp="yes"],
2194 [with_libnetapp="no (netapp_api.h not found)"])
2197 if test "x$with_libnetapp" = "xyes"
2199 if test "x$LIBNETAPP_LDFLAGS" != "x"
2201 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2204 if test "x$LIBNETAPP_LIBS" = "x"
2206 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2208 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2210 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2211 [with_libnetapp="yes"],
2212 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2214 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2217 CPPFLAGS="$SAVE_CPPFLAGS"
2218 LDFLAGS="$SAVE_LDFLAGS"
2220 if test "x$with_libnetapp" = "xyes"
2222 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2225 AC_SUBST(LIBNETAPP_CPPFLAGS)
2226 AC_SUBST(LIBNETAPP_LDFLAGS)
2227 AC_SUBST(LIBNETAPP_LIBS)
2228 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2231 # --with-libnetsnmp {{{
2232 with_snmp_config="net-snmp-config"
2235 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2237 if test "x$withval" = "xno"
2239 with_libnetsnmp="no"
2240 else if test "x$withval" = "xyes"
2242 with_libnetsnmp="yes"
2244 if test -x "$withval"
2246 with_snmp_config="$withval"
2247 with_libnetsnmp="yes"
2249 with_snmp_config="$withval/bin/net-snmp-config"
2250 with_libnetsnmp="yes"
2254 [with_libnetsnmp="yes"])
2255 if test "x$with_libnetsnmp" = "xyes"
2257 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2258 snmp_config_status=$?
2260 if test $snmp_config_status -ne 0
2262 with_libnetsnmp="no ($with_snmp_config failed)"
2264 SAVE_CPPFLAGS="$CPPFLAGS"
2265 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2267 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2269 CPPFLAGS="$SAVE_CPPFLAGS"
2272 if test "x$with_libnetsnmp" = "xyes"
2274 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2275 snmp_config_status=$?
2277 if test $snmp_config_status -ne 0
2279 with_libnetsnmp="no ($with_snmp_config failed)"
2281 AC_CHECK_LIB(netsnmp, init_snmp,
2282 [with_libnetsnmp="yes"],
2283 [with_libnetsnmp="no (libnetsnmp not found)"],
2287 if test "x$with_libnetsnmp" = "xyes"
2289 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2290 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2291 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2292 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2294 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2297 # --with-liboconfig {{{
2298 with_own_liboconfig="no"
2299 liboconfig_LDFLAGS="$LDFLAGS"
2300 liboconfig_CPPFLAGS="$CPPFLAGS"
2301 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2303 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2305 if test -d "$withval/lib"
2307 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2309 if test -d "$withval/include"
2311 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2314 if test "x$withval" = "xno"
2316 AC_MSG_ERROR("liboconfig is required")
2320 with_liboconfig="yes"
2323 save_LDFLAGS="$LDFLAGS"
2324 save_CPPFLAGS="$CPPFLAGS"
2325 LDFLAGS="$liboconfig_LDFLAGS"
2326 CPPFLAGS="$liboconfig_CPPFLAGS"
2327 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2329 with_liboconfig="yes"
2330 with_own_liboconfig="no"
2333 with_liboconfig="yes"
2334 with_own_liboconfig="yes"
2335 LDFLAGS="$save_LDFLAGS"
2336 CPPFLAGS="$save_CPPFLAGS"
2339 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2340 if test "x$with_own_liboconfig" = "xyes"
2342 with_liboconfig="yes (shipped version)"
2346 # --with-liboping {{{
2347 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2349 if test "x$withval" = "xyes"
2352 else if test "x$withval" = "xno"
2357 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2358 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2361 [with_liboping="yes"])
2363 SAVE_CPPFLAGS="$CPPFLAGS"
2364 SAVE_LDFLAGS="$LDFLAGS"
2366 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2367 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2369 if test "x$with_liboping" = "xyes"
2371 if test "x$LIBOPING_CPPFLAGS" != "x"
2373 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2375 AC_CHECK_HEADERS(oping.h,
2376 [with_liboping="yes"],
2377 [with_liboping="no ('oping.h' not found)"])
2379 if test "x$with_liboping" = "xyes"
2381 if test "x$LIBOPING_LDFLAGS" != "x"
2383 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2385 AC_CHECK_LIB(oping, ping_construct,
2386 [with_liboping="yes"],
2387 [with_liboping="no (symbol 'ping_construct' not found)"])
2390 CPPFLAGS="$SAVE_CPPFLAGS"
2391 LDFLAGS="$SAVE_LDFLAGS"
2393 if test "x$with_liboping" = "xyes"
2395 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2396 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2397 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2398 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2400 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2404 with_oracle_cppflags=""
2406 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2408 if test "x$withval" = "xyes"
2410 if test "x$ORACLE_HOME" = "x"
2412 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2415 else if test "x$withval" = "xno"
2420 ORACLE_HOME="$withval"
2424 if test "x$ORACLE_HOME" = "x"
2426 with_oracle="no (ORACLE_HOME is not set)"
2431 if test "x$ORACLE_HOME" != "x"
2433 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2435 if test -e "$ORACLE_HOME/lib/ldflags"
2437 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2439 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2440 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2442 if test "x$with_oracle" = "xyes"
2444 SAVE_CPPFLAGS="$CPPFLAGS"
2445 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2447 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2449 CPPFLAGS="$SAVE_CPPFLAGS"
2451 if test "x$with_oracle" = "xyes"
2453 SAVE_CPPFLAGS="$CPPFLAGS"
2454 SAVE_LDFLAGS="$LDFLAGS"
2455 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2456 LDFLAGS="$LDFLAGS $with_oracle_libs"
2458 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2460 CPPFLAGS="$SAVE_CPPFLAGS"
2461 LDFLAGS="$SAVE_LDFLAGS"
2463 if test "x$with_oracle" = "xyes"
2465 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2466 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2467 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2468 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2472 # --with-libowcapi {{{
2473 with_libowcapi_cppflags=""
2474 with_libowcapi_libs="-lowcapi"
2475 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2477 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2479 with_libowcapi_cppflags="-I$withval/include"
2480 with_libowcapi_libs="-L$withval/lib -lowcapi"
2481 with_libowcapi="yes"
2483 with_libowcapi="$withval"
2487 with_libowcapi="yes"
2489 if test "x$with_libowcapi" = "xyes"
2491 SAVE_CPPFLAGS="$CPPFLAGS"
2492 CPPFLAGS="$with_libowcapi_cppflags"
2494 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2496 CPPFLAGS="$SAVE_CPPFLAGS"
2498 if test "x$with_libowcapi" = "xyes"
2500 SAVE_LDFLAGS="$LDFLAGS"
2501 SAVE_CPPFLAGS="$CPPFLAGS"
2502 LDFLAGS="$with_libowcapi_libs"
2503 CPPFLAGS="$with_libowcapi_cppflags"
2505 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2507 LDFLAGS="$SAVE_LDFLAGS"
2508 CPPFLAGS="$SAVE_CPPFLAGS"
2510 if test "x$with_libowcapi" = "xyes"
2512 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2513 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2514 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2515 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2519 # --with-libpcap {{{
2520 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2522 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2524 LDFLAGS="$LDFLAGS -L$withval/lib"
2525 CPPFLAGS="$CPPFLAGS -I$withval/include"
2528 with_libpcap="$withval"
2534 if test "x$with_libpcap" = "xyes"
2536 AC_CHECK_LIB(pcap, pcap_open_live,
2538 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2539 ], [with_libpcap="no (libpcap not found)"])
2541 if test "x$with_libpcap" = "xyes"
2543 AC_CHECK_HEADERS(pcap.h,
2545 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2546 ], [with_libpcap="no (pcap.h not found)"])
2548 if test "x$with_libpcap" = "xyes"
2554 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2555 [Wether or not to use the pcap library])
2556 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2559 # --with-libperl {{{
2560 perl_interpreter="perl"
2561 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2563 if test -x "$withval"
2565 perl_interpreter="$withval"
2567 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2569 LDFLAGS="$LDFLAGS -L$withval/lib"
2570 CPPFLAGS="$CPPFLAGS -I$withval/include"
2571 perl_interpreter="$withval/bin/perl"
2574 with_libperl="$withval"
2581 AC_MSG_CHECKING([for perl])
2582 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2583 if test -x "$perl_interpreter"
2585 AC_MSG_RESULT([yes ($perl_interpreter)])
2591 AC_SUBST(PERL, "$perl_interpreter")
2593 if test "x$with_libperl" = "xyes" \
2594 && test -n "$perl_interpreter"
2596 SAVE_CFLAGS="$CFLAGS"
2597 SAVE_LDFLAGS="$LDFLAGS"
2598 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2599 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2600 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2601 CFLAGS="$CFLAGS $PERL_CFLAGS"
2602 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2604 AC_CACHE_CHECK([for libperl],
2605 [c_cv_have_libperl],
2609 #define PERL_NO_GET_CONTEXT
2616 load_module (PERL_LOADMOD_NOIMPORT,
2617 newSVpv ("Collectd::Plugin::FooBar", 24),
2620 [c_cv_have_libperl="yes"],
2621 [c_cv_have_libperl="no"]
2625 if test "x$c_cv_have_libperl" = "xyes"
2627 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2628 AC_SUBST(PERL_CFLAGS)
2629 AC_SUBST(PERL_LDFLAGS)
2634 CFLAGS="$SAVE_CFLAGS"
2635 LDFLAGS="$SAVE_LDFLAGS"
2636 else if test -z "$perl_interpreter"; then
2637 with_libperl="no (no perl interpreter found)"
2638 c_cv_have_libperl="no"
2640 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2642 if test "x$with_libperl" = "xyes"
2644 SAVE_CFLAGS="$CFLAGS"
2645 SAVE_LDFLAGS="$LDFLAGS"
2646 CFLAGS="$CFLAGS $PERL_CFLAGS"
2647 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2649 AC_CACHE_CHECK([if perl supports ithreads],
2650 [c_cv_have_perl_ithreads],
2658 #if !defined(USE_ITHREADS)
2659 # error "Perl does not support ithreads!"
2660 #endif /* !defined(USE_ITHREADS) */
2663 [c_cv_have_perl_ithreads="yes"],
2664 [c_cv_have_perl_ithreads="no"]
2668 if test "x$c_cv_have_perl_ithreads" = "xyes"
2670 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2673 CFLAGS="$SAVE_CFLAGS"
2674 LDFLAGS="$SAVE_LDFLAGS"
2677 if test "x$with_libperl" = "xyes"
2679 SAVE_CFLAGS="$CFLAGS"
2680 SAVE_LDFLAGS="$LDFLAGS"
2681 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2682 # (see issues #41 and #42)
2683 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2684 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2686 AC_CACHE_CHECK([for broken Perl_load_module()],
2687 [c_cv_have_broken_perl_load_module],
2691 #define PERL_NO_GET_CONTEXT
2698 load_module (PERL_LOADMOD_NOIMPORT,
2699 newSVpv ("Collectd::Plugin::FooBar", 24),
2702 [c_cv_have_broken_perl_load_module="no"],
2703 [c_cv_have_broken_perl_load_module="yes"]
2707 CFLAGS="$SAVE_CFLAGS"
2708 LDFLAGS="$SAVE_LDFLAGS"
2710 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2711 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2713 if test "x$with_libperl" = "xyes"
2715 SAVE_CFLAGS="$CFLAGS"
2716 SAVE_LDFLAGS="$LDFLAGS"
2717 CFLAGS="$CFLAGS $PERL_CFLAGS"
2718 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2721 [struct mgvtbl.svt_local],
2722 [have_struct_mgvtbl_svt_local="yes"],
2723 [have_struct_mgvtbl_svt_local="no"],
2730 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2732 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2733 [Define if Perl's struct mgvtbl has member svt_local.])
2736 CFLAGS="$SAVE_CFLAGS"
2737 LDFLAGS="$SAVE_LDFLAGS"
2742 with_pg_config="pg_config"
2743 with_libpq_includedir=""
2744 with_libpq_libdir=""
2745 with_libpq_cppflags=""
2746 with_libpq_ldflags=""
2747 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2750 if test "x$withval" = "xno"
2753 else if test "x$withval" = "xyes"
2757 if test -f "$withval" && test -x "$withval";
2759 with_pg_config="$withval"
2760 else if test -x "$withval/bin/pg_config"
2762 with_pg_config="$withval/bin/pg_config"
2770 if test "x$with_libpq" = "xyes"
2772 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2775 if test $pg_config_status -eq 0
2777 if test -n "$with_libpq_includedir"; then
2778 for dir in $with_libpq_includedir; do
2779 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2783 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2786 SAVE_CPPFLAGS="$CPPFLAGS"
2787 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2789 AC_CHECK_HEADERS(libpq-fe.h, [],
2790 [with_libpq="no (libpq-fe.h not found)"], [])
2792 CPPFLAGS="$SAVE_CPPFLAGS"
2794 if test "x$with_libpq" = "xyes"
2796 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2799 if test $pg_config_status -eq 0
2801 if test -n "$with_libpq_libdir"; then
2802 for dir in $with_libpq_libdir; do
2803 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2807 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2810 SAVE_LDFLAGS="$LDFLAGS"
2811 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2813 AC_CHECK_LIB(pq, PQconnectdb,
2815 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2817 AC_CHECK_LIB(pq, PQserverVersion,
2819 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2821 LDFLAGS="$SAVE_LDFLAGS"
2823 if test "x$with_libpq" = "xyes"
2825 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2826 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2827 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2828 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2830 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2833 # --with-libpthread {{{
2834 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2835 [ if test "x$withval" != "xno" \
2836 && test "x$withval" != "xyes"
2838 LDFLAGS="$LDFLAGS -L$withval/lib"
2839 CPPFLAGS="$CPPFLAGS -I$withval/include"
2840 with_libpthread="yes"
2842 if test "x$withval" = "xno"
2844 with_libpthread="no (disabled)"
2847 ], [with_libpthread="yes"])
2848 if test "x$with_libpthread" = "xyes"
2850 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2853 if test "x$with_libpthread" = "xyes"
2855 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2857 if test "x$with_libpthread" = "xyes"
2863 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2864 [Wether or not to use pthread (POSIX threads) library])
2865 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2870 with_python_path="$PATH"
2871 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
2873 if test "x$withval" = "xyes" || test "x$withval" = "xno"
2875 with_python="$withval"
2876 else if test -x "$withval"
2878 with_python_prog="$withval"
2879 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
2881 else if test -d "$withval"
2883 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
2886 AC_MSG_WARN([Argument not recognized: $withval])
2888 ], [with_python="yes"])
2891 SAVE_CPPFLAGS="$CPPFLAGS"
2892 SAVE_LDFLAGS="$LDFLAGS"
2895 PATH="$with_python_path"
2897 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
2899 AC_MSG_CHECKING([for python])
2900 with_python_prog="`which python 2>/dev/null`"
2901 if test "x$with_python_prog" = "x"
2903 AC_MSG_RESULT([not found])
2904 with_python="no (interpreter not found)"
2906 AC_MSG_RESULT([$with_python_prog])
2910 if test "x$with_python" = "xyes"
2912 AC_MSG_CHECKING([for Python CPPFLAGS])
2913 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
2914 python_config_status=$?
2916 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
2918 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
2921 AC_MSG_RESULT([$python_include_path])
2925 if test "x$with_python" = "xyes"
2927 CPPFLAGS="-I$python_include_path $CPPFLAGS"
2928 AC_CHECK_HEADERS(Python.h,
2929 [with_python="yes"],
2930 [with_python="no ('Python.h' not found)"])
2933 if test "x$with_python" = "xyes"
2935 AC_MSG_CHECKING([for Python LDFLAGS])
2936 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`
2937 python_config_status=$?
2939 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
2941 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
2944 AC_MSG_RESULT([$python_library_path])
2948 if test "x$with_python" = "xyes"
2950 AC_MSG_CHECKING([for Python LIBS])
2951 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`
2952 python_config_status=$?
2954 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
2956 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
2959 AC_MSG_RESULT([$python_library_flags])
2963 if test "x$with_python" = "xyes"
2965 LDFLAGS="-L$python_library_path $LDFLAGS"
2966 LIBS="$python_library_flags $LIBS"
2968 AC_CHECK_FUNC(PyObject_CallFunction,
2969 [with_python="yes"],
2970 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
2974 CPPFLAGS="$SAVE_CPPFLAGS"
2975 LDFLAGS="$SAVE_LDFLAGS"
2978 if test "x$with_python" = "xyes"
2980 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
2981 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
2982 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
2983 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
2984 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
2985 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
2989 # --with-librouteros {{{
2990 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
2992 if test "x$withval" = "xyes"
2994 with_librouteros="yes"
2995 else if test "x$withval" = "xno"
2997 with_librouteros="no"
2999 with_librouteros="yes"
3000 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3001 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3004 [with_librouteros="yes"])
3006 SAVE_CPPFLAGS="$CPPFLAGS"
3007 SAVE_LDFLAGS="$LDFLAGS"
3009 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3010 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3012 if test "x$with_librouteros" = "xyes"
3014 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3016 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3018 AC_CHECK_HEADERS(routeros_api.h,
3019 [with_librouteros="yes"],
3020 [with_librouteros="no ('routeros_api.h' not found)"])
3022 if test "x$with_librouteros" = "xyes"
3024 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3026 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3028 AC_CHECK_LIB(routeros, ros_interface,
3029 [with_librouteros="yes"],
3030 [with_librouteros="no (symbol 'ros_interface' not found)"])
3033 CPPFLAGS="$SAVE_CPPFLAGS"
3034 LDFLAGS="$SAVE_LDFLAGS"
3036 if test "x$with_librouteros" = "xyes"
3038 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3039 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3040 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3041 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3043 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3047 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3050 librrd_threadsafe="yes"
3051 librrd_rrdc_update="no"
3052 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3053 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3055 librrd_cflags="-I$withval/include"
3056 librrd_ldflags="-L$withval/lib"
3059 with_librrd="$withval"
3061 ], [with_librrd="yes"])
3062 if test "x$with_librrd" = "xyes"
3064 SAVE_CPPFLAGS="$CPPFLAGS"
3065 SAVE_LDFLAGS="$LDFLAGS"
3067 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3068 LDFLAGS="$LDFLAGS $librrd_ldflags"
3070 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3072 CPPFLAGS="$SAVE_CPPFLAGS"
3073 LDFLAGS="$SAVE_LDFLAGS"
3075 if test "x$with_librrd" = "xyes"
3077 SAVE_CPPFLAGS="$CPPFLAGS"
3078 SAVE_LDFLAGS="$LDFLAGS"
3080 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3081 LDFLAGS="$LDFLAGS $librrd_ldflags"
3083 AC_CHECK_LIB(rrd_th, rrd_update_r,
3085 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3087 [librrd_threadsafe="no"
3088 AC_CHECK_LIB(rrd, rrd_update,
3090 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3092 [with_librrd="no (symbol 'rrd_update' not found)"],
3097 if test "x$librrd_threadsafe" = "xyes"
3099 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3101 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3104 CPPFLAGS="$SAVE_CPPFLAGS"
3105 LDFLAGS="$SAVE_LDFLAGS"
3107 if test "x$with_librrd" = "xyes"
3109 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3110 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3111 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3112 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3114 if test "x$librrd_threadsafe" = "xyes"
3116 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3120 # --with-libsensors {{{
3121 with_sensors_cflags=""
3122 with_sensors_ldflags=""
3123 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3125 if test "x$withval" = "xno"
3127 with_libsensors="no"
3129 with_libsensors="yes"
3130 if test "x$withval" != "xyes"
3132 with_sensors_cflags="-I$withval/include"
3133 with_sensors_ldflags="-L$withval/lib"
3134 with_libsensors="yes"
3139 if test "x$ac_system" = "xLinux"
3141 with_libsensors="yes"
3143 with_libsensors="no (Linux only library)"
3146 if test "x$with_libsensors" = "xyes"
3148 SAVE_CPPFLAGS="$CPPFLAGS"
3149 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3151 # AC_CHECK_HEADERS(sensors/sensors.h,
3153 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3155 # [with_libsensors="no (sensors/sensors.h not found)"])
3156 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3158 CPPFLAGS="$SAVE_CPPFLAGS"
3160 if test "x$with_libsensors" = "xyes"
3162 SAVE_CPPFLAGS="$CPPFLAGS"
3163 SAVE_LDFLAGS="$LDFLAGS"
3164 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3165 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3167 AC_CHECK_LIB(sensors, sensors_init,
3169 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3171 [with_libsensors="no (libsensors not found)"])
3173 CPPFLAGS="$SAVE_CPPFLAGS"
3174 LDFLAGS="$SAVE_LDFLAGS"
3176 if test "x$with_libsensors" = "xyes"
3178 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3179 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3180 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3181 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3183 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3186 # --with-libstatgrab {{{
3187 with_libstatgrab_cflags=""
3188 with_libstatgrab_ldflags=""
3189 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3191 if test "x$withval" != "xno" \
3192 && test "x$withval" != "xyes"
3194 with_libstatgrab_cflags="-I$withval/include"
3195 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3196 with_libstatgrab="yes"
3197 with_libstatgrab_pkg_config="no"
3199 with_libstatgrab="$withval"
3200 with_libstatgrab_pkg_config="yes"
3204 with_libstatgrab="yes"
3205 with_libstatgrab_pkg_config="yes"
3208 if test "x$with_libstatgrab" = "xyes" \
3209 && test "x$with_libstatgrab_pkg_config" = "xyes"
3211 if test "x$PKG_CONFIG" != "x"
3213 AC_MSG_CHECKING([pkg-config for libstatgrab])
3215 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3218 with_libstatgrab_pkg_config="no"
3219 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
3220 temp_result="not found"
3222 AC_MSG_RESULT([$temp_result])
3224 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3225 with_libstatgrab_pkg_config="no"
3226 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3230 if test "x$with_libstatgrab" = "xyes" \
3231 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3232 && test "x$with_libstatgrab_cflags" = "x"
3234 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3235 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3238 with_libstatgrab_cflags="$temp_result"
3240 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3241 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3243 AC_MSG_RESULT([$temp_result])
3246 if test "x$with_libstatgrab" = "xyes" \
3247 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3248 && test "x$with_libstatgrab_ldflags" = "x"
3250 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3251 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3254 with_libstatgrab_ldflags="$temp_result"
3256 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3257 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3259 AC_MSG_RESULT([$temp_result])
3262 if test "x$with_libstatgrab" = "xyes"
3264 SAVE_CPPFLAGS="$CPPFLAGS"
3265 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3267 AC_CHECK_HEADERS(statgrab.h,
3268 [with_libstatgrab="yes"],
3269 [with_libstatgrab="no (statgrab.h not found)"])
3271 CPPFLAGS="$SAVE_CPPFLAGS"
3274 if test "x$with_libstatgrab" = "xyes"
3276 SAVE_CFLAGS="$CFLAGS"
3277 SAVE_LDFLAGS="$LDFLAGS"
3279 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3280 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3282 AC_CHECK_LIB(statgrab, sg_init,
3283 [with_libstatgrab="yes"],
3284 [with_libstatgrab="no (symbol sg_init not found)"])
3286 CFLAGS="$SAVE_CFLAGS"
3287 LDFLAGS="$SAVE_LDFLAGS"
3290 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3291 if test "x$with_libstatgrab" = "xyes"
3293 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3294 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3295 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3296 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3297 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3301 # --with-libtokyotyrant {{{
3302 with_libtokyotyrant_cppflags=""
3303 with_libtokyotyrant_ldflags=""
3304 with_libtokyotyrant_libs=""
3305 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3307 if test "x$withval" = "xno"
3309 with_libtokyotyrant="no"
3310 else if test "x$withval" = "xyes"
3312 with_libtokyotyrant="yes"
3314 with_libtokyotyrant_cppflags="-I$withval/include"
3315 with_libtokyotyrant_ldflags="-L$withval/include"
3316 with_libtokyotyrant_libs="-ltokyotyrant"
3317 with_libtokyotyrant="yes"
3321 with_libtokyotyrant="yes"
3324 if test "x$with_libtokyotyrant" = "xyes"
3326 if $PKG_CONFIG --exists tokyotyrant
3328 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3329 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3330 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3334 SAVE_CPPFLAGS="$CPPFLAGS"
3335 SAVE_LDFLAGS="$LDFLAGS"
3336 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3337 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3339 if test "x$with_libtokyotyrant" = "xyes"
3341 AC_CHECK_HEADERS(tcrdb.h,
3343 AC_DEFINE(HAVE_TCRDB_H, 1,
3344 [Define to 1 if you have the <tcrdb.h> header file.])
3345 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3348 if test "x$with_libtokyotyrant" = "xyes"
3350 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3352 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3353 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3355 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3356 [$with_libtokyotyrant_libs])
3359 CPPFLAGS="$SAVE_CPPFLAGS"
3360 LDFLAGS="$SAVE_LDFLAGS"
3362 if test "x$with_libtokyotyrant" = "xyes"
3364 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3365 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3366 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3367 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3368 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3369 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3371 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3374 # --with-libupsclient {{{
3375 with_libupsclient_config=""
3376 with_libupsclient_cflags=""
3377 with_libupsclient_libs=""
3378 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
3380 if test "x$withval" = "xno"
3382 with_libupsclient="no"
3383 else if test "x$withval" = "xyes"
3385 with_libupsclient="use_pkgconfig"
3387 if test -x "$withval"
3389 with_libupsclient_config="$withval"
3390 with_libupsclient="use_libupsclient_config"
3391 else if test -x "$withval/bin/libupsclient-config"
3393 with_libupsclient_config="$withval/bin/libupsclient-config"
3394 with_libupsclient="use_libupsclient_config"
3396 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3397 with_libupsclient_cflags="-I$withval/include"
3398 with_libupsclient_libs="-L$withval/lib -lupsclient"
3399 with_libupsclient="yes"
3403 [with_libupsclient="use_pkgconfig"])
3405 # configure using libupsclient-config
3406 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3408 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3409 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3412 with_libupsclient="no ($with_libupsclient_config failed)"
3414 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3417 with_libupsclient="no ($with_libupsclient_config failed)"
3420 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3422 with_libupsclient="yes"
3425 # configure using pkg-config
3426 if test "x$with_libupsclient" = "xuse_pkgconfig"
3428 if test "x$PKG_CONFIG" = "x"
3430 with_libupsclient="no (Don't have pkg-config)"
3433 if test "x$with_libupsclient" = "xuse_pkgconfig"
3435 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3436 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3439 with_libupsclient="no (pkg-config doesn't know library)"
3442 if test "x$with_libupsclient" = "xuse_pkgconfig"
3444 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3447 with_libupsclient="no ($PKG_CONFIG failed)"
3449 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3452 with_libupsclient="no ($PKG_CONFIG failed)"
3455 if test "x$with_libupsclient" = "xuse_pkgconfig"
3457 with_libupsclient="yes"
3460 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3461 # the actual checks.
3462 if test "x$with_libupsclient" = "xyes"
3464 SAVE_CPPFLAGS="$CPPFLAGS"
3465 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3467 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3469 CPPFLAGS="$SAVE_CPPFLAGS"
3471 if test "x$with_libupsclient" = "xyes"
3473 SAVE_CPPFLAGS="$CPPFLAGS"
3474 SAVE_LDFLAGS="$LDFLAGS"
3476 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3477 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3479 AC_CHECK_LIB(upsclient, upscli_connect,
3480 [with_libupsclient="yes"],
3481 [with_libupsclient="no (symbol upscli_connect not found)"])
3483 CPPFLAGS="$SAVE_CPPFLAGS"
3484 LDFLAGS="$SAVE_LDFLAGS"
3486 if test "x$with_libupsclient" = "xyes"
3488 SAVE_CPPFLAGS="$CPPFLAGS"
3489 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3491 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3492 [#include <stdlib.h>
3494 #include <upsclient.h>])
3496 CPPFLAGS="$SAVE_CPPFLAGS"
3498 if test "x$with_libupsclient" = "xyes"
3500 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3501 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3502 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3503 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3507 # --with-libxmms {{{
3508 with_xmms_config="xmms-config"
3511 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3513 if test "x$withval" != "xno" \
3514 && test "x$withval" != "xyes"
3516 if test -f "$withval" && test -x "$withval";
3518 with_xmms_config="$withval"
3519 else if test -x "$withval/bin/xmms-config"
3521 with_xmms_config="$withval/bin/xmms-config"
3524 else if test "x$withval" = "xno"
3534 if test "x$with_libxmms" = "xyes"
3536 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3537 xmms_config_status=$?
3539 if test $xmms_config_status -ne 0
3544 if test "x$with_libxmms" = "xyes"
3546 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3547 xmms_config_status=$?
3549 if test $xmms_config_status -ne 0
3554 if test "x$with_libxmms" = "xyes"
3556 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3558 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3559 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3560 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3561 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3568 with_libxmms_numeric=0
3569 if test "x$with_libxmms" = "xyes"
3571 with_libxmms_numeric=1
3573 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3574 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3577 # --with-libyajl {{{
3578 with_libyajl_cppflags=""
3579 with_libyajl_ldflags=""
3580 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3582 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3584 with_libyajl_cppflags="-I$withval/include"
3585 with_libyajl_ldflags="-L$withval/lib"
3588 with_libyajl="$withval"
3594 if test "x$with_libyajl" = "xyes"
3596 SAVE_CPPFLAGS="$CPPFLAGS"
3597 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3599 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3601 CPPFLAGS="$SAVE_CPPFLAGS"
3603 if test "x$with_libyajl" = "xyes"
3605 SAVE_CPPFLAGS="$CPPFLAGS"
3606 SAVE_LDFLAGS="$LDFLAGS"
3607 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3608 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3610 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3612 CPPFLAGS="$SAVE_CPPFLAGS"
3613 LDFLAGS="$SAVE_LDFLAGS"
3615 if test "x$with_libyajl" = "xyes"
3617 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3618 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3619 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3620 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3621 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3622 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3623 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3625 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3628 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3629 with_libxml2="no (pkg-config isn't available)"
3630 with_libxml2_cflags=""
3631 with_libxml2_ldflags=""
3632 with_libvirt="no (pkg-config isn't available)"
3633 with_libvirt_cflags=""
3634 with_libvirt_ldflags=""
3635 if test "x$PKG_CONFIG" != "x"
3637 pkg-config --exists 'libxml-2.0' 2>/dev/null
3642 with_libxml2="no (pkg-config doesn't know library)"
3645 pkg-config --exists libvirt 2>/dev/null
3650 with_libvirt="no (pkg-config doesn't know library)"
3653 if test "x$with_libxml2" = "xyes"
3655 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
3660 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
3666 if test "x$with_libxml2" = "xyes"
3668 SAVE_CPPFLAGS="$CPPFLAGS"
3669 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3671 AC_CHECK_HEADERS(libxml/parser.h, [],
3672 [with_libxml2="no (libxml/parser.h not found)"])
3674 CPPFLAGS="$SAVE_CPPFLAGS"
3676 if test "x$with_libxml2" = "xyes"
3678 SAVE_CFLAGS="$CFLAGS"
3679 SAVE_LDFLAGS="$LDFLAGS"
3681 CFLAGS="$CFLAGS $with_libxml2_cflags"
3682 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3684 AC_CHECK_LIB(xml2, xmlXPathEval,
3685 [with_libxml2="yes"],
3686 [with_libxml2="no (symbol xmlXPathEval not found)"])
3688 CFLAGS="$SAVE_CFLAGS"
3689 LDFLAGS="$SAVE_LDFLAGS"
3691 dnl Add the right compiler flags and libraries.
3692 if test "x$with_libxml2" = "xyes"; then
3693 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3694 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3695 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3696 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3698 if test "x$with_libvirt" = "xyes"
3700 with_libvirt_cflags="`pkg-config --cflags libvirt`"
3705 with_libvirt_ldflags="`pkg-config --libs libvirt`"
3711 if test "x$with_libvirt" = "xyes"
3713 SAVE_CPPFLAGS="$CPPFLAGS"
3714 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3716 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3717 [with_libvirt="no (libvirt/libvirt.h not found)"])
3719 CPPFLAGS="$SAVE_CPPFLAGS"
3721 if test "x$with_libvirt" = "xyes"
3723 SAVE_CFLAGS="$CFLAGS"
3724 SAVE_LDFLAGS="$LDFLAGS"
3726 CFLAGS="$CFLAGS $with_libvirt_cflags"
3727 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3729 AC_CHECK_LIB(virt, virDomainBlockStats,
3730 [with_libvirt="yes"],
3731 [with_libvirt="no (symbol virDomainBlockStats not found)"])
3733 CFLAGS="$SAVE_CFLAGS"
3734 LDFLAGS="$SAVE_LDFLAGS"
3736 dnl Add the right compiler flags and libraries.
3737 if test "x$with_libvirt" = "xyes"; then
3738 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3739 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3740 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3741 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3745 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3746 with_libopenipmipthread="yes"
3747 with_libopenipmipthread_cflags=""
3748 with_libopenipmipthread_libs=""
3750 AC_MSG_CHECKING([for pkg-config])
3752 if test "x$PKG_CONFIG" = "x"
3754 with_libopenipmipthread="no"
3757 temp_result="$PKG_CONFIG"
3759 AC_MSG_RESULT([$temp_result])
3761 if test "x$with_libopenipmipthread" = "xyes"
3763 AC_MSG_CHECKING([for libOpenIPMIpthread])
3764 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3767 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3769 AC_MSG_RESULT([$with_libopenipmipthread])
3772 if test "x$with_libopenipmipthread" = "xyes"
3774 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3775 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3778 with_libopenipmipthread_cflags="$temp_result"
3780 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3781 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3783 AC_MSG_RESULT([$temp_result])
3786 if test "x$with_libopenipmipthread" = "xyes"
3788 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3789 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3792 with_libopenipmipthread_ldflags="$temp_result"
3794 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3795 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3797 AC_MSG_RESULT([$temp_result])
3800 if test "x$with_libopenipmipthread" = "xyes"
3802 SAVE_CPPFLAGS="$CPPFLAGS"
3803 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3805 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3806 [with_libopenipmipthread="yes"],
3807 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3808 [#include <OpenIPMI/ipmiif.h>
3809 #include <OpenIPMI/ipmi_err.h>
3810 #include <OpenIPMI/ipmi_posix.h>
3811 #include <OpenIPMI/ipmi_conn.h>
3814 CPPFLAGS="$SAVE_CPPFLAGS"
3817 if test "x$with_libopenipmipthread" = "xyes"
3819 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3820 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3821 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3822 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3826 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3827 [with_libnotify="yes"],
3828 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3830 # Check for enabled/disabled features
3833 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3834 # ------------------------------------------------------------
3836 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3841 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3846 m4_define([EnDis],[disabled])dnl
3847 m4_define([YesNo],[no])dnl
3853 m4_define([EnDis],[enabled])dnl
3854 m4_define([YesNo],[yes])dnl
3857 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3861 m4_if([$3], [feature], [],
3865 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3871 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3873 enable_$1='[YesNo]'dnl
3875 if test "x$enable_$1" = "xno"
3879 if test "x$enable_$1" = "xyes"
3883 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3888 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3889 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3891 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3893 # AC_PLUGIN(name, default, info)
3894 # ------------------------------------------------------------
3901 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3903 if test "x$enableval" = "xyes"
3906 else if test "x$enableval" = "xforce"
3911 enable_plugin="no (disabled on command line)"
3915 if test "x$enable_all_plugins" = "xauto"
3917 if test "x$2" = "xyes"
3924 enable_plugin="$enable_all_plugins"
3927 if test "x$enable_plugin" = "xyes"
3929 if test "x$2" = "xyes" || test "x$force" = "xyes"
3931 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3932 if test "x$2" != "xyes"
3934 dependency_warning="yes"
3936 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3937 dependency_error="yes"
3938 enable_plugin="no (dependency error)"
3941 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3942 enable_$1="$enable_plugin"
3944 )# AC_PLUGIN(name, default, info)
3946 m4_divert_once([HELP_ENABLE], [
3947 collectd features:])
3948 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3949 AC_COLLECTD([debug], [enable], [feature], [debugging])
3950 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
3951 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
3953 dependency_warning="no"
3954 dependency_error="no"
3959 plugin_conntrack="no"
3960 plugin_contextswitch="no"
3963 plugin_curl_json="no"
3964 plugin_curl_xml="no"
3968 plugin_interface="no"
3975 plugin_multimeter="no"
3979 plugin_processes="no"
3980 plugin_protocols="no"
3984 plugin_tcpconns="no"
3991 plugin_wireless="no"
3995 if test "x$ac_system" = "xLinux"
3997 plugin_battery="yes"
3998 plugin_conntrack="yes"
3999 plugin_contextswitch="yes"
4001 plugin_cpufreq="yes"
4003 plugin_entropy="yes"
4004 plugin_interface="yes"
4009 plugin_fscache="yes"
4010 plugin_processes="yes"
4011 plugin_protocols="yes"
4014 plugin_tcpconns="yes"
4015 plugin_thermal="yes"
4018 plugin_vserver="yes"
4019 plugin_wireless="yes"
4021 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
4027 if test "x$ac_system" = "xOpenBSD"
4029 plugin_tcpconns="yes"
4033 if test "x$with_libiokit" = "xyes"
4035 plugin_battery="yes"
4040 if test "x$with_perfstat" = "xyes"
4046 plugin_interface="yes"
4050 if test "x$with_procinfo" = "xyes"
4052 plugin_processes="yes"
4056 if test "x$with_kstat" = "xyes"
4059 plugin_zfs_arc="yes"
4062 if test "x$with_devinfo$with_kstat" = "xyesyes"
4066 plugin_interface="yes"
4071 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
4077 if test "x$with_libstatgrab" = "xyes"
4081 plugin_interface="yes"
4088 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4094 if test "x$with_libopenipmipthread" = "xyes"
4099 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4101 plugin_curl_json="yes"
4104 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4106 plugin_curl_xml="yes"
4109 if test "x$have_processor_info" = "xyes"
4113 if test "x$have_sysctl" = "xyes"
4120 if test "x$have_sysctlbyname" = "xyes"
4124 plugin_tcpconns="yes"
4127 # Df plugin: Check if we know how to determine mount points first.
4128 #if test "x$have_listmntent" = "xyes"; then
4131 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4135 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4139 #if test "x$have_getmntent" = "xseq"
4143 if test "x$c_cv_have_one_getmntent" = "xyes"
4148 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4149 if test "x$plugin_df" = "xyes"
4152 if test "x$have_statfs" = "xyes"
4156 if test "x$have_statvfs" = "xyes"
4162 if test "x$have_getifaddrs" = "xyes"
4164 plugin_interface="yes"
4167 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4169 plugin_libvirt="yes"
4172 if test "x$have_getloadavg" = "xyes"
4177 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4182 # Mac OS X memory interface
4183 if test "x$have_host_statistics" = "xyes"
4188 if test "x$have_termios_h" = "xyes"
4190 plugin_multimeter="yes"
4194 if test "x$have_thread_info" = "xyes"
4196 plugin_processes="yes"
4199 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4201 plugin_processes="yes"
4204 if test "x$with_kvm_getswapinfo" = "xyes"
4209 if test "x$have_swapctl" = "xyes"
4214 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4216 plugin_tcpconns="yes"
4219 if test "x$have_getutent" = "xyes"
4223 if test "x$have_getutxent" = "xyes"
4228 m4_divert_once([HELP_ENABLE], [
4231 AC_ARG_ENABLE([all-plugins],
4232 AC_HELP_STRING([--enable-all-plugins],
4233 [enable all plugins (auto by def)]),
4235 if test "x$enableval" = "xyes"
4237 enable_all_plugins="yes"
4238 else if test "x$enableval" = "xauto"
4240 enable_all_plugins="auto"
4242 enable_all_plugins="no"
4245 [enable_all_plugins="auto"])
4247 m4_divert_once([HELP_ENABLE], [])
4249 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4250 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4251 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4252 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4253 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4254 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4255 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4256 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4257 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4258 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4259 AC_PLUGIN([csv], [yes], [CSV output plugin])
4260 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4261 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4262 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4263 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4264 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4265 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4266 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4267 AC_PLUGIN([email], [yes], [EMail statistics])
4268 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4269 AC_PLUGIN([exec], [yes], [Execution of external programs])
4270 AC_PLUGIN([filecount], [yes], [Count files in directories])
4271 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4272 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4273 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4274 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4275 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4276 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4277 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4278 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4279 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4280 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4281 AC_PLUGIN([load], [$plugin_load], [System load])
4282 AC_PLUGIN([logfile], [yes], [File logging plugin])
4283 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4284 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4285 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4286 AC_PLUGIN([match_regex], [yes], [The regex match])
4287 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4288 AC_PLUGIN([match_value], [yes], [The value match])
4289 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4290 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4291 AC_PLUGIN([memcached], [yes], [memcached statistics])
4292 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4293 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4294 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4295 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4296 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4297 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4298 AC_PLUGIN([network], [yes], [Network communication plugin])
4299 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4300 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4301 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4302 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4303 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4304 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4305 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4306 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4307 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4308 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4309 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4310 # FIXME: Check for libevent, too.
4311 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4312 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4313 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4314 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4315 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4316 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4317 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4318 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4319 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4320 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4321 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4322 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4323 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4324 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4325 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4326 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4327 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4328 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4329 AC_PLUGIN([target_notification], [yes], [The notification target])
4330 AC_PLUGIN([target_replace], [yes], [The replace target])
4331 AC_PLUGIN([target_scale],[yes], [The scale target])
4332 AC_PLUGIN([target_set], [yes], [The set target])
4333 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4334 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4335 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4336 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4337 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4338 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4339 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4340 AC_PLUGIN([users], [$plugin_users], [User statistics])
4341 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4342 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4343 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4344 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4345 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4346 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4347 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4349 dnl Default configuration file
4350 # Load either syslog or logfile
4351 LOAD_PLUGIN_SYSLOG=""
4352 LOAD_PLUGIN_LOGFILE=""
4354 AC_MSG_CHECKING([which default log plugin to load])
4355 default_log_plugin="none"
4356 if test "x$enable_syslog" = "xyes"
4358 default_log_plugin="syslog"
4360 LOAD_PLUGIN_SYSLOG="##"
4363 if test "x$enable_logfile" = "xyes"
4365 if test "x$default_log_plugin" = "xnone"
4367 default_log_plugin="logfile"
4369 LOAD_PLUGIN_LOGFILE="#"
4372 LOAD_PLUGIN_LOGFILE="##"
4374 AC_MSG_RESULT([$default_log_plugin])
4376 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4377 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4379 DEFAULT_LOG_LEVEL="info"
4380 if test "x$enable_debug" = "xyes"
4382 DEFAULT_LOG_LEVEL="debug"
4384 AC_SUBST(DEFAULT_LOG_LEVEL)
4386 # Load only one of rrdtool, network, csv in the default config.
4387 LOAD_PLUGIN_RRDTOOL=""
4388 LOAD_PLUGIN_NETWORK=""
4391 AC_MSG_CHECKING([which default write plugin to load])
4392 default_write_plugin="none"
4393 if test "x$enable_rrdtool" = "xyes"
4395 default_write_plugin="rrdtool"
4397 LOAD_PLUGIN_RRDTOOL="##"
4400 if test "x$enable_network" = "xyes"
4402 if test "x$default_write_plugin" = "xnone"
4404 default_write_plugin="network"
4406 LOAD_PLUGIN_NETWORK="#"
4409 LOAD_PLUGIN_NETWORK="##"
4412 if test "x$enable_csv" = "xyes"
4414 if test "x$default_write_plugin" = "xnone"
4416 default_write_plugin="csv"
4421 LOAD_PLUGIN_CSV="##"
4423 AC_MSG_RESULT([$default_write_plugin])
4425 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4426 AC_SUBST(LOAD_PLUGIN_NETWORK)
4427 AC_SUBST(LOAD_PLUGIN_CSV)
4430 if test "x$ac_system" = "xLinux" \
4431 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
4433 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4437 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4439 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4441 PERL_BINDINGS_OPTIONS="$withval"
4442 with_perl_bindings="yes"
4444 PERL_BINDINGS_OPTIONS=""
4445 with_perl_bindings="$withval"
4449 PERL_BINDINGS_OPTIONS=""
4450 if test -n "$perl_interpreter"
4452 with_perl_bindings="yes"
4454 with_perl_bindings="no (no perl interpreter found)"
4457 if test "x$with_perl_bindings" = "xyes"
4459 PERL_BINDINGS="perl"
4463 AC_SUBST(PERL_BINDINGS)
4464 AC_SUBST(PERL_BINDINGS_OPTIONS)
4466 dnl libcollectdclient
4467 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4468 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4469 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4471 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4473 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4475 AC_SUBST(LCC_VERSION_MAJOR)
4476 AC_SUBST(LCC_VERSION_MINOR)
4477 AC_SUBST(LCC_VERSION_PATCH)
4478 AC_SUBST(LCC_VERSION_EXTRA)
4479 AC_SUBST(LCC_VERSION_STRING)
4481 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4483 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)
4485 if test "x$with_librrd" = "xyes" \
4486 && test "x$librrd_threadsafe" != "xyes"
4488 with_librrd="yes (warning: librrd is not thread-safe)"
4491 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
4493 with_libiptc="yes (shipped version)"
4496 if test "x$with_libperl" = "xyes"
4498 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4500 enable_perl="no (needs libperl)"
4503 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4505 enable_perl="no (libperl doesn't support ithreads)"
4508 if test "x$with_perl_bindings" = "xyes" \
4509 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4511 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4518 libcurl . . . . . . . $with_libcurl
4519 libdbi . . . . . . . $with_libdbi
4520 libesmtp . . . . . . $with_libesmtp
4521 libganglia . . . . . $with_libganglia
4522 libgcrypt . . . . . . $with_libgcrypt
4523 libiokit . . . . . . $with_libiokit
4524 libiptc . . . . . . . $with_libiptc
4525 libjvm . . . . . . . $with_java
4526 libkstat . . . . . . $with_kstat
4527 libkvm . . . . . . . $with_libkvm
4528 libmemcached . . . . $with_libmemcached
4529 libmodbus . . . . . . $with_libmodbus
4530 libmysql . . . . . . $with_libmysql
4531 libnetapp . . . . . . $with_libnetapp
4532 libnetlink . . . . . $with_libnetlink
4533 libnetsnmp . . . . . $with_libnetsnmp
4534 libnotify . . . . . . $with_libnotify
4535 liboconfig . . . . . $with_liboconfig
4536 libopenipmi . . . . . $with_libopenipmipthread
4537 liboping . . . . . . $with_liboping
4538 libpcap . . . . . . . $with_libpcap
4539 libperfstat . . . . . $with_perfstat
4540 libperl . . . . . . . $with_libperl
4541 libpq . . . . . . . . $with_libpq
4542 libpthread . . . . . $with_libpthread
4543 librouteros . . . . . $with_librouteros
4544 librrd . . . . . . . $with_librrd
4545 libsensors . . . . . $with_libsensors
4546 libstatgrab . . . . . $with_libstatgrab
4547 libtokyotyrant . . . $with_libtokyotyrant
4548 libupsclient . . . . $with_libupsclient
4549 libvirt . . . . . . . $with_libvirt
4550 libxml2 . . . . . . . $with_libxml2
4551 libxmms . . . . . . . $with_libxmms
4552 libyajl . . . . . . . $with_libyajl
4553 libevent . . . . . . $with_libevent
4554 protobuf-c . . . . . $have_protoc_c
4555 oracle . . . . . . . $with_oracle
4556 python . . . . . . . $with_python
4559 daemon mode . . . . . $enable_daemon
4560 debug . . . . . . . . $enable_debug
4563 perl . . . . . . . . $with_perl_bindings
4566 apache . . . . . . . $enable_apache
4567 apcups . . . . . . . $enable_apcups
4568 apple_sensors . . . . $enable_apple_sensors
4569 ascent . . . . . . . $enable_ascent
4570 battery . . . . . . . $enable_battery
4571 bind . . . . . . . . $enable_bind
4572 conntrack . . . . . . $enable_conntrack
4573 contextswitch . . . . $enable_contextswitch
4574 cpu . . . . . . . . . $enable_cpu
4575 cpufreq . . . . . . . $enable_cpufreq
4576 csv . . . . . . . . . $enable_csv
4577 curl . . . . . . . . $enable_curl
4578 curl_json . . . . . . $enable_curl_json
4579 curl_xml . . . . . . $enable_curl_xml
4580 dbi . . . . . . . . . $enable_dbi
4581 df . . . . . . . . . $enable_df
4582 disk . . . . . . . . $enable_disk
4583 dns . . . . . . . . . $enable_dns
4584 email . . . . . . . . $enable_email
4585 entropy . . . . . . . $enable_entropy
4586 exec . . . . . . . . $enable_exec
4587 filecount . . . . . . $enable_filecount
4588 fscache . . . . . . . $enable_fscache
4589 gmond . . . . . . . . $enable_gmond
4590 hddtemp . . . . . . . $enable_hddtemp
4591 interface . . . . . . $enable_interface
4592 ipmi . . . . . . . . $enable_ipmi
4593 iptables . . . . . . $enable_iptables
4594 ipvs . . . . . . . . $enable_ipvs
4595 irq . . . . . . . . . $enable_irq
4596 java . . . . . . . . $enable_java
4597 libvirt . . . . . . . $enable_libvirt
4598 load . . . . . . . . $enable_load
4599 logfile . . . . . . . $enable_logfile
4600 madwifi . . . . . . . $enable_madwifi
4601 match_empty_counter . $enable_match_empty_counter
4602 match_hashed . . . . $enable_match_hashed
4603 match_regex . . . . . $enable_match_regex
4604 match_timediff . . . $enable_match_timediff
4605 match_value . . . . . $enable_match_value
4606 mbmon . . . . . . . . $enable_mbmon
4607 memcachec . . . . . . $enable_memcachec
4608 memcached . . . . . . $enable_memcached
4609 memory . . . . . . . $enable_memory
4610 modbus . . . . . . . $enable_modbus
4611 multimeter . . . . . $enable_multimeter
4612 mysql . . . . . . . . $enable_mysql
4613 netapp . . . . . . . $enable_netapp
4614 netlink . . . . . . . $enable_netlink
4615 network . . . . . . . $enable_network
4616 nfs . . . . . . . . . $enable_nfs
4617 nginx . . . . . . . . $enable_nginx
4618 notify_desktop . . . $enable_notify_desktop
4619 notify_email . . . . $enable_notify_email
4620 ntpd . . . . . . . . $enable_ntpd
4621 nut . . . . . . . . . $enable_nut
4622 olsrd . . . . . . . . $enable_olsrd
4623 onewire . . . . . . . $enable_onewire
4624 openvpn . . . . . . . $enable_openvpn
4625 oracle . . . . . . . $enable_oracle
4626 perl . . . . . . . . $enable_perl
4627 pinba . . . . . . . . $enable_pinba
4628 ping . . . . . . . . $enable_ping
4629 postgresql . . . . . $enable_postgresql
4630 powerdns . . . . . . $enable_powerdns
4631 processes . . . . . . $enable_processes
4632 protocols . . . . . . $enable_protocols
4633 python . . . . . . . $enable_python
4634 routeros . . . . . . $enable_routeros
4635 rrdcached . . . . . . $enable_rrdcached
4636 rrdtool . . . . . . . $enable_rrdtool
4637 sensors . . . . . . . $enable_sensors
4638 serial . . . . . . . $enable_serial
4639 snmp . . . . . . . . $enable_snmp
4640 swap . . . . . . . . $enable_swap
4641 syslog . . . . . . . $enable_syslog
4642 table . . . . . . . . $enable_table
4643 tail . . . . . . . . $enable_tail
4644 tape . . . . . . . . $enable_tape
4645 target_notification . $enable_target_notification
4646 target_replace . . . $enable_target_replace
4647 target_scale . . . . $enable_target_scale
4648 target_set . . . . . $enable_target_set
4649 tcpconns . . . . . . $enable_tcpconns
4650 teamspeak2 . . . . . $enable_teamspeak2
4651 ted . . . . . . . . . $enable_ted
4652 thermal . . . . . . . $enable_thermal
4653 tokyotyrant . . . . . $enable_tokyotyrant
4654 unixsock . . . . . . $enable_unixsock
4655 uptime . . . . . . . $enable_uptime
4656 users . . . . . . . . $enable_users
4657 uuid . . . . . . . . $enable_uuid
4658 vmem . . . . . . . . $enable_vmem
4659 vserver . . . . . . . $enable_vserver
4660 wireless . . . . . . $enable_wireless
4661 write_http . . . . . $enable_write_http
4662 xmms . . . . . . . . $enable_xmms
4663 zfs_arc . . . . . . . $enable_zfs_arc
4667 if test "x$dependency_error" = "xyes"; then
4668 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4671 if test "x$dependency_warning" = "xyes"; then
4672 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4675 # vim: set fdm=marker :