1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, [m4_esyscmd(./version-gen.sh)])
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AC_CONFIG_AUX_DIR([libltdl/config])
7 m4_ifdef([LT_PACKAGE_VERSION],
10 LT_CONFIG_LTDL_DIR([libltdl])
12 LTDL_INIT([convenience])
13 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
18 AC_LIBLTDL_CONVENIENCE
22 AC_CONFIG_SUBDIRS(libltdl)
23 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
27 AM_INIT_AUTOMAKE([tar-pax dist-bzip2])
30 AC_PREFIX_DEFAULT("/opt/collectd")
35 # Checks for programs.
43 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
51 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
52 AC_CHECK_HEADERS([google/protobuf-c/protobuf-c.h],
53 [have_protobuf_c_h="yes"],
54 [have_protobuf_c_h="no"])
55 if test "x$have_protoc_c" = "xyes" && test "x$have_protobuf_c_h" != "xyes"
57 have_protoc_c="no (unable to find <google/protobuf-c/protobuf-c.h>)"
59 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
61 AC_MSG_CHECKING([for kernel type ($host_os)])
64 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
68 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
78 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
84 AC_MSG_RESULT([$ac_system])
86 if test "x$ac_system" = "xLinux"
88 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
89 if test -z "$KERNEL_DIR"
91 KERNEL_DIR="/lib/modules/`uname -r`/source"
94 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
95 AC_SUBST(KERNEL_CFLAGS)
98 if test "x$ac_system" = "xSolaris"
100 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
101 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
103 if test "x$ac_system" = "xAIX"
105 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
108 # Where to install .pc files.
109 pkgconfigdir="${libdir}/pkgconfig"
110 AC_SUBST(pkgconfigdir)
112 # Check for standards compliance mode
113 AC_ARG_ENABLE(standards,
114 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
115 [enable_standards="$enableval"],
116 [enable_standards="no"])
117 if test "x$enable_standards" = "xyes"
119 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
120 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
121 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
122 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
123 if test "x$GCC" = "xyes"
125 CFLAGS="$CFLAGS -std=c99"
128 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
131 # Checks for header files.
138 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 fnmatch.h libgen.h)
141 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
146 # include <sys/types.h>
149 AC_CHECK_HEADERS(netinet/in.h, [], [],
154 # include <sys/types.h>
156 #if HAVE_NETINET_IN_SYSTM_H
157 # include <netinet/in_systm.h>
160 AC_CHECK_HEADERS(netinet/ip.h, [], [],
165 # include <sys/types.h>
167 #if HAVE_NETINET_IN_SYSTM_H
168 # include <netinet/in_systm.h>
170 #if HAVE_NETINET_IN_H
171 # include <netinet/in.h>
174 AC_CHECK_HEADERS(netinet/ip_icmp.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/ip_var.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>
204 #if HAVE_NETINET_IP_H
205 # include <netinet/ip.h>
208 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
213 # include <sys/types.h>
215 #if HAVE_NETINET_IN_SYSTM_H
216 # include <netinet/in_systm.h>
218 #if HAVE_NETINET_IN_H
219 # include <netinet/in.h>
222 AC_CHECK_HEADERS(netinet/icmp6.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_IP6_H
236 # include <netinet/ip6.h>
239 AC_CHECK_HEADERS(netinet/tcp.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>
256 AC_CHECK_HEADERS(netinet/udp.h, [], [],
261 # include <sys/types.h>
263 #if HAVE_NETINET_IN_SYSTM_H
264 # include <netinet/in_systm.h>
266 #if HAVE_NETINET_IN_H
267 # include <netinet/in.h>
269 #if HAVE_NETINET_IP_H
270 # include <netinet/ip.h>
275 AC_CHECK_HEADERS(sys/dkstat.h)
276 if test "x$ac_system" = "xDarwin"
278 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)
279 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
280 # For the battery plugin
281 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
283 #if HAVE_IOKIT_IOKITLIB_H
284 # include <IOKit/IOKitLib.h>
286 #if HAVE_IOKIT_IOTYPES_H
287 # include <IOKit/IOTypes.h>
293 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
296 # include <sys/types.h>
299 # include <sys/param.h>
303 AC_MSG_CHECKING([for sysctl kern.cp_times])
304 if test -x /sbin/sysctl
306 /sbin/sysctl kern.cp_times 2>/dev/null
310 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
311 [Define if sysctl supports kern.cp_times])
320 AC_CHECK_HEADERS(linux/major.h)
322 # For md module (Linux only)
323 if test "x$ac_system" = "xLinux"
325 AC_CHECK_HEADERS(linux/raid/md_u.h,
326 [have_linux_raid_md_u_h="yes"],
327 [have_linux_raid_md_u_h="no"],
329 #include <sys/ioctl.h>
330 #include <linux/major.h>
331 #include <linux/types.h>
334 have_linux_raid_md_u_h="no"
337 # For the swap module
338 have_linux_wireless_h="no"
339 if test "x$ac_system" = "xLinux"
341 AC_CHECK_HEADERS(linux/wireless.h,
342 [have_linux_wireless_h="yes"],
343 [have_linux_wireless_h="no"],
346 #include <sys/ioctl.h>
347 #include <sys/socket.h>
351 # For the swap module
352 have_sys_swap_h="yes"
353 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
355 #undef _FILE_OFFSET_BITS
356 #undef _LARGEFILE64_SOURCE
358 # include <sys/types.h>
361 # include <sys/param.h>
365 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
368 if test "x$GCC" = "xyes"
370 hint_64="CFLAGS='-m64'"
372 hint_64="CFLAGS='-xarch=v9'"
374 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
378 # For the processes plugin
380 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
382 # For interface plugin
383 AC_CHECK_HEADERS(ifaddrs.h)
384 AC_CHECK_HEADERS(net/if.h, [], [],
387 # include <sys/types.h>
389 #if HAVE_SYS_SOCKET_H
390 # include <sys/socket.h>
393 AC_CHECK_HEADERS(linux/if.h, [], [],
396 # include <sys/types.h>
398 #if HAVE_SYS_SOCKET_H
399 # include <sys/socket.h>
402 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
405 # include <sys/types.h>
407 #if HAVE_SYS_SOCKET_H
408 # include <sys/socket.h>
411 # include <linux/if.h>
416 AC_CHECK_HEADERS(linux/sockios.h,
417 [have_linux_sockios_h="yes"],
418 [have_linux_sockios_h="no"],
421 # include <sys/ioctl.h>
427 AC_CHECK_HEADERS(linux/ethtool.h,
428 [have_linux_ethtool_h="yes"],
429 [have_linux_ethtool_h="no"],
432 # include <sys/ioctl.h>
437 #if HAVE_LINUX_SOCKIOS_H
438 # include <linux/sockios.h>
443 have_linux_ip_vs_h="no"
444 have_net_ip_vs_h="no"
446 ip_vs_h_needs_kernel_cflags="no"
447 if test "x$ac_system" = "xLinux"
449 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
450 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
451 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
453 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
455 SAVE_CFLAGS="$CFLAGS"
456 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
458 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
460 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
461 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
462 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
464 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
466 ip_vs_h_needs_kernel_cflags="yes"
469 CFLAGS="$SAVE_CFLAGS"
472 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
475 AC_CHECK_HEADERS(sys/ucred.h, [], [],
478 # include <sys/types.h>
481 # include <sys/param.h>
485 # For mount interface
486 AC_CHECK_HEADERS(sys/mount.h, [], [],
489 # include <sys/types.h>
492 # include <sys/param.h>
496 # For the email plugin
497 AC_CHECK_HEADERS(linux/un.h, [], [],
499 #if HAVE_SYS_SOCKET_H
500 # include <sys/socket.h>
504 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)
507 AC_CHECK_HEADERS(arpa/nameser.h)
508 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
510 #if HAVE_ARPA_NAMESER_H
511 # include <arpa/nameser.h>
515 AC_CHECK_HEADERS(net/if_arp.h, [], [],
516 [#if HAVE_SYS_SOCKET_H
517 # include <sys/socket.h>
520 AC_CHECK_HEADERS(net/ppp_defs.h)
521 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
522 [#if HAVE_NET_PPP_DEFS_H
523 # include <net/ppp_defs.h>
526 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
531 # include <sys/types.h>
533 #if HAVE_SYS_SOCKET_H
534 # include <sys/socket.h>
539 #if HAVE_NETINET_IN_H
540 # include <netinet/in.h>
544 AC_CHECK_HEADERS(netinet/ip_compat.h)
546 have_net_pfvar_h="no"
547 AC_CHECK_HEADERS(net/pfvar.h,
548 [have_net_pfvar_h="yes"],
549 [have_net_pfvar_h="no"],
552 # include <sys/ioctl.h>
554 #if HAVE_SYS_SOCKET_H
555 # include <sys/socket.h>
562 # For the multimeter plugin
564 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
567 # Checks for typedefs, structures, and compiler characteristics.
576 # Checks for library functions.
578 AC_PROG_GCC_TRADITIONAL
579 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
583 SAVE_CFLAGS="$CFLAGS"
584 # Emulate behavior of src/Makefile.am
585 if test "x$GCC" = "xyes"
587 CFLAGS="$CFLAGS -Wall -Werror"
590 AC_CACHE_CHECK([for strtok_r],
591 [c_cv_have_strtok_r_default],
600 char buffer[] = "foo,bar,baz";
607 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
610 printf ("token = %s;\n", token);
614 [c_cv_have_strtok_r_default="yes"],
615 [c_cv_have_strtok_r_default="no"]
619 if test "x$c_cv_have_strtok_r_default" = "xno"
621 CFLAGS="$CFLAGS -D_REENTRANT=1"
623 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
624 [c_cv_have_strtok_r_reentrant],
633 char buffer[] = "foo,bar,baz";
640 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
643 printf ("token = %s;\n", token);
647 [c_cv_have_strtok_r_reentrant="yes"],
648 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
653 CFLAGS="$SAVE_CFLAGS"
654 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
656 CFLAGS="$CFLAGS -D_REENTRANT=1"
659 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
661 socket_needs_socket="no"
662 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
663 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
665 clock_gettime_needs_rt="no"
666 clock_gettime_needs_posix4="no"
667 have_clock_gettime="no"
668 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
669 if test "x$have_clock_gettime" = "xno"
671 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
672 have_clock_gettime="yes"])
674 if test "x$have_clock_gettime" = "xno"
676 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
677 have_clock_gettime="yes"])
679 if test "x$have_clock_gettime" = "xyes"
681 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
683 AC_MSG_WARN(cannot find clock_gettime)
686 nanosleep_needs_rt="no"
687 nanosleep_needs_posix4="no"
688 AC_CHECK_FUNCS(nanosleep,
690 AC_CHECK_LIB(rt, nanosleep,
691 [nanosleep_needs_rt="yes"],
692 AC_CHECK_LIB(posix4, nanosleep,
693 [nanosleep_needs_posix4="yes"],
694 AC_MSG_ERROR(cannot find nanosleep))))
696 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
697 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
699 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
700 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
701 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
702 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
703 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
704 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
705 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
706 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
707 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
708 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
709 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
710 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
712 # Check for strptime {{{
713 if test "x$GCC" = "xyes"
715 SAVE_CFLAGS="$CFLAGS"
716 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
719 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
720 if test "x$have_strptime" = "xyes"
722 AC_CACHE_CHECK([whether strptime is exported by default],
723 [c_cv_have_strptime_default],
724 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
730 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
733 [c_cv_have_strptime_default="yes"],
734 [c_cv_have_strptime_default="no"]))
736 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
738 AC_CACHE_CHECK([whether strptime needs standards mode],
739 [c_cv_have_strptime_standards],
740 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
742 #ifndef _ISOC99_SOURCE
743 # define _ISOC99_SOURCE 1
745 #ifndef _POSIX_C_SOURCE
746 # define _POSIX_C_SOURCE 200112L
748 #ifndef _XOPEN_SOURCE
749 # define _XOPEN_SOURCE 500
755 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
758 [c_cv_have_strptime_standards="yes"],
759 [c_cv_have_strptime_standards="no"]))
761 if test "x$c_cv_have_strptime_standards" = "xyes"
763 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
769 if test "x$GCC" = "xyes"
771 CFLAGS="$SAVE_CFLAGS"
773 # }}} Check for strptime
775 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
776 if test "x$have_swapctl" = "xyes"; then
777 AC_CACHE_CHECK([whether swapctl takes two arguments],
778 [c_cv_have_swapctl_two_args],
779 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
781 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
782 # undef _FILE_OFFSET_BITS
783 # undef _LARGEFILE64_SOURCE
785 #include <sys/stat.h>
786 #include <sys/swap.h>
789 int num = swapctl(0, NULL);
792 [c_cv_have_swapctl_two_args="yes"],
793 [c_cv_have_swapctl_two_args="no"]
796 AC_CACHE_CHECK([whether swapctl takes three arguments],
797 [c_cv_have_swapctl_three_args],
801 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
802 # undef _FILE_OFFSET_BITS
803 # undef _LARGEFILE64_SOURCE
805 #include <sys/stat.h>
806 #include <sys/swap.h>
809 int num = swapctl(0, NULL, 0);
812 [c_cv_have_swapctl_three_args="yes"],
813 [c_cv_have_swapctl_three_args="no"]
817 # Check for different versions of `swapctl' here..
818 if test "x$have_swapctl" = "xyes"; then
819 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
820 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
821 [Define if the function swapctl exists and takes two arguments.])
823 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
824 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
825 [Define if the function swapctl exists and takes three arguments.])
830 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
832 if test "x$withval" = "xno"; then
834 else if test "x$withval" = "xyes"; then
841 if test "x$nan_type" = "xnone"; then
842 AC_CACHE_CHECK([whether NAN is defined by default],
843 [c_cv_have_nan_default],
844 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
848 static double foo = NAN;
857 [c_cv_have_nan_default="yes"],
858 [c_cv_have_nan_default="no"]
861 if test "x$c_cv_have_nan_default" = "xyes"
866 if test "x$nan_type" = "xnone"; then
867 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
868 [c_cv_have_nan_isoc],
869 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
872 #define __USE_ISOC99 1
874 static double foo = NAN;
883 [c_cv_have_nan_isoc="yes"],
884 [c_cv_have_nan_isoc="no"]
887 if test "x$c_cv_have_nan_isoc" = "xyes"
892 if test "x$nan_type" = "xnone"; then
893 SAVE_LDFLAGS=$LDFLAGS
894 LDFLAGS="$LDFLAGS -lm"
895 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
896 [c_cv_have_nan_zero],
897 AC_RUN_IFELSE([AC_LANG_PROGRAM(
904 #define NAN (0.0 / 0.0)
906 # define isnan(f) ((f) != (f))
908 static double foo = NAN;
917 [c_cv_have_nan_zero="yes"],
918 [c_cv_have_nan_zero="no"]
921 LDFLAGS=$SAVE_LDFLAGS
922 if test "x$c_cv_have_nan_zero" = "xyes"
928 if test "x$nan_type" = "xdefault"; then
929 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
930 [Define if NAN is defined by default and can initialize static variables.])
931 else if test "x$nan_type" = "xisoc99"; then
932 AC_DEFINE(NAN_STATIC_ISOC, 1,
933 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
934 else if test "x$nan_type" = "xzero"; then
935 AC_DEFINE(NAN_ZERO_ZERO, 1,
936 [Define if NAN can be defined as (0.0 / 0.0)])
938 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
941 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
943 if test "x$withval" = "xnothing"; then
944 fp_layout_type="nothing"
945 else if test "x$withval" = "xendianflip"; then
946 fp_layout_type="endianflip"
947 else if test "x$withval" = "xintswap"; then
948 fp_layout_type="intswap"
950 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
953 [fp_layout_type="unknown"])
955 if test "x$fp_layout_type" = "xunknown"; then
956 AC_CACHE_CHECK([if doubles are stored in x86 representation],
957 [c_cv_fp_layout_need_nothing],
958 AC_RUN_IFELSE([AC_LANG_PROGRAM(
967 # include <inttypes.h>
970 # include <stdbool.h>
980 memcpy ((void *) &i0, (void *) &d, 8);
983 memcpy ((void *) c, (void *) &i1, 8);
985 if ((c[0] == 0x2f) && (c[1] == 0x25)
986 && (c[2] == 0xc0) && (c[3] == 0xc7)
987 && (c[4] == 0x43) && (c[5] == 0x2b)
988 && (c[6] == 0x1f) && (c[7] == 0x5b))
994 [c_cv_fp_layout_need_nothing="yes"],
995 [c_cv_fp_layout_need_nothing="no"]
998 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
999 fp_layout_type="nothing"
1002 if test "x$fp_layout_type" = "xunknown"; then
1003 AC_CACHE_CHECK([if endianflip converts to x86 representation],
1004 [c_cv_fp_layout_need_endianflip],
1005 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1011 # include <stdint.h>
1014 # include <inttypes.h>
1017 # include <stdbool.h>
1019 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
1020 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
1021 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1022 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
1023 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
1024 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1025 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1026 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1035 memcpy ((void *) &i0, (void *) &d, 8);
1037 i1 = endianflip (i0);
1038 memcpy ((void *) c, (void *) &i1, 8);
1040 if ((c[0] == 0x2f) && (c[1] == 0x25)
1041 && (c[2] == 0xc0) && (c[3] == 0xc7)
1042 && (c[4] == 0x43) && (c[5] == 0x2b)
1043 && (c[6] == 0x1f) && (c[7] == 0x5b))
1049 [c_cv_fp_layout_need_endianflip="yes"],
1050 [c_cv_fp_layout_need_endianflip="no"]
1053 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1054 fp_layout_type="endianflip"
1057 if test "x$fp_layout_type" = "xunknown"; then
1058 AC_CACHE_CHECK([if intswap converts to x86 representation],
1059 [c_cv_fp_layout_need_intswap],
1060 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1066 # include <stdint.h>
1069 # include <inttypes.h>
1072 # include <stdbool.h>
1074 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1075 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1084 memcpy ((void *) &i0, (void *) &d, 8);
1087 memcpy ((void *) c, (void *) &i1, 8);
1089 if ((c[0] == 0x2f) && (c[1] == 0x25)
1090 && (c[2] == 0xc0) && (c[3] == 0xc7)
1091 && (c[4] == 0x43) && (c[5] == 0x2b)
1092 && (c[6] == 0x1f) && (c[7] == 0x5b))
1098 [c_cv_fp_layout_need_intswap="yes"],
1099 [c_cv_fp_layout_need_intswap="no"]
1102 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1103 fp_layout_type="intswap"
1107 if test "x$fp_layout_type" = "xnothing"; then
1108 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1109 [Define if doubles are stored in x86 representation.])
1110 else if test "x$fp_layout_type" = "xendianflip"; then
1111 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1112 [Define if endianflip is needed to convert to x86 representation.])
1113 else if test "x$fp_layout_type" = "xintswap"; then
1114 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1115 [Define if intswap is needed to convert to x86 representation.])
1117 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1121 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1122 have_getvfsstat="no"
1123 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1124 have_listmntent="no"
1125 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1128 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1129 if test "x$have_getmntent" = "xno"; then
1130 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1132 if test "x$have_getmntent" = "xno"; then
1133 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1135 if test "x$have_getmntent" = "xno"; then
1136 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1139 if test "x$have_getmntent" = "xc"; then
1140 AC_CACHE_CHECK([whether getmntent takes one argument],
1141 [c_cv_have_one_getmntent],
1145 #include "$srcdir/src/utils_mount.h"
1150 fh = setmntent ("/etc/mtab", "r");
1151 me = getmntent (fh);
1154 [c_cv_have_one_getmntent="yes"],
1155 [c_cv_have_one_getmntent="no"]
1158 AC_CACHE_CHECK([whether getmntent takes two arguments],
1159 [c_cv_have_two_getmntent],
1163 #include "$srcdir/src/utils_mount.h"
1169 fh = fopen ("/etc/mnttab", "r");
1170 status = getmntent (fh, &mt);
1173 [c_cv_have_two_getmntent="yes"],
1174 [c_cv_have_two_getmntent="no"]
1179 # Check for different versions of `getmntent' here..
1181 if test "x$have_getmntent" = "xc"; then
1182 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1183 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1184 [Define if the function getmntent exists and takes one argument.])
1186 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1187 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1188 [Define if the function getmntent exists and takes two arguments.])
1191 if test "x$have_getmntent" = "xsun"; then
1192 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1193 [Define if the function getmntent exists. It's the version from libsun.])
1195 if test "x$have_getmntent" = "xseq"; then
1196 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1197 [Define if the function getmntent exists. It's the version from libseq.])
1199 if test "x$have_getmntent" = "xgen"; then
1200 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1201 [Define if the function getmntent exists. It's the version from libgen.])
1205 AC_MSG_CHECKING([if have htonll defined])
1208 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1210 #include <sys/types.h>
1211 #include <netinet/in.h>
1213 # include <inttypes.h>
1222 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1225 AC_MSG_RESULT([$have_htonll])
1227 # Check for structures
1228 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1229 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1232 #include <sys/types.h>
1233 #include <sys/socket.h>
1236 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1237 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1240 #include <sys/types.h>
1241 #include <sys/socket.h>
1242 #include <linux/if.h>
1243 #include <linux/netdevice.h>
1246 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1249 #include <netinet/in.h>
1253 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1255 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1256 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1257 have_struct_kinfo_proc_freebsd="yes"
1260 have_struct_kinfo_proc_freebsd="no"
1264 #include <sys/param.h>
1265 #include <sys/sysctl.h>
1266 #include <sys/user.h>
1269 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1271 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1272 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1273 have_struct_kinfo_proc_openbsd="yes"
1276 have_struct_kinfo_proc_openbsd="no"
1279 #include <sys/param.h>
1280 #include <sys/sysctl.h>
1284 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1285 [#define _BSD_SOURCE
1287 # include <stdint.h>
1289 #if HAVE_SYS_TYPES_H
1290 # include <sys/types.h>
1292 #if HAVE_NETINET_IN_SYSTM_H
1293 # include <netinet/in_systm.h>
1295 #if HAVE_NETINET_IN_H
1296 # include <netinet/in.h>
1298 #if HAVE_NETINET_IP_H
1299 # include <netinet/ip.h>
1301 #if HAVE_NETINET_UDP_H
1302 # include <netinet/udp.h>
1305 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1306 [#define _BSD_SOURCE
1308 # include <stdint.h>
1310 #if HAVE_SYS_TYPES_H
1311 # include <sys/types.h>
1313 #if HAVE_NETINET_IN_SYSTM_H
1314 # include <netinet/in_systm.h>
1316 #if HAVE_NETINET_IN_H
1317 # include <netinet/in.h>
1319 #if HAVE_NETINET_IP_H
1320 # include <netinet/ip.h>
1322 #if HAVE_NETINET_UDP_H
1323 # include <netinet/udp.h>
1327 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1337 # Checks for libraries begin here
1340 with_libresolv="yes"
1341 AC_CHECK_LIB(resolv, res_search,
1343 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1345 [with_libresolv="no"])
1346 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1348 dnl Check for HAL (hardware abstraction library)
1350 AC_CHECK_LIB(hal,libhal_device_property_exists,
1351 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1353 if test "x$with_libhal" = "xyes"; then
1354 if test "x$PKG_CONFIG" != "x"; then
1355 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1356 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1357 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1358 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1362 m4_divert_once([HELP_WITH], [
1363 collectd additional packages:])
1365 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1367 if test "x$ac_system" = "xAIX"
1372 with_perfstat="no (AIX only)"
1373 with_procinfo="no (AIX only)"
1376 if test "x$with_perfstat" = "xyes"
1378 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1379 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1381 if test "x$with_perfstat" = "xyes"
1383 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1384 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1385 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1386 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1388 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1391 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1393 # Processes plugin under AIX.
1394 if test "x$with_procinfo" = "xyes"
1396 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1398 if test "x$with_procinfo" = "xyes"
1400 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1403 if test "x$ac_system" = "xSolaris"
1408 with_kstat="no (Solaris only)"
1409 with_devinfo="no (Solaris only)"
1412 if test "x$with_kstat" = "xyes"
1414 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1416 if test "x$with_kstat" = "xyes"
1418 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1419 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1421 if test "x$with_kstat" = "xyes"
1423 AC_DEFINE(HAVE_LIBKSTAT, 1,
1424 [Define to 1 if you have the 'kstat' library (-lkstat)])
1426 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1427 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1430 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1437 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1440 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1441 if test "x$with_kvm_getprocs" = "xyes"
1443 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1444 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1447 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1449 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1450 if test "x$with_kvm_getswapinfo" = "xyes"
1452 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1453 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1456 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1458 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1459 if test "x$with_kvm_nlist" = "xyes"
1461 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1462 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1463 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1466 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1468 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1469 if test "x$with_kvm_openfiles" = "xyes"
1471 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1472 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1475 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1477 # --with-libcredis {{{
1478 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1480 if test "x$withval" = "xyes"
1482 with_libcredis="yes"
1483 else if test "x$withval" = "xno"
1487 with_libcredis="yes"
1488 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1489 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1492 [with_libcredis="yes"])
1494 SAVE_CPPFLAGS="$CPPFLAGS"
1495 SAVE_LDFLAGS="$LDFLAGS"
1497 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1498 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1500 if test "x$with_libcredis" = "xyes"
1502 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1504 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1506 AC_CHECK_HEADERS(credis.h,
1507 [with_libcredis="yes"],
1508 [with_libcredis="no (credis.h not found)"])
1510 if test "x$with_libcredis" = "xyes"
1512 if test "x$LIBCREDIS_LDFLAGS" != "x"
1514 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1516 AC_CHECK_LIB(credis, credis_info,
1517 [with_libcredis="yes"],
1518 [with_libcredis="no (symbol 'credis_info' not found)"])
1522 CPPFLAGS="$SAVE_CPPFLAGS"
1523 LDFLAGS="$SAVE_LDFLAGS"
1525 if test "x$with_libcredis" = "xyes"
1527 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1528 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1529 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1530 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1532 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1535 # --with-libcurl {{{
1536 with_curl_config="curl-config"
1539 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1541 if test "x$withval" = "xno"
1544 else if test "x$withval" = "xyes"
1548 if test -f "$withval" && test -x "$withval"
1550 with_curl_config="$withval"
1552 else if test -x "$withval/bin/curl-config"
1554 with_curl_config="$withval/bin/curl-config"
1563 if test "x$with_libcurl" = "xyes"
1565 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1566 curl_config_status=$?
1568 if test $curl_config_status -ne 0
1570 with_libcurl="no ($with_curl_config failed)"
1572 SAVE_CPPFLAGS="$CPPFLAGS"
1573 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1575 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1577 CPPFLAGS="$SAVE_CPPFLAGS"
1580 if test "x$with_libcurl" = "xyes"
1582 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1583 curl_config_status=$?
1585 if test $curl_config_status -ne 0
1587 with_libcurl="no ($with_curl_config failed)"
1589 AC_CHECK_LIB(curl, curl_easy_init,
1590 [with_libcurl="yes"],
1591 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1595 if test "x$with_libcurl" = "xyes"
1597 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1598 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1599 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1600 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1602 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1607 with_libdbi_cppflags=""
1608 with_libdbi_ldflags=""
1609 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1611 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1613 with_libdbi_cppflags="-I$withval/include"
1614 with_libdbi_ldflags="-L$withval/lib"
1617 with_libdbi="$withval"
1623 if test "x$with_libdbi" = "xyes"
1625 SAVE_CPPFLAGS="$CPPFLAGS"
1626 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1628 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1630 CPPFLAGS="$SAVE_CPPFLAGS"
1632 if test "x$with_libdbi" = "xyes"
1634 SAVE_CPPFLAGS="$CPPFLAGS"
1635 SAVE_LDFLAGS="$LDFLAGS"
1636 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1637 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1639 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1641 CPPFLAGS="$SAVE_CPPFLAGS"
1642 LDFLAGS="$SAVE_LDFLAGS"
1644 if test "x$with_libdbi" = "xyes"
1646 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1647 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1648 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1649 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1650 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1651 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1653 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1656 # --with-libesmtp {{{
1657 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1659 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1661 LDFLAGS="$LDFLAGS -L$withval/lib"
1662 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1665 with_libesmtp="$withval"
1671 if test "x$with_libesmtp" = "xyes"
1673 AC_CHECK_LIB(esmtp, smtp_create_session,
1675 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1676 ], [with_libesmtp="no (libesmtp not found)"])
1678 if test "x$with_libesmtp" = "xyes"
1680 AC_CHECK_HEADERS(libesmtp.h,
1682 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1683 ], [with_libesmtp="no (libesmtp.h not found)"])
1685 if test "x$with_libesmtp" = "xyes"
1691 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1692 [Wether or not to use the esmtp library])
1693 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1696 # --with-libganglia {{{
1697 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1699 if test -f "$withval" && test -x "$withval"
1701 with_libganglia_config="$withval"
1702 with_libganglia="yes"
1703 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1705 with_libganglia_config="$withval/bin/ganglia-config"
1706 with_libganglia="yes"
1707 else if test -d "$withval"
1709 GANGLIA_CPPFLAGS="-I$withval/include"
1710 GANGLIA_LDFLAGS="-L$withval/lib"
1711 with_libganglia="yes"
1713 with_libganglia_config="ganglia-config"
1714 with_libganglia="$withval"
1718 with_libganglia_config="ganglia-config"
1719 with_libganglia="yes"
1722 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1724 if test "x$GANGLIA_CPPFLAGS" = "x"
1726 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1729 if test "x$GANGLIA_LDFLAGS" = "x"
1731 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1734 if test "x$GANGLIA_LIBS" = "x"
1736 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1740 SAVE_CPPFLAGS="$CPPFLAGS"
1741 SAVE_LDFLAGS="$LDFLAGS"
1742 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1743 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1745 if test "x$with_libganglia" = "xyes"
1747 AC_CHECK_HEADERS(gm_protocol.h,
1749 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1750 [Define to 1 if you have the <gm_protocol.h> header file.])
1751 ], [with_libganglia="no (gm_protocol.h not found)"])
1754 if test "x$with_libganglia" = "xyes"
1756 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1758 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1759 [Define to 1 if you have the ganglia library (-lganglia).])
1760 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1763 CPPFLAGS="$SAVE_CPPFLAGS"
1764 LDFLAGS="$SAVE_LDFLAGS"
1766 AC_SUBST(GANGLIA_CPPFLAGS)
1767 AC_SUBST(GANGLIA_LDFLAGS)
1768 AC_SUBST(GANGLIA_LIBS)
1769 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1773 # --with-libgcrypt {{{
1774 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1775 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1776 GCRYPT_LIBS="$GCRYPT_LIBS"
1777 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1779 if test -f "$withval" && test -x "$withval"
1781 with_libgcrypt_config="$withval"
1782 with_libgcrypt="yes"
1783 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1785 with_libgcrypt_config="$withval/bin/gcrypt-config"
1786 with_libgcrypt="yes"
1787 else if test -d "$withval"
1789 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1790 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1791 with_libgcrypt="yes"
1793 with_libgcrypt_config="gcrypt-config"
1794 with_libgcrypt="$withval"
1798 with_libgcrypt_config="libgcrypt-config"
1799 with_libgcrypt="yes"
1802 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1804 if test "x$GCRYPT_CPPFLAGS" = "x"
1806 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1809 if test "x$GCRYPT_LDFLAGS" = "x"
1811 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1812 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1815 if test "x$GCRYPT_LIBS" = "x"
1817 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1821 SAVE_CPPFLAGS="$CPPFLAGS"
1822 SAVE_LDFLAGS="$LDFLAGS"
1823 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1824 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1826 if test "x$with_libgcrypt" = "xyes"
1828 if test "x$GCRYPT_CPPFLAGS" != "x"
1830 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1832 AC_CHECK_HEADERS(gcrypt.h,
1833 [with_libgcrypt="yes"],
1834 [with_libgcrypt="no (gcrypt.h not found)"])
1837 if test "x$with_libgcrypt" = "xyes"
1839 if test "x$GCRYPT_LDFLAGS" != "x"
1841 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1843 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1844 [with_libgcrypt="yes"],
1845 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1847 if test "$with_libgcrypt" != "no"; then
1848 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1849 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
1850 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
1854 CPPFLAGS="$SAVE_CPPFLAGS"
1855 LDFLAGS="$SAVE_LDFLAGS"
1857 if test "x$with_libgcrypt" = "xyes"
1859 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1862 AC_SUBST(GCRYPT_CPPFLAGS)
1863 AC_SUBST(GCRYPT_LDFLAGS)
1864 AC_SUBST(GCRYPT_LIBS)
1865 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1868 # --with-libiptc {{{
1869 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1871 if test "x$withval" = "xshipped"
1874 else if test "x$withval" = "xyes"
1876 with_libiptc="pkgconfig"
1877 else if test "x$withval" = "xno"
1882 with_libiptc_cflags="-I$withval/include"
1883 with_libiptc_libs="-L$withval/lib"
1887 if test "x$ac_system" = "xLinux"
1889 with_libiptc="pkgconfig"
1891 with_libiptc="no (Linux only)"
1895 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1897 with_libiptc="no (Don't have pkg-config)"
1900 if test "x$with_libiptc" = "xpkgconfig"
1902 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1905 with_libiptc="no (pkg-config doesn't know libiptc)"
1908 if test "x$with_libiptc" = "xpkgconfig"
1910 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1913 with_libiptc="no ($PKG_CONFIG failed)"
1915 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1918 with_libiptc="no ($PKG_CONFIG failed)"
1922 SAVE_CPPFLAGS="$CPPFLAGS"
1923 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1925 # check whether the header file for libiptc is available.
1926 if test "x$with_libiptc" = "xpkgconfig"
1928 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1929 [with_libiptc="no (header file missing)"])
1931 # If the header file is available, check for the required type declaractions.
1932 # They may be missing in old versions of libiptc. In that case, they will be
1933 # declared in the iptables plugin.
1934 if test "x$with_libiptc" = "xpkgconfig"
1936 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1938 # Check for the iptc_init symbol in the library.
1939 # This could be in iptc or ip4tc
1940 if test "x$with_libiptc" = "xpkgconfig"
1943 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1944 [with_libiptc="pkgconfig"],
1945 [with_libiptc="no"],
1946 [$with_libiptc_libs])
1949 if test "x$with_libiptc" = "xpkgconfig"
1954 CPPFLAGS="$SAVE_CPPFLAGS"
1956 if test "x$with_libiptc" = "xown"
1958 with_libiptc_cflags=""
1959 with_libiptc_libs=""
1961 if test "x$with_libiptc" = "xown"
1963 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1965 with_libiptc="no (Linux iptables headers not found)"
1968 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1971 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1972 if test "x$with_libiptc" = "xown"
1974 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1978 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1979 if test "x$with_libiptc" = "xyes"
1981 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1982 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1983 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1984 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1989 with_java_home="$JAVA_HOME"
1990 with_java_vmtype="client"
1995 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1997 if test "x$withval" = "xno"
2000 else if test "x$withval" = "xyes"
2004 with_java_home="$withval"
2009 if test "x$with_java" = "xyes"
2011 if test -d "$with_java_home"
2013 AC_MSG_CHECKING([for jni.h])
2014 TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2015 if test "x$TMPVAR" != "x"
2017 AC_MSG_RESULT([found in $TMPVAR])
2018 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2020 AC_MSG_RESULT([not found])
2023 AC_MSG_CHECKING([for jni_md.h])
2024 TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2025 if test "x$TMPVAR" != "x"
2027 AC_MSG_RESULT([found in $TMPVAR])
2028 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2030 AC_MSG_RESULT([not found])
2033 AC_MSG_CHECKING([for libjvm.so])
2034 TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2035 if test "x$TMPVAR" != "x"
2037 AC_MSG_RESULT([found in $TMPVAR])
2038 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
2040 AC_MSG_RESULT([not found])
2043 if test "x$JAVAC" = "x"
2045 AC_MSG_CHECKING([for javac])
2046 TMPVAR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2047 if test "x$TMPVAR" != "x"
2050 AC_MSG_RESULT([$JAVAC])
2052 AC_MSG_RESULT([not found])
2055 if test "x$JAR" = "x"
2057 AC_MSG_CHECKING([for jar])
2058 TMPVAR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2059 if test "x$TMPVAR" != "x"
2062 AC_MSG_RESULT([$JAR])
2064 AC_MSG_RESULT([not found])
2067 else if test "x$with_java_home" != "x"
2069 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2073 if test "x$JAVA_CPPFLAGS" != "x"
2075 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2077 if test "x$JAVA_CFLAGS" != "x"
2079 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2081 if test "x$JAVA_LDFLAGS" != "x"
2083 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2085 if test "x$JAVAC" = "x"
2087 with_javac_path="$PATH"
2088 if test "x$with_java_home" != "x"
2090 with_javac_path="$with_java_home:with_javac_path"
2091 if test -d "$with_java_home/bin"
2093 with_javac_path="$with_java_home/bin:with_javac_path"
2097 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2099 if test "x$JAVAC" = "x"
2101 with_java="no (javac not found)"
2103 if test "x$JAR" = "x"
2105 with_jar_path="$PATH"
2106 if test "x$with_java_home" != "x"
2108 with_jar_path="$with_java_home:$with_jar_path"
2109 if test -d "$with_java_home/bin"
2111 with_jar_path="$with_java_home/bin:$with_jar_path"
2115 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2117 if test "x$JAR" = "x"
2119 with_java="no (jar not found)"
2122 SAVE_CPPFLAGS="$CPPFLAGS"
2123 SAVE_CFLAGS="$CFLAGS"
2124 SAVE_LDFLAGS="$LDFLAGS"
2125 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2126 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2127 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2129 if test "x$with_java" = "xyes"
2131 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2133 if test "x$with_java" = "xyes"
2135 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2137 [with_java="no (libjvm not found)"],
2140 if test "x$with_java" = "xyes"
2142 JAVA_LIBS="$JAVA_LIBS -ljvm"
2143 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2146 CPPFLAGS="$SAVE_CPPFLAGS"
2147 CFLAGS="$SAVE_CFLAGS"
2148 LDFLAGS="$SAVE_LDFLAGS"
2150 AC_SUBST(JAVA_CPPFLAGS)
2151 AC_SUBST(JAVA_CFLAGS)
2152 AC_SUBST(JAVA_LDFLAGS)
2154 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2157 # --with-libmemcached {{{
2158 with_libmemcached_cppflags=""
2159 with_libmemcached_ldflags=""
2160 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2162 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2164 with_libmemcached_cppflags="-I$withval/include"
2165 with_libmemcached_ldflags="-L$withval/lib"
2166 with_libmemcached="yes"
2168 with_libmemcached="$withval"
2172 with_libmemcached="yes"
2174 if test "x$with_libmemcached" = "xyes"
2176 SAVE_CPPFLAGS="$CPPFLAGS"
2177 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2179 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2181 CPPFLAGS="$SAVE_CPPFLAGS"
2183 if test "x$with_libmemcached" = "xyes"
2185 SAVE_CPPFLAGS="$CPPFLAGS"
2186 SAVE_LDFLAGS="$LDFLAGS"
2187 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2188 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2190 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2192 CPPFLAGS="$SAVE_CPPFLAGS"
2193 LDFLAGS="$SAVE_LDFLAGS"
2195 if test "x$with_libmemcached" = "xyes"
2197 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2198 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2199 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2200 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2201 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2202 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2203 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2205 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2208 # --with-libmodbus {{{
2209 with_libmodbus_config=""
2210 with_libmodbus_cflags=""
2211 with_libmodbus_libs=""
2212 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2214 if test "x$withval" = "xno"
2217 else if test "x$withval" = "xyes"
2219 with_libmodbus="use_pkgconfig"
2220 else if test -d "$with_libmodbus/lib"
2222 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2223 with_libmodbus_cflags="-I$withval/include"
2224 with_libmodbus_libs="-L$withval/lib -lmodbus"
2225 with_libmodbus="yes"
2228 [with_libmodbus="use_pkgconfig"])
2230 # configure using pkg-config
2231 if test "x$with_libmodbus" = "xuse_pkgconfig"
2233 if test "x$PKG_CONFIG" = "x"
2235 with_libmodbus="no (Don't have pkg-config)"
2238 if test "x$with_libmodbus" = "xuse_pkgconfig"
2240 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2241 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2244 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2247 if test "x$with_libmodbus" = "xuse_pkgconfig"
2249 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2252 with_libmodbus="no ($PKG_CONFIG failed)"
2254 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2257 with_libmodbus="no ($PKG_CONFIG failed)"
2260 if test "x$with_libmodbus" = "xuse_pkgconfig"
2262 with_libmodbus="yes"
2265 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2266 # the actual checks.
2267 if test "x$with_libmodbus" = "xyes"
2269 SAVE_CPPFLAGS="$CPPFLAGS"
2270 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2272 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2274 CPPFLAGS="$SAVE_CPPFLAGS"
2276 if test "x$with_libmodbus" = "xyes"
2278 SAVE_CPPFLAGS="$CPPFLAGS"
2279 SAVE_LDFLAGS="$LDFLAGS"
2281 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2282 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2284 AC_CHECK_LIB(modbus, modbus_connect,
2285 [with_libmodbus="yes"],
2286 [with_libmodbus="no (symbol modbus_connect not found)"])
2288 CPPFLAGS="$SAVE_CPPFLAGS"
2289 LDFLAGS="$SAVE_LDFLAGS"
2291 if test "x$with_libmodbus" = "xyes"
2293 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2294 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2295 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2296 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2300 # --with-libmongoc {{{
2301 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2303 if test "x$withval" = "xyes"
2305 with_libmongoc="yes"
2306 else if test "x$withval" = "xno"
2310 with_libmongoc="yes"
2311 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2312 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2315 [with_libmongoc="yes"])
2317 SAVE_CPPFLAGS="$CPPFLAGS"
2318 SAVE_LDFLAGS="$LDFLAGS"
2320 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2321 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2323 if test "x$with_libmongoc" = "xyes"
2325 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2327 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2329 AC_CHECK_HEADERS(mongo.h,
2330 [with_libmongoc="yes"],
2331 [with_libmongoc="no ('mongo.h' not found)"],
2333 # define MONGO_HAVE_STDINT 1
2335 # define MONGO_USE_LONG_LONG_INT 1
2339 if test "x$with_libmongoc" = "xyes"
2341 if test "x$LIBMONGOC_LDFLAGS" != "x"
2343 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2345 AC_CHECK_LIB(mongoc, mongo_run_command,
2346 [with_libmongoc="yes"],
2347 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2350 CPPFLAGS="$SAVE_CPPFLAGS"
2351 LDFLAGS="$SAVE_LDFLAGS"
2353 if test "x$with_libmongoc" = "xyes"
2355 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2356 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2357 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2358 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2360 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2363 # --with-libmysql {{{
2364 with_mysql_config="mysql_config"
2365 with_mysql_cflags=""
2367 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2369 if test "x$withval" = "xno"
2372 else if test "x$withval" = "xyes"
2376 if test -f "$withval" && test -x "$withval";
2378 with_mysql_config="$withval"
2379 else if test -x "$withval/bin/mysql_config"
2381 with_mysql_config="$withval/bin/mysql_config"
2389 if test "x$with_libmysql" = "xyes"
2391 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2392 mysql_config_status=$?
2394 if test $mysql_config_status -ne 0
2396 with_libmysql="no ($with_mysql_config failed)"
2398 SAVE_CPPFLAGS="$CPPFLAGS"
2399 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2402 have_mysql_mysql_h="no"
2403 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2405 if test "x$have_mysql_h" = "xno"
2407 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2410 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2412 with_libmysql="no (mysql.h not found)"
2415 CPPFLAGS="$SAVE_CPPFLAGS"
2418 if test "x$with_libmysql" = "xyes"
2420 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2421 mysql_config_status=$?
2423 if test $mysql_config_status -ne 0
2425 with_libmysql="no ($with_mysql_config failed)"
2427 AC_CHECK_LIB(mysqlclient, mysql_init,
2428 [with_libmysql="yes"],
2429 [with_libmysql="no (symbol 'mysql_init' not found)"],
2432 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2433 [with_libmysql="yes"],
2434 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2438 if test "x$with_libmysql" = "xyes"
2440 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2441 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2442 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2443 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2445 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2448 # --with-libnetlink {{{
2449 with_libnetlink_cflags=""
2450 with_libnetlink_libs="-lnetlink"
2451 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2453 echo "libnetlink: withval = $withval"
2454 if test "x$withval" = "xyes"
2456 with_libnetlink="yes"
2457 else if test "x$withval" = "xno"
2459 with_libnetlink="no"
2461 if test -d "$withval/include"
2463 with_libnetlink_cflags="-I$withval/include"
2464 with_libnetlink_libs="-L$withval/lib -lnetlink"
2465 with_libnetlink="yes"
2467 AC_MSG_ERROR("no such directory: $withval/include")
2472 if test "x$ac_system" = "xLinux"
2474 with_libnetlink="yes"
2476 with_libnetlink="no (Linux only library)"
2479 if test "x$with_libnetlink" = "xyes"
2481 SAVE_CFLAGS="$CFLAGS"
2482 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2484 with_libnetlink="no (libnetlink.h not found)"
2486 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2488 with_libnetlink="yes"
2492 #include <sys/types.h>
2493 #include <asm/types.h>
2494 #include <sys/socket.h>
2495 #include <linux/netlink.h>
2496 #include <linux/rtnetlink.h>])
2497 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2499 #include <sys/types.h>
2500 #include <asm/types.h>
2501 #include <sys/socket.h>])
2503 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2506 #include <sys/types.h>
2507 #include <asm/types.h>
2508 #include <sys/socket.h>
2509 #include <linux/netlink.h>
2510 #include <linux/rtnetlink.h>
2513 int retval = TCA_STATS2;
2517 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2519 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2522 #include <sys/types.h>
2523 #include <asm/types.h>
2524 #include <sys/socket.h>
2525 #include <linux/netlink.h>
2526 #include <linux/rtnetlink.h>
2529 int retval = TCA_STATS;
2533 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2535 CFLAGS="$SAVE_CFLAGS"
2537 if test "x$with_libnetlink" = "xyes"
2539 AC_CHECK_LIB(netlink, rtnl_open,
2540 [with_libnetlink="yes"],
2541 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2542 [$with_libnetlink_libs])
2544 if test "x$with_libnetlink" = "xyes"
2546 SAVE_CFLAGS="$CFLAGS"
2547 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2550 [if function 'rtnl_dump_filter' expects five arguments],
2551 [c_cv_rtnl_dump_filter_five_args],
2552 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2555 #include <sys/types.h>
2556 #include <asm/types.h>
2557 #include <sys/socket.h>
2558 #if HAVE_LIBNETLINK_H
2559 # include <libnetlink.h>
2560 #elif HAVE_IPROUTE_LIBNETLINK_H
2561 # include <iproute/libnetlink.h>
2562 #elif HAVE_LINUX_LIBNETLINK_H
2563 # include <linux/libnetlink.h>
2567 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2572 [c_cv_rtnl_dump_filter_five_args="yes"],
2573 [c_cv_rtnl_dump_filter_five_args="no"]
2578 [if function 'rtnl_dump_filter' expects three arguments],
2579 [c_cv_rtnl_dump_filter_three_args],
2580 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2583 #include <sys/types.h>
2584 #include <asm/types.h>
2585 #include <sys/socket.h>
2586 #if HAVE_LIBNETLINK_H
2587 # include <libnetlink.h>
2588 #elif HAVE_IPROUTE_LIBNETLINK_H
2589 # include <iproute/libnetlink.h>
2590 #elif HAVE_LINUX_LIBNETLINK_H
2591 # include <linux/libnetlink.h>
2595 if (rtnl_dump_filter(NULL, NULL, NULL))
2600 [c_cv_rtnl_dump_filter_three_args="yes"],
2601 [c_cv_rtnl_dump_filter_three_args="no"]
2605 CFLAGS="$SAVE_CFLAGS"
2607 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2609 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2610 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2612 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2614 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2615 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2618 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2619 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2620 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2621 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2623 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2626 # --with-libnetapp {{{
2627 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2628 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2629 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2630 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2631 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2632 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2633 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2635 if test -d "$withval"
2637 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2638 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2639 with_libnetapp="yes"
2641 with_libnetapp="$withval"
2645 with_libnetapp="yes"
2648 SAVE_CPPFLAGS="$CPPFLAGS"
2649 SAVE_LDFLAGS="$LDFLAGS"
2650 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2651 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2653 if test "x$with_libnetapp" = "xyes"
2655 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2657 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2659 AC_CHECK_HEADERS(netapp_api.h,
2660 [with_libnetapp="yes"],
2661 [with_libnetapp="no (netapp_api.h not found)"])
2664 if test "x$with_libnetapp" = "xyes"
2666 if test "x$LIBNETAPP_LDFLAGS" != "x"
2668 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2671 if test "x$LIBNETAPP_LIBS" = "x"
2673 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2675 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2677 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2678 [with_libnetapp="yes"],
2679 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2681 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2684 CPPFLAGS="$SAVE_CPPFLAGS"
2685 LDFLAGS="$SAVE_LDFLAGS"
2687 if test "x$with_libnetapp" = "xyes"
2689 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2692 AC_SUBST(LIBNETAPP_CPPFLAGS)
2693 AC_SUBST(LIBNETAPP_LDFLAGS)
2694 AC_SUBST(LIBNETAPP_LIBS)
2695 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2698 # --with-libnetsnmp {{{
2699 with_snmp_config="net-snmp-config"
2702 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2704 if test "x$withval" = "xno"
2706 with_libnetsnmp="no"
2707 else if test "x$withval" = "xyes"
2709 with_libnetsnmp="yes"
2711 if test -x "$withval"
2713 with_snmp_config="$withval"
2714 with_libnetsnmp="yes"
2716 with_snmp_config="$withval/bin/net-snmp-config"
2717 with_libnetsnmp="yes"
2721 [with_libnetsnmp="yes"])
2722 if test "x$with_libnetsnmp" = "xyes"
2724 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2725 snmp_config_status=$?
2727 if test $snmp_config_status -ne 0
2729 with_libnetsnmp="no ($with_snmp_config failed)"
2731 SAVE_CPPFLAGS="$CPPFLAGS"
2732 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2734 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2736 CPPFLAGS="$SAVE_CPPFLAGS"
2739 if test "x$with_libnetsnmp" = "xyes"
2741 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2742 snmp_config_status=$?
2744 if test $snmp_config_status -ne 0
2746 with_libnetsnmp="no ($with_snmp_config failed)"
2748 AC_CHECK_LIB(netsnmp, init_snmp,
2749 [with_libnetsnmp="yes"],
2750 [with_libnetsnmp="no (libnetsnmp not found)"],
2754 if test "x$with_libnetsnmp" = "xyes"
2756 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2757 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2758 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2759 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2761 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2764 # --with-liboconfig {{{
2765 with_own_liboconfig="no"
2766 liboconfig_LDFLAGS="$LDFLAGS"
2767 liboconfig_CPPFLAGS="$CPPFLAGS"
2768 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2770 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2772 if test -d "$withval/lib"
2774 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2776 if test -d "$withval/include"
2778 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2781 if test "x$withval" = "xno"
2783 AC_MSG_ERROR("liboconfig is required")
2787 with_liboconfig="yes"
2790 save_LDFLAGS="$LDFLAGS"
2791 save_CPPFLAGS="$CPPFLAGS"
2792 LDFLAGS="$liboconfig_LDFLAGS"
2793 CPPFLAGS="$liboconfig_CPPFLAGS"
2794 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2796 with_liboconfig="yes"
2797 with_own_liboconfig="no"
2800 with_liboconfig="yes"
2801 with_own_liboconfig="yes"
2802 LDFLAGS="$save_LDFLAGS"
2803 CPPFLAGS="$save_CPPFLAGS"
2806 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2807 if test "x$with_own_liboconfig" = "xyes"
2809 with_liboconfig="yes (shipped version)"
2813 # --with-liboping {{{
2814 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2816 if test "x$withval" = "xyes"
2819 else if test "x$withval" = "xno"
2824 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2825 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2828 [with_liboping="yes"])
2830 SAVE_CPPFLAGS="$CPPFLAGS"
2831 SAVE_LDFLAGS="$LDFLAGS"
2833 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2834 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2836 if test "x$with_liboping" = "xyes"
2838 if test "x$LIBOPING_CPPFLAGS" != "x"
2840 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2842 AC_CHECK_HEADERS(oping.h,
2843 [with_liboping="yes"],
2844 [with_liboping="no (oping.h not found)"])
2846 if test "x$with_liboping" = "xyes"
2848 if test "x$LIBOPING_LDFLAGS" != "x"
2850 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2852 AC_CHECK_LIB(oping, ping_construct,
2853 [with_liboping="yes"],
2854 [with_liboping="no (symbol 'ping_construct' not found)"])
2857 CPPFLAGS="$SAVE_CPPFLAGS"
2858 LDFLAGS="$SAVE_LDFLAGS"
2860 if test "x$with_liboping" = "xyes"
2862 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2863 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2864 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2865 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2867 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2871 with_oracle_cppflags=""
2873 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2875 if test "x$withval" = "xyes"
2877 if test "x$ORACLE_HOME" = "x"
2879 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2882 else if test "x$withval" = "xno"
2887 ORACLE_HOME="$withval"
2891 if test "x$ORACLE_HOME" = "x"
2893 with_oracle="no (ORACLE_HOME is not set)"
2898 if test "x$ORACLE_HOME" != "x"
2900 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2902 if test -e "$ORACLE_HOME/lib/ldflags"
2904 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2906 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2907 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2909 if test "x$with_oracle" = "xyes"
2911 SAVE_CPPFLAGS="$CPPFLAGS"
2912 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2914 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2916 CPPFLAGS="$SAVE_CPPFLAGS"
2918 if test "x$with_oracle" = "xyes"
2920 SAVE_CPPFLAGS="$CPPFLAGS"
2921 SAVE_LDFLAGS="$LDFLAGS"
2922 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2923 LDFLAGS="$LDFLAGS $with_oracle_libs"
2925 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2927 CPPFLAGS="$SAVE_CPPFLAGS"
2928 LDFLAGS="$SAVE_LDFLAGS"
2930 if test "x$with_oracle" = "xyes"
2932 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2933 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2934 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2935 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2939 # --with-libowcapi {{{
2940 with_libowcapi_cppflags=""
2941 with_libowcapi_libs="-lowcapi"
2942 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2944 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2946 with_libowcapi_cppflags="-I$withval/include"
2947 with_libowcapi_libs="-L$withval/lib -lowcapi"
2948 with_libowcapi="yes"
2950 with_libowcapi="$withval"
2954 with_libowcapi="yes"
2956 if test "x$with_libowcapi" = "xyes"
2958 SAVE_CPPFLAGS="$CPPFLAGS"
2959 CPPFLAGS="$with_libowcapi_cppflags"
2961 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2963 CPPFLAGS="$SAVE_CPPFLAGS"
2965 if test "x$with_libowcapi" = "xyes"
2967 SAVE_LDFLAGS="$LDFLAGS"
2968 SAVE_CPPFLAGS="$CPPFLAGS"
2969 LDFLAGS="$with_libowcapi_libs"
2970 CPPFLAGS="$with_libowcapi_cppflags"
2972 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2974 LDFLAGS="$SAVE_LDFLAGS"
2975 CPPFLAGS="$SAVE_CPPFLAGS"
2977 if test "x$with_libowcapi" = "xyes"
2979 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2980 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2981 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2982 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2986 # --with-libpcap {{{
2987 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2989 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2991 LDFLAGS="$LDFLAGS -L$withval/lib"
2992 CPPFLAGS="$CPPFLAGS -I$withval/include"
2995 with_libpcap="$withval"
3001 if test "x$with_libpcap" = "xyes"
3003 AC_CHECK_LIB(pcap, pcap_open_live,
3005 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
3006 ], [with_libpcap="no (libpcap not found)"])
3008 if test "x$with_libpcap" = "xyes"
3010 AC_CHECK_HEADERS(pcap.h,,
3011 [with_libpcap="no (pcap.h not found)"])
3013 if test "x$with_libpcap" = "xyes"
3015 AC_CHECK_HEADERS(pcap-bpf.h,,
3016 [with_libpcap="no (pcap-bpf.h not found)"])
3018 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3021 # --with-libperl {{{
3022 perl_interpreter="perl"
3023 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3025 if test -f "$withval" && test -x "$withval"
3027 perl_interpreter="$withval"
3029 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3031 LDFLAGS="$LDFLAGS -L$withval/lib"
3032 CPPFLAGS="$CPPFLAGS -I$withval/include"
3033 perl_interpreter="$withval/bin/perl"
3036 with_libperl="$withval"
3043 AC_MSG_CHECKING([for perl])
3044 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3045 if test -x "$perl_interpreter"
3047 AC_MSG_RESULT([yes ($perl_interpreter)])
3053 AC_SUBST(PERL, "$perl_interpreter")
3055 if test "x$with_libperl" = "xyes" \
3056 && test -n "$perl_interpreter"
3058 SAVE_CFLAGS="$CFLAGS"
3059 SAVE_LDFLAGS="$LDFLAGS"
3060 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3061 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3062 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3063 CFLAGS="$CFLAGS $PERL_CFLAGS"
3064 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3066 AC_CACHE_CHECK([for libperl],
3067 [c_cv_have_libperl],
3068 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3070 #define PERL_NO_GET_CONTEXT
3077 load_module (PERL_LOADMOD_NOIMPORT,
3078 newSVpv ("Collectd::Plugin::FooBar", 24),
3082 [c_cv_have_libperl="yes"],
3083 [c_cv_have_libperl="no"]
3087 if test "x$c_cv_have_libperl" = "xyes"
3089 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3090 AC_SUBST(PERL_CFLAGS)
3091 AC_SUBST(PERL_LDFLAGS)
3096 CFLAGS="$SAVE_CFLAGS"
3097 LDFLAGS="$SAVE_LDFLAGS"
3098 else if test -z "$perl_interpreter"; then
3099 with_libperl="no (no perl interpreter found)"
3100 c_cv_have_libperl="no"
3102 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3104 if test "x$with_libperl" = "xyes"
3106 SAVE_CFLAGS="$CFLAGS"
3107 SAVE_LDFLAGS="$LDFLAGS"
3108 CFLAGS="$CFLAGS $PERL_CFLAGS"
3109 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3111 AC_CACHE_CHECK([if perl supports ithreads],
3112 [c_cv_have_perl_ithreads],
3113 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3119 #if !defined(USE_ITHREADS)
3120 # error "Perl does not support ithreads!"
3121 #endif /* !defined(USE_ITHREADS) */
3125 [c_cv_have_perl_ithreads="yes"],
3126 [c_cv_have_perl_ithreads="no"]
3130 if test "x$c_cv_have_perl_ithreads" = "xyes"
3132 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3135 CFLAGS="$SAVE_CFLAGS"
3136 LDFLAGS="$SAVE_LDFLAGS"
3139 if test "x$with_libperl" = "xyes"
3141 SAVE_CFLAGS="$CFLAGS"
3142 SAVE_LDFLAGS="$LDFLAGS"
3143 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3144 # (see issues #41 and #42)
3145 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3146 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3148 AC_CACHE_CHECK([for broken Perl_load_module()],
3149 [c_cv_have_broken_perl_load_module],
3150 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3152 #define PERL_NO_GET_CONTEXT
3159 load_module (PERL_LOADMOD_NOIMPORT,
3160 newSVpv ("Collectd::Plugin::FooBar", 24),
3164 [c_cv_have_broken_perl_load_module="no"],
3165 [c_cv_have_broken_perl_load_module="yes"]
3169 CFLAGS="$SAVE_CFLAGS"
3170 LDFLAGS="$SAVE_LDFLAGS"
3172 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3173 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3175 if test "x$with_libperl" = "xyes"
3177 SAVE_CFLAGS="$CFLAGS"
3178 SAVE_LDFLAGS="$LDFLAGS"
3179 CFLAGS="$CFLAGS $PERL_CFLAGS"
3180 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3183 [struct mgvtbl.svt_local],
3184 [have_struct_mgvtbl_svt_local="yes"],
3185 [have_struct_mgvtbl_svt_local="no"],
3192 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3194 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3195 [Define if Perl's struct mgvtbl has member svt_local.])
3198 CFLAGS="$SAVE_CFLAGS"
3199 LDFLAGS="$SAVE_LDFLAGS"
3204 with_pg_config="pg_config"
3205 with_libpq_includedir=""
3206 with_libpq_libdir=""
3207 with_libpq_cppflags=""
3208 with_libpq_ldflags=""
3209 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3212 if test "x$withval" = "xno"
3215 else if test "x$withval" = "xyes"
3219 if test -f "$withval" && test -x "$withval";
3221 with_pg_config="$withval"
3222 else if test -x "$withval/bin/pg_config"
3224 with_pg_config="$withval/bin/pg_config"
3232 if test "x$with_libpq" = "xyes"
3234 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3237 if test $pg_config_status -eq 0
3239 if test -n "$with_libpq_includedir"; then
3240 for dir in $with_libpq_includedir; do
3241 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3245 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3248 SAVE_CPPFLAGS="$CPPFLAGS"
3249 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3251 AC_CHECK_HEADERS(libpq-fe.h, [],
3252 [with_libpq="no (libpq-fe.h not found)"], [])
3254 CPPFLAGS="$SAVE_CPPFLAGS"
3256 if test "x$with_libpq" = "xyes"
3258 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3261 if test $pg_config_status -eq 0
3263 if test -n "$with_libpq_libdir"; then
3264 for dir in $with_libpq_libdir; do
3265 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3269 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3272 SAVE_LDFLAGS="$LDFLAGS"
3273 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3275 AC_CHECK_LIB(pq, PQconnectdb,
3277 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3279 AC_CHECK_LIB(pq, PQserverVersion,
3281 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3283 LDFLAGS="$SAVE_LDFLAGS"
3285 if test "x$with_libpq" = "xyes"
3287 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3288 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3289 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3290 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3292 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3295 # --with-libpthread {{{
3296 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3297 [ if test "x$withval" != "xno" \
3298 && test "x$withval" != "xyes"
3300 LDFLAGS="$LDFLAGS -L$withval/lib"
3301 CPPFLAGS="$CPPFLAGS -I$withval/include"
3302 with_libpthread="yes"
3304 if test "x$withval" = "xno"
3306 with_libpthread="no (disabled)"
3309 ], [with_libpthread="yes"])
3310 if test "x$with_libpthread" = "xyes"
3312 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3315 if test "x$with_libpthread" = "xyes"
3317 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3319 if test "x$with_libpthread" = "xyes"
3325 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3326 [Wether or not to use pthread (POSIX threads) library])
3327 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3332 with_python_path="$PATH"
3333 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3335 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3337 with_python="$withval"
3338 else if test -x "$withval"
3340 with_python_prog="$withval"
3341 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3343 else if test -d "$withval"
3345 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3348 AC_MSG_WARN([Argument not recognized: $withval])
3350 ], [with_python="yes"])
3353 SAVE_CPPFLAGS="$CPPFLAGS"
3354 SAVE_LDFLAGS="$LDFLAGS"
3357 PATH="$with_python_path"
3359 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3361 AC_MSG_CHECKING([for python])
3362 with_python_prog="`which python 2>/dev/null`"
3363 if test "x$with_python_prog" = "x"
3365 AC_MSG_RESULT([not found])
3366 with_python="no (interpreter not found)"
3368 AC_MSG_RESULT([$with_python_prog])
3372 if test "x$with_python" = "xyes"
3374 AC_MSG_CHECKING([for Python CPPFLAGS])
3375 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3376 python_config_status=$?
3378 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3380 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3383 AC_MSG_RESULT([$python_include_path])
3387 if test "x$with_python" = "xyes"
3389 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3390 AC_CHECK_HEADERS(Python.h,
3391 [with_python="yes"],
3392 [with_python="no ('Python.h' not found)"])
3395 if test "x$with_python" = "xyes"
3397 AC_MSG_CHECKING([for Python LDFLAGS])
3398 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`
3399 python_config_status=$?
3401 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3403 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3406 AC_MSG_RESULT([$python_library_path])
3410 if test "x$with_python" = "xyes"
3412 AC_MSG_CHECKING([for Python LIBS])
3413 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`
3414 python_config_status=$?
3416 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3418 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3421 AC_MSG_RESULT([$python_library_flags])
3425 if test "x$with_python" = "xyes"
3427 LDFLAGS="-L$python_library_path $LDFLAGS"
3428 LIBS="$python_library_flags $LIBS"
3430 AC_CHECK_FUNC(PyObject_CallFunction,
3431 [with_python="yes"],
3432 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3436 CPPFLAGS="$SAVE_CPPFLAGS"
3437 LDFLAGS="$SAVE_LDFLAGS"
3440 if test "x$with_python" = "xyes"
3442 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3443 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3444 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3445 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3446 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3447 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3451 # --with-librabbitmq {{{
3452 with_librabbitmq_cppflags=""
3453 with_librabbitmq_ldflags=""
3454 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3456 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3458 with_librabbitmq_cppflags="-I$withval/include"
3459 with_librabbitmq_ldflags="-L$withval/lib"
3460 with_librabbitmq="yes"
3462 with_librabbitmq="$withval"
3466 with_librabbitmq="yes"
3468 SAVE_CPPFLAGS="$CPPFLAGS"
3469 SAVE_LDFLAGS="$LDFLAGS"
3470 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3471 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3472 if test "x$with_librabbitmq" = "xyes"
3474 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3476 if test "x$with_librabbitmq" = "xyes"
3478 # librabbitmq up to version 0.9.1 provides "library_errno", later
3479 # versions use "library_error". The library does not provide a version
3480 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3481 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3484 # include <stdlib.h>
3490 # include <stdint.h>
3493 # include <inttypes.h>
3498 if test "x$with_librabbitmq" = "xyes"
3500 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3502 if test "x$with_librabbitmq" = "xyes"
3504 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3505 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3506 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3507 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3508 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3509 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3510 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3512 CPPFLAGS="$SAVE_CPPFLAGS"
3513 LDFLAGS="$SAVE_LDFLAGS"
3514 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3517 # --with-librouteros {{{
3518 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3520 if test "x$withval" = "xyes"
3522 with_librouteros="yes"
3523 else if test "x$withval" = "xno"
3525 with_librouteros="no"
3527 with_librouteros="yes"
3528 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3529 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3532 [with_librouteros="yes"])
3534 SAVE_CPPFLAGS="$CPPFLAGS"
3535 SAVE_LDFLAGS="$LDFLAGS"
3537 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3538 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3540 if test "x$with_librouteros" = "xyes"
3542 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3544 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3546 AC_CHECK_HEADERS(routeros_api.h,
3547 [with_librouteros="yes"],
3548 [with_librouteros="no (routeros_api.h not found)"])
3550 if test "x$with_librouteros" = "xyes"
3552 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3554 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3556 AC_CHECK_LIB(routeros, ros_interface,
3557 [with_librouteros="yes"],
3558 [with_librouteros="no (symbol 'ros_interface' not found)"])
3561 CPPFLAGS="$SAVE_CPPFLAGS"
3562 LDFLAGS="$SAVE_LDFLAGS"
3564 if test "x$with_librouteros" = "xyes"
3566 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3567 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3568 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3569 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3571 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3575 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3578 librrd_threadsafe="yes"
3579 librrd_rrdc_update="no"
3580 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3581 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3583 librrd_cflags="-I$withval/include"
3584 librrd_ldflags="-L$withval/lib"
3587 with_librrd="$withval"
3589 ], [with_librrd="yes"])
3590 if test "x$with_librrd" = "xyes"
3592 SAVE_CPPFLAGS="$CPPFLAGS"
3593 SAVE_LDFLAGS="$LDFLAGS"
3595 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3596 LDFLAGS="$LDFLAGS $librrd_ldflags"
3598 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3600 CPPFLAGS="$SAVE_CPPFLAGS"
3601 LDFLAGS="$SAVE_LDFLAGS"
3603 if test "x$with_librrd" = "xyes"
3605 SAVE_CPPFLAGS="$CPPFLAGS"
3606 SAVE_LDFLAGS="$LDFLAGS"
3608 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3609 LDFLAGS="$LDFLAGS $librrd_ldflags"
3611 AC_CHECK_LIB(rrd_th, rrd_update_r,
3613 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3615 [librrd_threadsafe="no"
3616 AC_CHECK_LIB(rrd, rrd_update,
3618 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3620 [with_librrd="no (symbol 'rrd_update' not found)"],
3625 if test "x$librrd_threadsafe" = "xyes"
3627 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3629 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3632 CPPFLAGS="$SAVE_CPPFLAGS"
3633 LDFLAGS="$SAVE_LDFLAGS"
3635 if test "x$with_librrd" = "xyes"
3637 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3638 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3639 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3640 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3642 if test "x$librrd_threadsafe" = "xyes"
3644 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3648 # --with-libsensors {{{
3649 with_sensors_cflags=""
3650 with_sensors_ldflags=""
3651 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3653 if test "x$withval" = "xno"
3655 with_libsensors="no"
3657 with_libsensors="yes"
3658 if test "x$withval" != "xyes"
3660 with_sensors_cflags="-I$withval/include"
3661 with_sensors_ldflags="-L$withval/lib"
3662 with_libsensors="yes"
3667 if test "x$ac_system" = "xLinux"
3669 with_libsensors="yes"
3671 with_libsensors="no (Linux only library)"
3674 if test "x$with_libsensors" = "xyes"
3676 SAVE_CPPFLAGS="$CPPFLAGS"
3677 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3679 # AC_CHECK_HEADERS(sensors/sensors.h,
3681 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3683 # [with_libsensors="no (sensors/sensors.h not found)"])
3684 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3686 CPPFLAGS="$SAVE_CPPFLAGS"
3688 if test "x$with_libsensors" = "xyes"
3690 SAVE_CPPFLAGS="$CPPFLAGS"
3691 SAVE_LDFLAGS="$LDFLAGS"
3692 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3693 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3695 AC_CHECK_LIB(sensors, sensors_init,
3697 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3699 [with_libsensors="no (libsensors not found)"])
3701 CPPFLAGS="$SAVE_CPPFLAGS"
3702 LDFLAGS="$SAVE_LDFLAGS"
3704 if test "x$with_libsensors" = "xyes"
3706 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3707 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3708 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3709 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3711 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3714 # --with-libstatgrab {{{
3715 with_libstatgrab_cflags=""
3716 with_libstatgrab_ldflags=""
3717 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3719 if test "x$withval" != "xno" \
3720 && test "x$withval" != "xyes"
3722 with_libstatgrab_cflags="-I$withval/include"
3723 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3724 with_libstatgrab="yes"
3725 with_libstatgrab_pkg_config="no"
3727 with_libstatgrab="$withval"
3728 with_libstatgrab_pkg_config="yes"
3732 with_libstatgrab="yes"
3733 with_libstatgrab_pkg_config="yes"
3736 if test "x$with_libstatgrab" = "xyes" \
3737 && test "x$with_libstatgrab_pkg_config" = "xyes"
3739 if test "x$PKG_CONFIG" != "x"
3741 AC_MSG_CHECKING([pkg-config for libstatgrab])
3743 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3746 with_libstatgrab_pkg_config="no"
3747 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3748 temp_result="not found"
3750 AC_MSG_RESULT([$temp_result])
3752 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3753 with_libstatgrab_pkg_config="no"
3754 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3758 if test "x$with_libstatgrab" = "xyes" \
3759 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3760 && test "x$with_libstatgrab_cflags" = "x"
3762 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3763 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3766 with_libstatgrab_cflags="$temp_result"
3768 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3769 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3771 AC_MSG_RESULT([$temp_result])
3774 if test "x$with_libstatgrab" = "xyes" \
3775 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3776 && test "x$with_libstatgrab_ldflags" = "x"
3778 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3779 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3782 with_libstatgrab_ldflags="$temp_result"
3784 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3785 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3787 AC_MSG_RESULT([$temp_result])
3790 if test "x$with_libstatgrab" = "xyes"
3792 SAVE_CPPFLAGS="$CPPFLAGS"
3793 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3795 AC_CHECK_HEADERS(statgrab.h,
3796 [with_libstatgrab="yes"],
3797 [with_libstatgrab="no (statgrab.h not found)"])
3799 CPPFLAGS="$SAVE_CPPFLAGS"
3802 if test "x$with_libstatgrab" = "xyes"
3804 SAVE_CFLAGS="$CFLAGS"
3805 SAVE_LDFLAGS="$LDFLAGS"
3807 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3808 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3810 AC_CHECK_LIB(statgrab, sg_init,
3811 [with_libstatgrab="yes"],
3812 [with_libstatgrab="no (symbol sg_init not found)"])
3814 CFLAGS="$SAVE_CFLAGS"
3815 LDFLAGS="$SAVE_LDFLAGS"
3818 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3819 if test "x$with_libstatgrab" = "xyes"
3821 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3822 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3823 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3824 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3825 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3829 # --with-libtokyotyrant {{{
3830 with_libtokyotyrant_cppflags=""
3831 with_libtokyotyrant_ldflags=""
3832 with_libtokyotyrant_libs=""
3833 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3835 if test "x$withval" = "xno"
3837 with_libtokyotyrant="no"
3838 else if test "x$withval" = "xyes"
3840 with_libtokyotyrant="yes"
3842 with_libtokyotyrant_cppflags="-I$withval/include"
3843 with_libtokyotyrant_ldflags="-L$withval/include"
3844 with_libtokyotyrant_libs="-ltokyotyrant"
3845 with_libtokyotyrant="yes"
3849 with_libtokyotyrant="yes"
3852 if test "x$with_libtokyotyrant" = "xyes"
3854 if $PKG_CONFIG --exists tokyotyrant
3856 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3857 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3858 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3862 SAVE_CPPFLAGS="$CPPFLAGS"
3863 SAVE_LDFLAGS="$LDFLAGS"
3864 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3865 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3867 if test "x$with_libtokyotyrant" = "xyes"
3869 AC_CHECK_HEADERS(tcrdb.h,
3871 AC_DEFINE(HAVE_TCRDB_H, 1,
3872 [Define to 1 if you have the <tcrdb.h> header file.])
3873 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3876 if test "x$with_libtokyotyrant" = "xyes"
3878 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3880 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3881 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3883 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3884 [$with_libtokyotyrant_libs])
3887 CPPFLAGS="$SAVE_CPPFLAGS"
3888 LDFLAGS="$SAVE_LDFLAGS"
3890 if test "x$with_libtokyotyrant" = "xyes"
3892 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3893 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3894 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3895 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3896 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3897 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3899 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3902 # --with-libupsclient {{{
3903 with_libupsclient_config=""
3904 with_libupsclient_cflags=""
3905 with_libupsclient_libs=""
3906 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3908 if test "x$withval" = "xno"
3910 with_libupsclient="no"
3911 else if test "x$withval" = "xyes"
3913 with_libupsclient="use_pkgconfig"
3915 if test -x "$withval"
3917 with_libupsclient_config="$withval"
3918 with_libupsclient="use_libupsclient_config"
3919 else if test -x "$withval/bin/libupsclient-config"
3921 with_libupsclient_config="$withval/bin/libupsclient-config"
3922 with_libupsclient="use_libupsclient_config"
3924 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3925 with_libupsclient_cflags="-I$withval/include"
3926 with_libupsclient_libs="-L$withval/lib -lupsclient"
3927 with_libupsclient="yes"
3931 [with_libupsclient="use_pkgconfig"])
3933 # configure using libupsclient-config
3934 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3936 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3937 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3940 with_libupsclient="no ($with_libupsclient_config failed)"
3942 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3945 with_libupsclient="no ($with_libupsclient_config failed)"
3948 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3950 with_libupsclient="yes"
3953 # configure using pkg-config
3954 if test "x$with_libupsclient" = "xuse_pkgconfig"
3956 if test "x$PKG_CONFIG" = "x"
3958 with_libupsclient="no (Don't have pkg-config)"
3961 if test "x$with_libupsclient" = "xuse_pkgconfig"
3963 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3964 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3967 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3970 if test "x$with_libupsclient" = "xuse_pkgconfig"
3972 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3975 with_libupsclient="no ($PKG_CONFIG failed)"
3977 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3980 with_libupsclient="no ($PKG_CONFIG failed)"
3983 if test "x$with_libupsclient" = "xuse_pkgconfig"
3985 with_libupsclient="yes"
3988 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3989 # the actual checks.
3990 if test "x$with_libupsclient" = "xyes"
3992 SAVE_CPPFLAGS="$CPPFLAGS"
3993 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3995 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3997 CPPFLAGS="$SAVE_CPPFLAGS"
3999 if test "x$with_libupsclient" = "xyes"
4001 SAVE_CPPFLAGS="$CPPFLAGS"
4002 SAVE_LDFLAGS="$LDFLAGS"
4004 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4005 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
4007 AC_CHECK_LIB(upsclient, upscli_connect,
4008 [with_libupsclient="yes"],
4009 [with_libupsclient="no (symbol upscli_connect not found)"])
4011 CPPFLAGS="$SAVE_CPPFLAGS"
4012 LDFLAGS="$SAVE_LDFLAGS"
4014 if test "x$with_libupsclient" = "xyes"
4016 SAVE_CPPFLAGS="$CPPFLAGS"
4017 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4019 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4020 [#include <stdlib.h>
4022 #include <upsclient.h>])
4024 CPPFLAGS="$SAVE_CPPFLAGS"
4026 if test "x$with_libupsclient" = "xyes"
4028 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4029 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4030 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4031 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4035 # --with-libxmms {{{
4036 with_xmms_config="xmms-config"
4039 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4041 if test "x$withval" != "xno" \
4042 && test "x$withval" != "xyes"
4044 if test -f "$withval" && test -x "$withval";
4046 with_xmms_config="$withval"
4047 else if test -x "$withval/bin/xmms-config"
4049 with_xmms_config="$withval/bin/xmms-config"
4052 else if test "x$withval" = "xno"
4062 if test "x$with_libxmms" = "xyes"
4064 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4065 xmms_config_status=$?
4067 if test $xmms_config_status -ne 0
4072 if test "x$with_libxmms" = "xyes"
4074 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4075 xmms_config_status=$?
4077 if test $xmms_config_status -ne 0
4082 if test "x$with_libxmms" = "xyes"
4084 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4086 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4087 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4088 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4089 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4096 with_libxmms_numeric=0
4097 if test "x$with_libxmms" = "xyes"
4099 with_libxmms_numeric=1
4101 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4102 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4105 # --with-libyajl {{{
4106 with_libyajl_cppflags=""
4107 with_libyajl_ldflags=""
4108 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4110 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4112 with_libyajl_cppflags="-I$withval/include"
4113 with_libyajl_ldflags="-L$withval/lib"
4116 with_libyajl="$withval"
4122 if test "x$with_libyajl" = "xyes"
4124 SAVE_CPPFLAGS="$CPPFLAGS"
4125 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4127 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4128 AC_CHECK_HEADERS(yajl/yajl_version.h)
4130 CPPFLAGS="$SAVE_CPPFLAGS"
4132 if test "x$with_libyajl" = "xyes"
4134 SAVE_CPPFLAGS="$CPPFLAGS"
4135 SAVE_LDFLAGS="$LDFLAGS"
4136 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4137 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4139 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4141 CPPFLAGS="$SAVE_CPPFLAGS"
4142 LDFLAGS="$SAVE_LDFLAGS"
4144 if test "x$with_libyajl" = "xyes"
4146 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4147 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4148 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4149 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4150 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4151 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4152 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4154 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4158 with_mic_cflags="-I/opt/intel/mic/sysmgmt/sdk/include"
4159 with_mic_ldpath="-L/opt/intel/mic/sysmgmt/sdk/lib/Linux"
4161 AC_ARG_WITH(mic,[AS_HELP_STRING([--with-mic@<:@=PREFIX@:>@], [Path to Intel MIC Access API.])],
4163 if test "x$withval" = "xno"
4166 else if test "x$withval" = "xyes"
4169 else if test -d "$with_mic/lib"
4171 AC_MSG_NOTICE([Not checking for Intel Mic: Manually configured])
4172 with_mic_cflags="-I$withval/include"
4173 with_mic_ldpath="-L$withval/lib"
4174 with_mic_libs="-lMicAccessSDK -lscif -lpthread"
4179 if test "x$with_mic" = "xyes"
4181 SAVE_CPPFLAGS="$CPPFLAGS"
4182 CPPFLAGS="$CPPFLAGS $with_mic_cflags"
4183 AC_CHECK_HEADERS(MicAccessApi.h,[],[with_mic="no (MicAccessApi not found)"])
4184 CPPFLAGS="$SAVE_CPPFLAGS"
4186 if test "x$with_mic" = "xyes"
4188 SAVE_CPPFLAGS="$CPPFLAGS"
4189 SAVE_LDFLAGS="$LDFLAGS"
4191 CPPFLAGS="$CPPFLAGS $with_mic_cflags"
4192 LDFLAGS="$LDFLAGS $with_mic_ldpath"
4194 AC_CHECK_LIB(MicAccessSDK, MicInitAPI,
4195 [with_mic_ldpath="$with_mic_ldpath"
4196 with_mic_libs="-lMicAccessSDK -lscif -lpthread"],
4197 [with_mic="no (symbol MicInitAPI not found)"],[-lscif -lpthread])
4199 CPPFLAGS="$SAVE_CPPFLAGS"
4200 LDFLAGS="$SAVE_LDFLAGS"
4203 if test "x$with_mic" = "xyes"
4205 BUILD_WITH_MIC_CPPFLAGS="$with_mic_cflags"
4206 BUILD_WITH_MIC_LIBPATH="$with_mic_ldpath"
4207 BUILD_WITH_MIC_LDADD="$with_mic_libs"
4208 AC_SUBST(BUILD_WITH_MIC_CPPFLAGS)
4209 AC_SUBST(BUILD_WITH_MIC_LIBPATH)
4210 AC_SUBST(BUILD_WITH_MIC_LDADD)
4214 # --with-libvarnish {{{
4215 with_libvarnish_cppflags=""
4216 with_libvarnish_cflags=""
4217 with_libvarnish_libs=""
4218 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4220 if test "x$withval" = "xno"
4222 with_libvarnish="no"
4223 else if test "x$withval" = "xyes"
4225 with_libvarnish="use_pkgconfig"
4226 else if test -d "$with_libvarnish/lib"
4228 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4229 with_libvarnish_cflags="-I$withval/include"
4230 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4231 with_libvarnish="yes"
4234 [with_libvarnish="use_pkgconfig"])
4236 # configure using pkg-config
4237 if test "x$with_libvarnish" = "xuse_pkgconfig"
4239 if test "x$PKG_CONFIG" = "x"
4241 with_libvarnish="no (Don't have pkg-config)"
4244 if test "x$with_libvarnish" = "xuse_pkgconfig"
4246 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4247 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4250 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4253 if test "x$with_libvarnish" = "xuse_pkgconfig"
4255 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4258 with_libvarnish="no ($PKG_CONFIG failed)"
4260 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4263 with_libvarnish="no ($PKG_CONFIG failed)"
4266 if test "x$with_libvarnish" = "xuse_pkgconfig"
4268 with_libvarnish="yes"
4271 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4272 # the actual checks.
4273 if test "x$with_libvarnish" = "xyes"
4275 SAVE_CPPFLAGS="$CPPFLAGS"
4276 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4277 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4279 CPPFLAGS="$SAVE_CPPFLAGS"
4281 if test "x$with_libvarnish" = "xyes"
4283 SAVE_CPPFLAGS="$CPPFLAGS"
4284 #SAVE_LDFLAGS="$LDFLAGS"
4286 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4287 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4289 AC_CHECK_HEADERS(varnish/vsc.h,
4290 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4291 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4293 CPPFLAGS="$SAVE_CPPFLAGS"
4294 #LDFLAGS="$SAVE_LDFLAGS"
4296 if test "x$with_libvarnish" = "xyes"
4298 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4299 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4300 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4301 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4305 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4306 with_libxml2="no (pkg-config isn't available)"
4307 with_libxml2_cflags=""
4308 with_libxml2_ldflags=""
4309 with_libvirt="no (pkg-config isn't available)"
4310 with_libvirt_cflags=""
4311 with_libvirt_ldflags=""
4312 if test "x$PKG_CONFIG" != "x"
4314 pkg-config --exists 'libxml-2.0' 2>/dev/null
4319 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4322 pkg-config --exists libvirt 2>/dev/null
4327 with_libvirt="no (pkg-config doesn't know libvirt)"
4330 if test "x$with_libxml2" = "xyes"
4332 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4337 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4343 if test "x$with_libxml2" = "xyes"
4345 SAVE_CPPFLAGS="$CPPFLAGS"
4346 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4348 AC_CHECK_HEADERS(libxml/parser.h, [],
4349 [with_libxml2="no (libxml/parser.h not found)"])
4351 CPPFLAGS="$SAVE_CPPFLAGS"
4353 if test "x$with_libxml2" = "xyes"
4355 SAVE_CFLAGS="$CFLAGS"
4356 SAVE_LDFLAGS="$LDFLAGS"
4358 CFLAGS="$CFLAGS $with_libxml2_cflags"
4359 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4361 AC_CHECK_LIB(xml2, xmlXPathEval,
4362 [with_libxml2="yes"],
4363 [with_libxml2="no (symbol xmlXPathEval not found)"])
4365 CFLAGS="$SAVE_CFLAGS"
4366 LDFLAGS="$SAVE_LDFLAGS"
4368 dnl Add the right compiler flags and libraries.
4369 if test "x$with_libxml2" = "xyes"; then
4370 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4371 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4372 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4373 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4375 if test "x$with_libvirt" = "xyes"
4377 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4382 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4388 if test "x$with_libvirt" = "xyes"
4390 SAVE_CPPFLAGS="$CPPFLAGS"
4391 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4393 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4394 [with_libvirt="no (libvirt/libvirt.h not found)"])
4396 CPPFLAGS="$SAVE_CPPFLAGS"
4398 if test "x$with_libvirt" = "xyes"
4400 SAVE_CFLAGS="$CFLAGS"
4401 SAVE_LDFLAGS="$LDFLAGS"
4403 CFLAGS="$CFLAGS $with_libvirt_cflags"
4404 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4406 AC_CHECK_LIB(virt, virDomainBlockStats,
4407 [with_libvirt="yes"],
4408 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4410 CFLAGS="$SAVE_CFLAGS"
4411 LDFLAGS="$SAVE_LDFLAGS"
4413 dnl Add the right compiler flags and libraries.
4414 if test "x$with_libvirt" = "xyes"; then
4415 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4416 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4417 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4418 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4422 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4423 with_libopenipmipthread="yes"
4424 with_libopenipmipthread_cflags=""
4425 with_libopenipmipthread_libs=""
4427 AC_MSG_CHECKING([for pkg-config])
4429 if test "x$PKG_CONFIG" = "x"
4431 with_libopenipmipthread="no"
4434 temp_result="$PKG_CONFIG"
4436 AC_MSG_RESULT([$temp_result])
4438 if test "x$with_libopenipmipthread" = "xyes"
4440 AC_MSG_CHECKING([for libOpenIPMIpthread])
4441 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4444 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4446 AC_MSG_RESULT([$with_libopenipmipthread])
4449 if test "x$with_libopenipmipthread" = "xyes"
4451 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4452 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4455 with_libopenipmipthread_cflags="$temp_result"
4457 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4458 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4460 AC_MSG_RESULT([$temp_result])
4463 if test "x$with_libopenipmipthread" = "xyes"
4465 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4466 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4469 with_libopenipmipthread_ldflags="$temp_result"
4471 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4472 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4474 AC_MSG_RESULT([$temp_result])
4477 if test "x$with_libopenipmipthread" = "xyes"
4479 SAVE_CPPFLAGS="$CPPFLAGS"
4480 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4482 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4483 [with_libopenipmipthread="yes"],
4484 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4485 [#include <OpenIPMI/ipmiif.h>
4486 #include <OpenIPMI/ipmi_err.h>
4487 #include <OpenIPMI/ipmi_posix.h>
4488 #include <OpenIPMI/ipmi_conn.h>
4491 CPPFLAGS="$SAVE_CPPFLAGS"
4494 if test "x$with_libopenipmipthread" = "xyes"
4496 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4497 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4498 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4499 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4503 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4504 [with_libnotify="yes"],
4505 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4508 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4511 # Check for enabled/disabled features
4514 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4515 # ------------------------------------------------------------
4517 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4522 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4527 m4_define([EnDis],[disabled])dnl
4528 m4_define([YesNo],[no])dnl
4534 m4_define([EnDis],[enabled])dnl
4535 m4_define([YesNo],[yes])dnl
4538 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4542 m4_if([$3], [feature], [],
4546 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4552 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4554 enable_$1='[YesNo]'dnl
4556 if test "x$enable_$1" = "xno"
4560 if test "x$enable_$1" = "xyes"
4564 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4569 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4570 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4572 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4574 # AC_PLUGIN(name, default, info)
4575 # ------------------------------------------------------------
4582 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4584 if test "x$enableval" = "xyes"
4587 else if test "x$enableval" = "xforce"
4592 enable_plugin="no (disabled on command line)"
4596 if test "x$enable_all_plugins" = "xauto"
4598 if test "x$2" = "xyes"
4605 enable_plugin="$enable_all_plugins"
4608 if test "x$enable_plugin" = "xyes"
4610 if test "x$2" = "xyes" || test "x$force" = "xyes"
4612 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4613 if test "x$2" != "xyes"
4615 dependency_warning="yes"
4617 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4618 dependency_error="yes"
4619 enable_plugin="no (dependency error)"
4622 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4623 enable_$1="$enable_plugin"
4625 )# AC_PLUGIN(name, default, info)
4627 m4_divert_once([HELP_ENABLE], [
4628 collectd features:])
4629 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4630 AC_COLLECTD([debug], [enable], [feature], [debugging])
4631 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4632 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4634 dependency_warning="no"
4635 dependency_error="no"
4640 plugin_conntrack="no"
4641 plugin_contextswitch="no"
4644 plugin_curl_json="no"
4645 plugin_curl_xml="no"
4651 plugin_interface="no"
4659 plugin_multimeter="no"
4663 plugin_processes="no"
4664 plugin_protocols="no"
4668 plugin_tcpconns="no"
4675 plugin_wireless="no"
4679 if test "x$ac_system" = "xLinux"
4681 plugin_battery="yes"
4682 plugin_conntrack="yes"
4683 plugin_contextswitch="yes"
4685 plugin_cpufreq="yes"
4687 plugin_entropy="yes"
4688 plugin_fscache="yes"
4689 plugin_interface="yes"
4695 plugin_processes="yes"
4696 plugin_protocols="yes"
4699 plugin_tcpconns="yes"
4700 plugin_thermal="yes"
4703 plugin_vserver="yes"
4704 plugin_wireless="yes"
4706 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4712 if test "x$ac_system" = "xOpenBSD"
4714 plugin_tcpconns="yes"
4718 if test "x$with_libiokit" = "xyes"
4720 plugin_battery="yes"
4726 if test "x$ac_system" = "xAIX"
4728 plugin_tcpconns="yes"
4731 if test "x$with_perfstat" = "xyes"
4734 plugin_contextswitch="yes"
4738 plugin_interface="yes"
4743 if test "x$with_procinfo" = "xyes"
4745 plugin_processes="yes"
4749 if test "x$with_kstat" = "xyes"
4753 plugin_zfs_arc="yes"
4756 if test "x$with_devinfo$with_kstat" = "xyesyes"
4760 plugin_interface="yes"
4766 if test "x$with_libstatgrab" = "xyes"
4770 plugin_interface="yes"
4777 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4780 if test "x$have_strptime" = "xyes"
4786 if test "x$with_libopenipmipthread" = "xyes"
4791 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4793 plugin_curl_json="yes"
4796 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4798 plugin_curl_xml="yes"
4801 if test "x$have_processor_info" = "xyes"
4805 if test "x$have_sysctl" = "xyes"
4810 if test "x$ac_system" = "xDarwin"
4815 if test "x$have_sysctlbyname" = "xyes"
4817 plugin_contextswitch="yes"
4820 plugin_tcpconns="yes"
4822 if test "x$with_mic" = "xyes"
4827 # Df plugin: Check if we know how to determine mount points first.
4828 #if test "x$have_listmntent" = "xyes"; then
4831 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4835 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4839 #if test "x$have_getmntent" = "xseq"
4843 if test "x$c_cv_have_one_getmntent" = "xyes"
4848 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4849 if test "x$plugin_df" = "xyes"
4852 if test "x$have_statfs" = "xyes"
4856 if test "x$have_statvfs" = "xyes"
4862 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
4864 plugin_ethstat="yes"
4867 if test "x$have_getifaddrs" = "xyes"
4869 plugin_interface="yes"
4872 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4874 plugin_libvirt="yes"
4877 if test "x$have_getloadavg" = "xyes"
4882 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4887 # Mac OS X memory interface
4888 if test "x$have_host_statistics" = "xyes"
4893 if test "x$have_termios_h" = "xyes"
4895 plugin_multimeter="yes"
4899 if test "x$have_thread_info" = "xyes"
4901 plugin_processes="yes"
4904 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4906 plugin_processes="yes"
4909 if test "x$with_kvm_getswapinfo" = "xyes"
4914 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4919 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4921 plugin_tcpconns="yes"
4924 if test "x$have_getutent" = "xyes"
4928 if test "x$have_getutxent" = "xyes"
4933 m4_divert_once([HELP_ENABLE], [
4936 AC_ARG_ENABLE([all-plugins],
4937 AC_HELP_STRING([--enable-all-plugins],
4938 [enable all plugins (auto by def)]),
4940 if test "x$enableval" = "xyes"
4942 enable_all_plugins="yes"
4943 else if test "x$enableval" = "xauto"
4945 enable_all_plugins="auto"
4947 enable_all_plugins="no"
4950 [enable_all_plugins="auto"])
4952 m4_divert_once([HELP_ENABLE], [])
4954 AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
4955 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4956 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4957 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4958 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4959 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4960 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4961 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4962 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4963 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4964 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4965 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4966 AC_PLUGIN([csv], [yes], [CSV output plugin])
4967 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4968 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4969 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4970 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4971 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4972 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4973 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4974 AC_PLUGIN([email], [yes], [EMail statistics])
4975 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4976 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
4977 AC_PLUGIN([exec], [yes], [Execution of external programs])
4978 AC_PLUGIN([filecount], [yes], [Count files in directories])
4979 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4980 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4981 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4982 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4983 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4984 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4985 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4986 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4987 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4988 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4989 AC_PLUGIN([load], [$plugin_load], [System load])
4990 AC_PLUGIN([logfile], [yes], [File logging plugin])
4991 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4992 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4993 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4994 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4995 AC_PLUGIN([match_regex], [yes], [The regex match])
4996 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4997 AC_PLUGIN([match_value], [yes], [The value match])
4998 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4999 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
5000 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
5001 AC_PLUGIN([memcached], [yes], [memcached statistics])
5002 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
5003 AC_PLUGIN([mic], [$plugin_mic], [Intel Many Integrated Core stats])
5004 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
5005 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
5006 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
5007 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
5008 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
5009 AC_PLUGIN([network], [yes], [Network communication plugin])
5010 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
5011 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
5012 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
5013 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
5014 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
5015 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
5016 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
5017 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
5018 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
5019 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
5020 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
5021 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
5022 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
5023 # FIXME: Check for libevent, too.
5024 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
5025 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
5026 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
5027 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
5028 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
5029 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
5030 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
5031 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
5032 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
5033 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
5034 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
5035 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
5036 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
5037 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
5038 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
5039 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
5040 AC_PLUGIN([table], [yes], [Parsing of tabular data])
5041 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
5042 AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files])
5043 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
5044 AC_PLUGIN([target_notification], [yes], [The notification target])
5045 AC_PLUGIN([target_replace], [yes], [The replace target])
5046 AC_PLUGIN([target_scale],[yes], [The scale target])
5047 AC_PLUGIN([target_set], [yes], [The set target])
5048 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
5049 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
5050 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
5051 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
5052 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
5053 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
5054 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
5055 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
5056 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
5057 AC_PLUGIN([users], [$plugin_users], [User statistics])
5058 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
5059 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
5060 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
5061 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
5062 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
5063 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
5064 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
5065 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
5066 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
5067 AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin])
5068 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
5069 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
5071 dnl Default configuration file
5072 # Load either syslog or logfile
5073 LOAD_PLUGIN_SYSLOG=""
5074 LOAD_PLUGIN_LOGFILE=""
5076 AC_MSG_CHECKING([which default log plugin to load])
5077 default_log_plugin="none"
5078 if test "x$enable_syslog" = "xyes"
5080 default_log_plugin="syslog"
5082 LOAD_PLUGIN_SYSLOG="##"
5085 if test "x$enable_logfile" = "xyes"
5087 if test "x$default_log_plugin" = "xnone"
5089 default_log_plugin="logfile"
5091 LOAD_PLUGIN_LOGFILE="#"
5094 LOAD_PLUGIN_LOGFILE="##"
5096 AC_MSG_RESULT([$default_log_plugin])
5098 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5099 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5101 DEFAULT_LOG_LEVEL="info"
5102 if test "x$enable_debug" = "xyes"
5104 DEFAULT_LOG_LEVEL="debug"
5106 AC_SUBST(DEFAULT_LOG_LEVEL)
5108 # Load only one of rrdtool, network, csv in the default config.
5109 LOAD_PLUGIN_RRDTOOL=""
5110 LOAD_PLUGIN_NETWORK=""
5113 AC_MSG_CHECKING([which default write plugin to load])
5114 default_write_plugin="none"
5115 if test "x$enable_rrdtool" = "xyes"
5117 default_write_plugin="rrdtool"
5119 LOAD_PLUGIN_RRDTOOL="##"
5122 if test "x$enable_network" = "xyes"
5124 if test "x$default_write_plugin" = "xnone"
5126 default_write_plugin="network"
5128 LOAD_PLUGIN_NETWORK="#"
5131 LOAD_PLUGIN_NETWORK="##"
5134 if test "x$enable_csv" = "xyes"
5136 if test "x$default_write_plugin" = "xnone"
5138 default_write_plugin="csv"
5143 LOAD_PLUGIN_CSV="##"
5145 AC_MSG_RESULT([$default_write_plugin])
5147 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5148 AC_SUBST(LOAD_PLUGIN_NETWORK)
5149 AC_SUBST(LOAD_PLUGIN_CSV)
5152 if test "x$ac_system" = "xLinux" \
5153 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5155 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5158 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5160 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5164 PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
5165 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5167 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5169 PERL_BINDINGS_OPTIONS="$withval"
5170 with_perl_bindings="yes"
5172 with_perl_bindings="$withval"
5176 if test -n "$perl_interpreter"
5178 with_perl_bindings="yes"
5180 with_perl_bindings="no (no perl interpreter found)"
5183 if test "x$with_perl_bindings" = "xyes"
5185 PERL_BINDINGS="perl"
5189 AC_SUBST(PERL_BINDINGS)
5190 AC_SUBST(PERL_BINDINGS_OPTIONS)
5192 dnl libcollectdclient
5193 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5194 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5195 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5197 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5199 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5201 AC_SUBST(LCC_VERSION_MAJOR)
5202 AC_SUBST(LCC_VERSION_MINOR)
5203 AC_SUBST(LCC_VERSION_PATCH)
5204 AC_SUBST(LCC_VERSION_EXTRA)
5205 AC_SUBST(LCC_VERSION_STRING)
5207 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5209 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
5211 if test "x$with_librrd" = "xyes" \
5212 && test "x$librrd_threadsafe" != "xyes"
5214 with_librrd="yes (warning: librrd is not thread-safe)"
5217 if test "x$with_libperl" = "xyes"
5219 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5221 enable_perl="no (needs libperl)"
5224 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5226 enable_perl="no (libperl doesn't support ithreads)"
5229 if test "x$with_perl_bindings" = "xyes" \
5230 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5232 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5239 libcurl . . . . . . . $with_libcurl
5240 libdbi . . . . . . . $with_libdbi
5241 libcredis . . . . . . $with_libcredis
5242 libesmtp . . . . . . $with_libesmtp
5243 libganglia . . . . . $with_libganglia
5244 libgcrypt . . . . . . $with_libgcrypt
5245 libiokit . . . . . . $with_libiokit
5246 libiptc . . . . . . . $with_libiptc
5247 libjvm . . . . . . . $with_java
5248 libkstat . . . . . . $with_kstat
5249 libkvm . . . . . . . $with_libkvm
5250 libmemcached . . . . $with_libmemcached
5251 libmodbus . . . . . . $with_libmodbus
5252 libmysql . . . . . . $with_libmysql
5253 libnetapp . . . . . . $with_libnetapp
5254 libnetlink . . . . . $with_libnetlink
5255 libnetsnmp . . . . . $with_libnetsnmp
5256 libnotify . . . . . . $with_libnotify
5257 liboconfig . . . . . $with_liboconfig
5258 libopenipmi . . . . . $with_libopenipmipthread
5259 liboping . . . . . . $with_liboping
5260 libpcap . . . . . . . $with_libpcap
5261 libperfstat . . . . . $with_perfstat
5262 libperl . . . . . . . $with_libperl
5263 libpq . . . . . . . . $with_libpq
5264 libpthread . . . . . $with_libpthread
5265 librabbitmq . . . . . $with_librabbitmq
5266 librouteros . . . . . $with_librouteros
5267 librrd . . . . . . . $with_librrd
5268 libsensors . . . . . $with_libsensors
5269 libstatgrab . . . . . $with_libstatgrab
5270 libtokyotyrant . . . $with_libtokyotyrant
5271 libupsclient . . . . $with_libupsclient
5272 mic . . . . . . . . $with_mic
5273 libvarnish . . . . . $with_libvarnish
5274 libvirt . . . . . . . $with_libvirt
5275 libxml2 . . . . . . . $with_libxml2
5276 libxmms . . . . . . . $with_libxmms
5277 libyajl . . . . . . . $with_libyajl
5278 libevent . . . . . . $with_libevent
5279 protobuf-c . . . . . $have_protoc_c
5280 oracle . . . . . . . $with_oracle
5281 python . . . . . . . $with_python
5284 daemon mode . . . . . $enable_daemon
5285 debug . . . . . . . . $enable_debug
5288 perl . . . . . . . . $with_perl_bindings
5291 aggregation . . . . . $enable_aggregation
5292 amqp . . . . . . . $enable_amqp
5293 apache . . . . . . . $enable_apache
5294 apcups . . . . . . . $enable_apcups
5295 apple_sensors . . . . $enable_apple_sensors
5296 ascent . . . . . . . $enable_ascent
5297 battery . . . . . . . $enable_battery
5298 bind . . . . . . . . $enable_bind
5299 conntrack . . . . . . $enable_conntrack
5300 contextswitch . . . . $enable_contextswitch
5301 cpu . . . . . . . . . $enable_cpu
5302 cpufreq . . . . . . . $enable_cpufreq
5303 csv . . . . . . . . . $enable_csv
5304 curl . . . . . . . . $enable_curl
5305 curl_json . . . . . . $enable_curl_json
5306 curl_xml . . . . . . $enable_curl_xml
5307 dbi . . . . . . . . . $enable_dbi
5308 df . . . . . . . . . $enable_df
5309 disk . . . . . . . . $enable_disk
5310 dns . . . . . . . . . $enable_dns
5311 email . . . . . . . . $enable_email
5312 entropy . . . . . . . $enable_entropy
5313 ethstat . . . . . . . $enable_ethstat
5314 exec . . . . . . . . $enable_exec
5315 filecount . . . . . . $enable_filecount
5316 fscache . . . . . . . $enable_fscache
5317 gmond . . . . . . . . $enable_gmond
5318 hddtemp . . . . . . . $enable_hddtemp
5319 interface . . . . . . $enable_interface
5320 ipmi . . . . . . . . $enable_ipmi
5321 iptables . . . . . . $enable_iptables
5322 ipvs . . . . . . . . $enable_ipvs
5323 irq . . . . . . . . . $enable_irq
5324 java . . . . . . . . $enable_java
5325 libvirt . . . . . . . $enable_libvirt
5326 load . . . . . . . . $enable_load
5327 logfile . . . . . . . $enable_logfile
5328 lpar... . . . . . . . $enable_lpar
5329 madwifi . . . . . . . $enable_madwifi
5330 match_empty_counter . $enable_match_empty_counter
5331 match_hashed . . . . $enable_match_hashed
5332 match_regex . . . . . $enable_match_regex
5333 match_timediff . . . $enable_match_timediff
5334 match_value . . . . . $enable_match_value
5335 mbmon . . . . . . . . $enable_mbmon
5336 md . . . . . . . . . $enable_md
5337 memcachec . . . . . . $enable_memcachec
5338 memcached . . . . . . $enable_memcached
5339 memory . . . . . . . $enable_memory
5340 modbus . . . . . . . $enable_modbus
5341 multimeter . . . . . $enable_multimeter
5342 mysql . . . . . . . . $enable_mysql
5343 netapp . . . . . . . $enable_netapp
5344 netlink . . . . . . . $enable_netlink
5345 network . . . . . . . $enable_network
5346 nfs . . . . . . . . . $enable_nfs
5347 nginx . . . . . . . . $enable_nginx
5348 notify_desktop . . . $enable_notify_desktop
5349 notify_email . . . . $enable_notify_email
5350 ntpd . . . . . . . . $enable_ntpd
5351 numa . . . . . . . . $enable_numa
5352 nut . . . . . . . . . $enable_nut
5353 olsrd . . . . . . . . $enable_olsrd
5354 onewire . . . . . . . $enable_onewire
5355 openvpn . . . . . . . $enable_openvpn
5356 oracle . . . . . . . $enable_oracle
5357 perl . . . . . . . . $enable_perl
5358 pf . . . . . . . . . $enable_pf
5359 pinba . . . . . . . . $enable_pinba
5360 ping . . . . . . . . $enable_ping
5361 postgresql . . . . . $enable_postgresql
5362 powerdns . . . . . . $enable_powerdns
5363 processes . . . . . . $enable_processes
5364 protocols . . . . . . $enable_protocols
5365 python . . . . . . . $enable_python
5366 redis . . . . . . . . $enable_redis
5367 routeros . . . . . . $enable_routeros
5368 rrdcached . . . . . . $enable_rrdcached
5369 rrdtool . . . . . . . $enable_rrdtool
5370 sensors . . . . . . . $enable_sensors
5371 serial . . . . . . . $enable_serial
5372 snmp . . . . . . . . $enable_snmp
5373 swap . . . . . . . . $enable_swap
5374 syslog . . . . . . . $enable_syslog
5375 table . . . . . . . . $enable_table
5376 tail . . . . . . . . $enable_tail
5377 tail_csv . . . . . . $enable_tail_csv
5378 tape . . . . . . . . $enable_tape
5379 target_notification . $enable_target_notification
5380 target_replace . . . $enable_target_replace
5381 target_scale . . . . $enable_target_scale
5382 target_set . . . . . $enable_target_set
5383 target_v5upgrade . . $enable_target_v5upgrade
5384 tcpconns . . . . . . $enable_tcpconns
5385 teamspeak2 . . . . . $enable_teamspeak2
5386 ted . . . . . . . . . $enable_ted
5387 thermal . . . . . . . $enable_thermal
5388 threshold . . . . . . $enable_threshold
5389 tokyotyrant . . . . . $enable_tokyotyrant
5390 unixsock . . . . . . $enable_unixsock
5391 uptime . . . . . . . $enable_uptime
5392 users . . . . . . . . $enable_users
5393 uuid . . . . . . . . $enable_uuid
5394 varnish . . . . . . . $enable_varnish
5395 vmem . . . . . . . . $enable_vmem
5396 vserver . . . . . . . $enable_vserver
5397 wireless . . . . . . $enable_wireless
5398 write_graphite . . . $enable_write_graphite
5399 write_http . . . . . $enable_write_http
5400 write_mongodb . . . . $enable_write_mongodb
5401 write_redis . . . . . $enable_write_redis
5402 write_riemann . . . . $enable_write_riemann
5403 xmms . . . . . . . . $enable_xmms
5404 zfs_arc . . . . . . . $enable_zfs_arc
5408 if test "x$dependency_error" = "xyes"; then
5409 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5412 if test "x$dependency_warning" = "xyes"; then
5413 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5416 # vim: set fdm=marker :