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 if test "x$ac_system" = "xDarwin"
1436 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1439 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1440 if test "x$with_kvm_getprocs" = "xyes"
1442 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1443 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1446 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1448 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1449 if test "x$with_kvm_getswapinfo" = "xyes"
1451 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1452 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1455 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1457 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1458 if test "x$with_kvm_nlist" = "xyes"
1460 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1461 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1462 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1465 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1467 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1468 if test "x$with_kvm_openfiles" = "xyes"
1470 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1471 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1474 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1476 # --with-libcredis {{{
1477 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1479 if test "x$withval" = "xyes"
1481 with_libcredis="yes"
1482 else if test "x$withval" = "xno"
1486 with_libcredis="yes"
1487 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1488 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1491 [with_libcredis="yes"])
1493 SAVE_CPPFLAGS="$CPPFLAGS"
1494 SAVE_LDFLAGS="$LDFLAGS"
1496 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1497 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1499 if test "x$with_libcredis" = "xyes"
1501 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1503 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1505 AC_CHECK_HEADERS(credis.h,
1506 [with_libcredis="yes"],
1507 [with_libcredis="no (credis.h not found)"])
1509 if test "x$with_libcredis" = "xyes"
1511 if test "x$LIBCREDIS_LDFLAGS" != "x"
1513 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1515 AC_CHECK_LIB(credis, credis_info,
1516 [with_libcredis="yes"],
1517 [with_libcredis="no (symbol 'credis_info' not found)"])
1521 CPPFLAGS="$SAVE_CPPFLAGS"
1522 LDFLAGS="$SAVE_LDFLAGS"
1524 if test "x$with_libcredis" = "xyes"
1526 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1527 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1528 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1529 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1531 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1534 # --with-libcurl {{{
1535 with_curl_config="curl-config"
1538 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1540 if test "x$withval" = "xno"
1543 else if test "x$withval" = "xyes"
1547 if test -f "$withval" && test -x "$withval"
1549 with_curl_config="$withval"
1551 else if test -x "$withval/bin/curl-config"
1553 with_curl_config="$withval/bin/curl-config"
1562 if test "x$with_libcurl" = "xyes"
1564 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1565 curl_config_status=$?
1567 if test $curl_config_status -ne 0
1569 with_libcurl="no ($with_curl_config failed)"
1571 SAVE_CPPFLAGS="$CPPFLAGS"
1572 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1574 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1576 CPPFLAGS="$SAVE_CPPFLAGS"
1579 if test "x$with_libcurl" = "xyes"
1581 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1582 curl_config_status=$?
1584 if test $curl_config_status -ne 0
1586 with_libcurl="no ($with_curl_config failed)"
1588 AC_CHECK_LIB(curl, curl_easy_init,
1589 [with_libcurl="yes"],
1590 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1594 if test "x$with_libcurl" = "xyes"
1596 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1597 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1598 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1599 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1601 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1605 with_libdbi_cppflags=""
1606 with_libdbi_ldflags=""
1607 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1609 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1611 with_libdbi_cppflags="-I$withval/include"
1612 with_libdbi_ldflags="-L$withval/lib"
1615 with_libdbi="$withval"
1621 if test "x$with_libdbi" = "xyes"
1623 SAVE_CPPFLAGS="$CPPFLAGS"
1624 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1626 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1628 CPPFLAGS="$SAVE_CPPFLAGS"
1630 if test "x$with_libdbi" = "xyes"
1632 SAVE_CPPFLAGS="$CPPFLAGS"
1633 SAVE_LDFLAGS="$LDFLAGS"
1634 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1635 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1637 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1639 CPPFLAGS="$SAVE_CPPFLAGS"
1640 LDFLAGS="$SAVE_LDFLAGS"
1642 if test "x$with_libdbi" = "xyes"
1644 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1645 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1646 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1647 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1648 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1649 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1651 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1654 # --with-libesmtp {{{
1655 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1657 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1659 LDFLAGS="$LDFLAGS -L$withval/lib"
1660 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1663 with_libesmtp="$withval"
1669 if test "x$with_libesmtp" = "xyes"
1671 AC_CHECK_LIB(esmtp, smtp_create_session,
1673 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1674 ], [with_libesmtp="no (libesmtp not found)"])
1676 if test "x$with_libesmtp" = "xyes"
1678 AC_CHECK_HEADERS(libesmtp.h,
1680 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1681 ], [with_libesmtp="no (libesmtp.h not found)"])
1683 if test "x$with_libesmtp" = "xyes"
1689 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1690 [Wether or not to use the esmtp library])
1691 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1694 # --with-libganglia {{{
1695 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1697 if test -f "$withval" && test -x "$withval"
1699 with_libganglia_config="$withval"
1700 with_libganglia="yes"
1701 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1703 with_libganglia_config="$withval/bin/ganglia-config"
1704 with_libganglia="yes"
1705 else if test -d "$withval"
1707 GANGLIA_CPPFLAGS="-I$withval/include"
1708 GANGLIA_LDFLAGS="-L$withval/lib"
1709 with_libganglia="yes"
1711 with_libganglia_config="ganglia-config"
1712 with_libganglia="$withval"
1716 with_libganglia_config="ganglia-config"
1717 with_libganglia="yes"
1720 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1722 if test "x$GANGLIA_CPPFLAGS" = "x"
1724 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1727 if test "x$GANGLIA_LDFLAGS" = "x"
1729 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1732 if test "x$GANGLIA_LIBS" = "x"
1734 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1738 SAVE_CPPFLAGS="$CPPFLAGS"
1739 SAVE_LDFLAGS="$LDFLAGS"
1740 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1741 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1743 if test "x$with_libganglia" = "xyes"
1745 AC_CHECK_HEADERS(gm_protocol.h,
1747 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1748 [Define to 1 if you have the <gm_protocol.h> header file.])
1749 ], [with_libganglia="no (gm_protocol.h not found)"])
1752 if test "x$with_libganglia" = "xyes"
1754 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1756 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1757 [Define to 1 if you have the ganglia library (-lganglia).])
1758 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1761 CPPFLAGS="$SAVE_CPPFLAGS"
1762 LDFLAGS="$SAVE_LDFLAGS"
1764 AC_SUBST(GANGLIA_CPPFLAGS)
1765 AC_SUBST(GANGLIA_LDFLAGS)
1766 AC_SUBST(GANGLIA_LIBS)
1767 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1770 # --with-libgcrypt {{{
1771 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1772 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1773 GCRYPT_LIBS="$GCRYPT_LIBS"
1774 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1776 if test -f "$withval" && test -x "$withval"
1778 with_libgcrypt_config="$withval"
1779 with_libgcrypt="yes"
1780 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1782 with_libgcrypt_config="$withval/bin/gcrypt-config"
1783 with_libgcrypt="yes"
1784 else if test -d "$withval"
1786 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1787 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1788 with_libgcrypt="yes"
1790 with_libgcrypt_config="gcrypt-config"
1791 with_libgcrypt="$withval"
1795 with_libgcrypt_config="libgcrypt-config"
1796 with_libgcrypt="yes"
1799 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1801 if test "x$GCRYPT_CPPFLAGS" = "x"
1803 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1806 if test "x$GCRYPT_LDFLAGS" = "x"
1808 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1809 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1812 if test "x$GCRYPT_LIBS" = "x"
1814 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1818 SAVE_CPPFLAGS="$CPPFLAGS"
1819 SAVE_LDFLAGS="$LDFLAGS"
1820 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1821 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1823 if test "x$with_libgcrypt" = "xyes"
1825 if test "x$GCRYPT_CPPFLAGS" != "x"
1827 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1829 AC_CHECK_HEADERS(gcrypt.h,
1830 [with_libgcrypt="yes"],
1831 [with_libgcrypt="no (gcrypt.h not found)"])
1834 if test "x$with_libgcrypt" = "xyes"
1836 if test "x$GCRYPT_LDFLAGS" != "x"
1838 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1840 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1841 [with_libgcrypt="yes"],
1842 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1844 if test "$with_libgcrypt" != "no"; then
1845 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1846 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
1847 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
1851 CPPFLAGS="$SAVE_CPPFLAGS"
1852 LDFLAGS="$SAVE_LDFLAGS"
1854 if test "x$with_libgcrypt" = "xyes"
1856 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1859 AC_SUBST(GCRYPT_CPPFLAGS)
1860 AC_SUBST(GCRYPT_LDFLAGS)
1861 AC_SUBST(GCRYPT_LIBS)
1862 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1865 # --with-libiptc {{{
1866 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1868 if test "x$withval" = "xshipped"
1871 else if test "x$withval" = "xyes"
1873 with_libiptc="pkgconfig"
1874 else if test "x$withval" = "xno"
1879 with_libiptc_cflags="-I$withval/include"
1880 with_libiptc_libs="-L$withval/lib"
1884 if test "x$ac_system" = "xLinux"
1886 with_libiptc="pkgconfig"
1888 with_libiptc="no (Linux only)"
1892 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1894 with_libiptc="no (Don't have pkg-config)"
1897 if test "x$with_libiptc" = "xpkgconfig"
1899 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1902 with_libiptc="no (pkg-config doesn't know libiptc)"
1905 if test "x$with_libiptc" = "xpkgconfig"
1907 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1910 with_libiptc="no ($PKG_CONFIG failed)"
1912 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1915 with_libiptc="no ($PKG_CONFIG failed)"
1919 SAVE_CPPFLAGS="$CPPFLAGS"
1920 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1922 # check whether the header file for libiptc is available.
1923 if test "x$with_libiptc" = "xpkgconfig"
1925 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1926 [with_libiptc="no (header file missing)"])
1928 # If the header file is available, check for the required type declaractions.
1929 # They may be missing in old versions of libiptc. In that case, they will be
1930 # declared in the iptables plugin.
1931 if test "x$with_libiptc" = "xpkgconfig"
1933 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1935 # Check for the iptc_init symbol in the library.
1936 # This could be in iptc or ip4tc
1937 if test "x$with_libiptc" = "xpkgconfig"
1940 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1941 [with_libiptc="pkgconfig"],
1942 [with_libiptc="no"],
1943 [$with_libiptc_libs])
1946 if test "x$with_libiptc" = "xpkgconfig"
1951 CPPFLAGS="$SAVE_CPPFLAGS"
1953 if test "x$with_libiptc" = "xown"
1955 with_libiptc_cflags=""
1956 with_libiptc_libs=""
1958 if test "x$with_libiptc" = "xown"
1960 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1962 with_libiptc="no (Linux iptables headers not found)"
1965 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1968 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1969 if test "x$with_libiptc" = "xown"
1971 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1975 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1976 if test "x$with_libiptc" = "xyes"
1978 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1979 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1980 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1981 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1986 with_java_home="$JAVA_HOME"
1987 with_java_vmtype="client"
1992 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1994 if test "x$withval" = "xno"
1997 else if test "x$withval" = "xyes"
2001 with_java_home="$withval"
2006 if test "x$with_java" = "xyes"
2008 if test -d "$with_java_home"
2010 AC_MSG_CHECKING([for jni.h])
2011 TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2012 if test "x$TMPVAR" != "x"
2014 AC_MSG_RESULT([found in $TMPVAR])
2015 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2017 AC_MSG_RESULT([not found])
2020 AC_MSG_CHECKING([for jni_md.h])
2021 TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2022 if test "x$TMPVAR" != "x"
2024 AC_MSG_RESULT([found in $TMPVAR])
2025 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2027 AC_MSG_RESULT([not found])
2030 AC_MSG_CHECKING([for libjvm.so])
2031 TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2032 if test "x$TMPVAR" != "x"
2034 AC_MSG_RESULT([found in $TMPVAR])
2035 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
2037 AC_MSG_RESULT([not found])
2040 if test "x$JAVAC" = "x"
2042 AC_MSG_CHECKING([for javac])
2043 TMPVAR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2044 if test "x$TMPVAR" != "x"
2047 AC_MSG_RESULT([$JAVAC])
2049 AC_MSG_RESULT([not found])
2052 if test "x$JAR" = "x"
2054 AC_MSG_CHECKING([for jar])
2055 TMPVAR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2056 if test "x$TMPVAR" != "x"
2059 AC_MSG_RESULT([$JAR])
2061 AC_MSG_RESULT([not found])
2064 else if test "x$with_java_home" != "x"
2066 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2070 if test "x$JAVA_CPPFLAGS" != "x"
2072 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2074 if test "x$JAVA_CFLAGS" != "x"
2076 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2078 if test "x$JAVA_LDFLAGS" != "x"
2080 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2082 if test "x$JAVAC" = "x"
2084 with_javac_path="$PATH"
2085 if test "x$with_java_home" != "x"
2087 with_javac_path="$with_java_home:with_javac_path"
2088 if test -d "$with_java_home/bin"
2090 with_javac_path="$with_java_home/bin:with_javac_path"
2094 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2096 if test "x$JAVAC" = "x"
2098 with_java="no (javac not found)"
2100 if test "x$JAR" = "x"
2102 with_jar_path="$PATH"
2103 if test "x$with_java_home" != "x"
2105 with_jar_path="$with_java_home:$with_jar_path"
2106 if test -d "$with_java_home/bin"
2108 with_jar_path="$with_java_home/bin:$with_jar_path"
2112 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2114 if test "x$JAR" = "x"
2116 with_java="no (jar not found)"
2119 SAVE_CPPFLAGS="$CPPFLAGS"
2120 SAVE_CFLAGS="$CFLAGS"
2121 SAVE_LDFLAGS="$LDFLAGS"
2122 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2123 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2124 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2126 if test "x$with_java" = "xyes"
2128 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2130 if test "x$with_java" = "xyes"
2132 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2134 [with_java="no (libjvm not found)"],
2137 if test "x$with_java" = "xyes"
2139 JAVA_LIBS="$JAVA_LIBS -ljvm"
2140 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2143 CPPFLAGS="$SAVE_CPPFLAGS"
2144 CFLAGS="$SAVE_CFLAGS"
2145 LDFLAGS="$SAVE_LDFLAGS"
2147 AC_SUBST(JAVA_CPPFLAGS)
2148 AC_SUBST(JAVA_CFLAGS)
2149 AC_SUBST(JAVA_LDFLAGS)
2151 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2154 # --with-libmemcached {{{
2155 with_libmemcached_cppflags=""
2156 with_libmemcached_ldflags=""
2157 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2159 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2161 with_libmemcached_cppflags="-I$withval/include"
2162 with_libmemcached_ldflags="-L$withval/lib"
2163 with_libmemcached="yes"
2165 with_libmemcached="$withval"
2169 with_libmemcached="yes"
2171 if test "x$with_libmemcached" = "xyes"
2173 SAVE_CPPFLAGS="$CPPFLAGS"
2174 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2176 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2178 CPPFLAGS="$SAVE_CPPFLAGS"
2180 if test "x$with_libmemcached" = "xyes"
2182 SAVE_CPPFLAGS="$CPPFLAGS"
2183 SAVE_LDFLAGS="$LDFLAGS"
2184 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2185 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2187 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2189 CPPFLAGS="$SAVE_CPPFLAGS"
2190 LDFLAGS="$SAVE_LDFLAGS"
2192 if test "x$with_libmemcached" = "xyes"
2194 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2195 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2196 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2197 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2198 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2199 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2200 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2202 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2205 # --with-libmodbus {{{
2206 with_libmodbus_config=""
2207 with_libmodbus_cflags=""
2208 with_libmodbus_libs=""
2209 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2211 if test "x$withval" = "xno"
2214 else if test "x$withval" = "xyes"
2216 with_libmodbus="use_pkgconfig"
2217 else if test -d "$with_libmodbus/lib"
2219 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2220 with_libmodbus_cflags="-I$withval/include"
2221 with_libmodbus_libs="-L$withval/lib -lmodbus"
2222 with_libmodbus="yes"
2225 [with_libmodbus="use_pkgconfig"])
2227 # configure using pkg-config
2228 if test "x$with_libmodbus" = "xuse_pkgconfig"
2230 if test "x$PKG_CONFIG" = "x"
2232 with_libmodbus="no (Don't have pkg-config)"
2235 if test "x$with_libmodbus" = "xuse_pkgconfig"
2237 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2238 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2241 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2244 if test "x$with_libmodbus" = "xuse_pkgconfig"
2246 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2249 with_libmodbus="no ($PKG_CONFIG failed)"
2251 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2254 with_libmodbus="no ($PKG_CONFIG failed)"
2257 if test "x$with_libmodbus" = "xuse_pkgconfig"
2259 with_libmodbus="yes"
2262 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2263 # the actual checks.
2264 if test "x$with_libmodbus" = "xyes"
2266 SAVE_CPPFLAGS="$CPPFLAGS"
2267 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2269 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2271 CPPFLAGS="$SAVE_CPPFLAGS"
2273 if test "x$with_libmodbus" = "xyes"
2275 SAVE_CPPFLAGS="$CPPFLAGS"
2276 SAVE_LDFLAGS="$LDFLAGS"
2278 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2279 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2281 AC_CHECK_LIB(modbus, modbus_connect,
2282 [with_libmodbus="yes"],
2283 [with_libmodbus="no (symbol modbus_connect not found)"])
2285 CPPFLAGS="$SAVE_CPPFLAGS"
2286 LDFLAGS="$SAVE_LDFLAGS"
2288 if test "x$with_libmodbus" = "xyes"
2290 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2291 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2292 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2293 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2297 # --with-libmongoc {{{
2298 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2300 if test "x$withval" = "xyes"
2302 with_libmongoc="yes"
2303 else if test "x$withval" = "xno"
2307 with_libmongoc="yes"
2308 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2309 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2312 [with_libmongoc="yes"])
2314 SAVE_CPPFLAGS="$CPPFLAGS"
2315 SAVE_LDFLAGS="$LDFLAGS"
2317 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2318 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2320 if test "x$with_libmongoc" = "xyes"
2322 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2324 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2326 AC_CHECK_HEADERS(mongo.h,
2327 [with_libmongoc="yes"],
2328 [with_libmongoc="no ('mongo.h' not found)"],
2330 # define MONGO_HAVE_STDINT 1
2332 # define MONGO_USE_LONG_LONG_INT 1
2336 if test "x$with_libmongoc" = "xyes"
2338 if test "x$LIBMONGOC_LDFLAGS" != "x"
2340 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2342 AC_CHECK_LIB(mongoc, mongo_run_command,
2343 [with_libmongoc="yes"],
2344 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2347 CPPFLAGS="$SAVE_CPPFLAGS"
2348 LDFLAGS="$SAVE_LDFLAGS"
2350 if test "x$with_libmongoc" = "xyes"
2352 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2353 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2354 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2355 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2357 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2360 # --with-libmysql {{{
2361 with_mysql_config="mysql_config"
2362 with_mysql_cflags=""
2364 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2366 if test "x$withval" = "xno"
2369 else if test "x$withval" = "xyes"
2373 if test -f "$withval" && test -x "$withval";
2375 with_mysql_config="$withval"
2376 else if test -x "$withval/bin/mysql_config"
2378 with_mysql_config="$withval/bin/mysql_config"
2386 if test "x$with_libmysql" = "xyes"
2388 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2389 mysql_config_status=$?
2391 if test $mysql_config_status -ne 0
2393 with_libmysql="no ($with_mysql_config failed)"
2395 SAVE_CPPFLAGS="$CPPFLAGS"
2396 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2399 have_mysql_mysql_h="no"
2400 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2402 if test "x$have_mysql_h" = "xno"
2404 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2407 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2409 with_libmysql="no (mysql.h not found)"
2412 CPPFLAGS="$SAVE_CPPFLAGS"
2415 if test "x$with_libmysql" = "xyes"
2417 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2418 mysql_config_status=$?
2420 if test $mysql_config_status -ne 0
2422 with_libmysql="no ($with_mysql_config failed)"
2424 AC_CHECK_LIB(mysqlclient, mysql_init,
2425 [with_libmysql="yes"],
2426 [with_libmysql="no (symbol 'mysql_init' not found)"],
2429 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2430 [with_libmysql="yes"],
2431 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2435 if test "x$with_libmysql" = "xyes"
2437 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2438 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2439 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2440 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2442 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2445 # --with-libnetlink {{{
2446 with_libnetlink_cflags=""
2447 with_libnetlink_libs="-lnetlink"
2448 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2450 echo "libnetlink: withval = $withval"
2451 if test "x$withval" = "xyes"
2453 with_libnetlink="yes"
2454 else if test "x$withval" = "xno"
2456 with_libnetlink="no"
2458 if test -d "$withval/include"
2460 with_libnetlink_cflags="-I$withval/include"
2461 with_libnetlink_libs="-L$withval/lib -lnetlink"
2462 with_libnetlink="yes"
2464 AC_MSG_ERROR("no such directory: $withval/include")
2469 if test "x$ac_system" = "xLinux"
2471 with_libnetlink="yes"
2473 with_libnetlink="no (Linux only library)"
2476 if test "x$with_libnetlink" = "xyes"
2478 SAVE_CFLAGS="$CFLAGS"
2479 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2481 with_libnetlink="no (libnetlink.h not found)"
2483 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2485 with_libnetlink="yes"
2489 #include <sys/types.h>
2490 #include <asm/types.h>
2491 #include <sys/socket.h>
2492 #include <linux/netlink.h>
2493 #include <linux/rtnetlink.h>])
2494 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2496 #include <sys/types.h>
2497 #include <asm/types.h>
2498 #include <sys/socket.h>])
2500 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2503 #include <sys/types.h>
2504 #include <asm/types.h>
2505 #include <sys/socket.h>
2506 #include <linux/netlink.h>
2507 #include <linux/rtnetlink.h>
2510 int retval = TCA_STATS2;
2514 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2516 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2519 #include <sys/types.h>
2520 #include <asm/types.h>
2521 #include <sys/socket.h>
2522 #include <linux/netlink.h>
2523 #include <linux/rtnetlink.h>
2526 int retval = TCA_STATS;
2530 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2532 CFLAGS="$SAVE_CFLAGS"
2534 if test "x$with_libnetlink" = "xyes"
2536 AC_CHECK_LIB(netlink, rtnl_open,
2537 [with_libnetlink="yes"],
2538 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2539 [$with_libnetlink_libs])
2541 if test "x$with_libnetlink" = "xyes"
2543 SAVE_CFLAGS="$CFLAGS"
2544 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2547 [if function 'rtnl_dump_filter' expects five arguments],
2548 [c_cv_rtnl_dump_filter_five_args],
2549 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2552 #include <sys/types.h>
2553 #include <asm/types.h>
2554 #include <sys/socket.h>
2555 #if HAVE_LIBNETLINK_H
2556 # include <libnetlink.h>
2557 #elif HAVE_IPROUTE_LIBNETLINK_H
2558 # include <iproute/libnetlink.h>
2559 #elif HAVE_LINUX_LIBNETLINK_H
2560 # include <linux/libnetlink.h>
2564 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2569 [c_cv_rtnl_dump_filter_five_args="yes"],
2570 [c_cv_rtnl_dump_filter_five_args="no"]
2575 [if function 'rtnl_dump_filter' expects three arguments],
2576 [c_cv_rtnl_dump_filter_three_args],
2577 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2580 #include <sys/types.h>
2581 #include <asm/types.h>
2582 #include <sys/socket.h>
2583 #if HAVE_LIBNETLINK_H
2584 # include <libnetlink.h>
2585 #elif HAVE_IPROUTE_LIBNETLINK_H
2586 # include <iproute/libnetlink.h>
2587 #elif HAVE_LINUX_LIBNETLINK_H
2588 # include <linux/libnetlink.h>
2592 if (rtnl_dump_filter(NULL, NULL, NULL))
2597 [c_cv_rtnl_dump_filter_three_args="yes"],
2598 [c_cv_rtnl_dump_filter_three_args="no"]
2602 CFLAGS="$SAVE_CFLAGS"
2604 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2606 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2607 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2609 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2611 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2612 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2615 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2616 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2617 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2618 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2620 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2623 # --with-libnetapp {{{
2624 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2625 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2626 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2627 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2628 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2629 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2630 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2632 if test -d "$withval"
2634 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2635 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2636 with_libnetapp="yes"
2638 with_libnetapp="$withval"
2642 with_libnetapp="yes"
2645 SAVE_CPPFLAGS="$CPPFLAGS"
2646 SAVE_LDFLAGS="$LDFLAGS"
2647 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2648 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2650 if test "x$with_libnetapp" = "xyes"
2652 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2654 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2656 AC_CHECK_HEADERS(netapp_api.h,
2657 [with_libnetapp="yes"],
2658 [with_libnetapp="no (netapp_api.h not found)"])
2661 if test "x$with_libnetapp" = "xyes"
2663 if test "x$LIBNETAPP_LDFLAGS" != "x"
2665 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2668 if test "x$LIBNETAPP_LIBS" = "x"
2670 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2672 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2674 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2675 [with_libnetapp="yes"],
2676 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2678 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2681 CPPFLAGS="$SAVE_CPPFLAGS"
2682 LDFLAGS="$SAVE_LDFLAGS"
2684 if test "x$with_libnetapp" = "xyes"
2686 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2689 AC_SUBST(LIBNETAPP_CPPFLAGS)
2690 AC_SUBST(LIBNETAPP_LDFLAGS)
2691 AC_SUBST(LIBNETAPP_LIBS)
2692 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2695 # --with-libnetsnmp {{{
2696 with_snmp_config="net-snmp-config"
2699 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2701 if test "x$withval" = "xno"
2703 with_libnetsnmp="no"
2704 else if test "x$withval" = "xyes"
2706 with_libnetsnmp="yes"
2708 if test -x "$withval"
2710 with_snmp_config="$withval"
2711 with_libnetsnmp="yes"
2713 with_snmp_config="$withval/bin/net-snmp-config"
2714 with_libnetsnmp="yes"
2718 [with_libnetsnmp="yes"])
2719 if test "x$with_libnetsnmp" = "xyes"
2721 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2722 snmp_config_status=$?
2724 if test $snmp_config_status -ne 0
2726 with_libnetsnmp="no ($with_snmp_config failed)"
2728 SAVE_CPPFLAGS="$CPPFLAGS"
2729 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2731 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2733 CPPFLAGS="$SAVE_CPPFLAGS"
2736 if test "x$with_libnetsnmp" = "xyes"
2738 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2739 snmp_config_status=$?
2741 if test $snmp_config_status -ne 0
2743 with_libnetsnmp="no ($with_snmp_config failed)"
2745 AC_CHECK_LIB(netsnmp, init_snmp,
2746 [with_libnetsnmp="yes"],
2747 [with_libnetsnmp="no (libnetsnmp not found)"],
2751 if test "x$with_libnetsnmp" = "xyes"
2753 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2754 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2755 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2756 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2758 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2761 # --with-liboconfig {{{
2762 with_own_liboconfig="no"
2763 liboconfig_LDFLAGS="$LDFLAGS"
2764 liboconfig_CPPFLAGS="$CPPFLAGS"
2765 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2767 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2769 if test -d "$withval/lib"
2771 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2773 if test -d "$withval/include"
2775 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2778 if test "x$withval" = "xno"
2780 AC_MSG_ERROR("liboconfig is required")
2784 with_liboconfig="yes"
2787 save_LDFLAGS="$LDFLAGS"
2788 save_CPPFLAGS="$CPPFLAGS"
2789 LDFLAGS="$liboconfig_LDFLAGS"
2790 CPPFLAGS="$liboconfig_CPPFLAGS"
2791 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2793 with_liboconfig="yes"
2794 with_own_liboconfig="no"
2797 with_liboconfig="yes"
2798 with_own_liboconfig="yes"
2799 LDFLAGS="$save_LDFLAGS"
2800 CPPFLAGS="$save_CPPFLAGS"
2803 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2804 if test "x$with_own_liboconfig" = "xyes"
2806 with_liboconfig="yes (shipped version)"
2810 # --with-liboping {{{
2811 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2813 if test "x$withval" = "xyes"
2816 else if test "x$withval" = "xno"
2821 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2822 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2825 [with_liboping="yes"])
2827 SAVE_CPPFLAGS="$CPPFLAGS"
2828 SAVE_LDFLAGS="$LDFLAGS"
2830 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2831 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2833 if test "x$with_liboping" = "xyes"
2835 if test "x$LIBOPING_CPPFLAGS" != "x"
2837 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2839 AC_CHECK_HEADERS(oping.h,
2840 [with_liboping="yes"],
2841 [with_liboping="no (oping.h not found)"])
2843 if test "x$with_liboping" = "xyes"
2845 if test "x$LIBOPING_LDFLAGS" != "x"
2847 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2849 AC_CHECK_LIB(oping, ping_construct,
2850 [with_liboping="yes"],
2851 [with_liboping="no (symbol 'ping_construct' not found)"])
2854 CPPFLAGS="$SAVE_CPPFLAGS"
2855 LDFLAGS="$SAVE_LDFLAGS"
2857 if test "x$with_liboping" = "xyes"
2859 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2860 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2861 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2862 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2864 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2868 with_oracle_cppflags=""
2870 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2872 if test "x$withval" = "xyes"
2874 if test "x$ORACLE_HOME" = "x"
2876 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2879 else if test "x$withval" = "xno"
2884 ORACLE_HOME="$withval"
2888 if test "x$ORACLE_HOME" = "x"
2890 with_oracle="no (ORACLE_HOME is not set)"
2895 if test "x$ORACLE_HOME" != "x"
2897 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2899 if test -e "$ORACLE_HOME/lib/ldflags"
2901 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2903 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2904 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2906 if test "x$with_oracle" = "xyes"
2908 SAVE_CPPFLAGS="$CPPFLAGS"
2909 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2911 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2913 CPPFLAGS="$SAVE_CPPFLAGS"
2915 if test "x$with_oracle" = "xyes"
2917 SAVE_CPPFLAGS="$CPPFLAGS"
2918 SAVE_LDFLAGS="$LDFLAGS"
2919 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2920 LDFLAGS="$LDFLAGS $with_oracle_libs"
2922 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2924 CPPFLAGS="$SAVE_CPPFLAGS"
2925 LDFLAGS="$SAVE_LDFLAGS"
2927 if test "x$with_oracle" = "xyes"
2929 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2930 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2931 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2932 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2936 # --with-libowcapi {{{
2937 with_libowcapi_cppflags=""
2938 with_libowcapi_libs="-lowcapi"
2939 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2941 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2943 with_libowcapi_cppflags="-I$withval/include"
2944 with_libowcapi_libs="-L$withval/lib -lowcapi"
2945 with_libowcapi="yes"
2947 with_libowcapi="$withval"
2951 with_libowcapi="yes"
2953 if test "x$with_libowcapi" = "xyes"
2955 SAVE_CPPFLAGS="$CPPFLAGS"
2956 CPPFLAGS="$with_libowcapi_cppflags"
2958 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2960 CPPFLAGS="$SAVE_CPPFLAGS"
2962 if test "x$with_libowcapi" = "xyes"
2964 SAVE_LDFLAGS="$LDFLAGS"
2965 SAVE_CPPFLAGS="$CPPFLAGS"
2966 LDFLAGS="$with_libowcapi_libs"
2967 CPPFLAGS="$with_libowcapi_cppflags"
2969 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2971 LDFLAGS="$SAVE_LDFLAGS"
2972 CPPFLAGS="$SAVE_CPPFLAGS"
2974 if test "x$with_libowcapi" = "xyes"
2976 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2977 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2978 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2979 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2983 # --with-libpcap {{{
2984 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2986 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2988 LDFLAGS="$LDFLAGS -L$withval/lib"
2989 CPPFLAGS="$CPPFLAGS -I$withval/include"
2992 with_libpcap="$withval"
2998 if test "x$with_libpcap" = "xyes"
3000 AC_CHECK_LIB(pcap, pcap_open_live,
3002 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
3003 ], [with_libpcap="no (libpcap not found)"])
3005 if test "x$with_libpcap" = "xyes"
3007 AC_CHECK_HEADERS(pcap.h,,
3008 [with_libpcap="no (pcap.h not found)"])
3010 if test "x$with_libpcap" = "xyes"
3012 AC_CHECK_HEADERS(pcap-bpf.h,,
3013 [with_libpcap="no (pcap-bpf.h not found)"])
3015 if test "x$with_libpcap" = "xyes"
3017 AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP],
3018 [c_cv_libpcap_have_pcap_error_iface_not_up],
3019 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
3024 int val = PCAP_ERROR_IFACE_NOT_UP;
3027 [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
3028 [c_cv_libpcap_have_pcap_error_iface_not_up="no"]))
3030 if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes"
3032 with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)"
3034 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3037 # --with-libperl {{{
3038 perl_interpreter="perl"
3039 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3041 if test -f "$withval" && test -x "$withval"
3043 perl_interpreter="$withval"
3045 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3047 LDFLAGS="$LDFLAGS -L$withval/lib"
3048 CPPFLAGS="$CPPFLAGS -I$withval/include"
3049 perl_interpreter="$withval/bin/perl"
3052 with_libperl="$withval"
3059 AC_MSG_CHECKING([for perl])
3060 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3061 if test -x "$perl_interpreter"
3063 AC_MSG_RESULT([yes ($perl_interpreter)])
3069 AC_SUBST(PERL, "$perl_interpreter")
3071 if test "x$with_libperl" = "xyes" \
3072 && test -n "$perl_interpreter"
3074 SAVE_CFLAGS="$CFLAGS"
3075 SAVE_LDFLAGS="$LDFLAGS"
3076 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3077 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3078 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3079 CFLAGS="$CFLAGS $PERL_CFLAGS"
3080 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3082 AC_CACHE_CHECK([for libperl],
3083 [c_cv_have_libperl],
3084 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3086 #define PERL_NO_GET_CONTEXT
3093 load_module (PERL_LOADMOD_NOIMPORT,
3094 newSVpv ("Collectd::Plugin::FooBar", 24),
3098 [c_cv_have_libperl="yes"],
3099 [c_cv_have_libperl="no"]
3103 if test "x$c_cv_have_libperl" = "xyes"
3105 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3106 AC_SUBST(PERL_CFLAGS)
3107 AC_SUBST(PERL_LDFLAGS)
3112 CFLAGS="$SAVE_CFLAGS"
3113 LDFLAGS="$SAVE_LDFLAGS"
3114 else if test -z "$perl_interpreter"; then
3115 with_libperl="no (no perl interpreter found)"
3116 c_cv_have_libperl="no"
3118 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3120 if test "x$with_libperl" = "xyes"
3122 SAVE_CFLAGS="$CFLAGS"
3123 SAVE_LDFLAGS="$LDFLAGS"
3124 CFLAGS="$CFLAGS $PERL_CFLAGS"
3125 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3127 AC_CACHE_CHECK([if perl supports ithreads],
3128 [c_cv_have_perl_ithreads],
3129 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3135 #if !defined(USE_ITHREADS)
3136 # error "Perl does not support ithreads!"
3137 #endif /* !defined(USE_ITHREADS) */
3141 [c_cv_have_perl_ithreads="yes"],
3142 [c_cv_have_perl_ithreads="no"]
3146 if test "x$c_cv_have_perl_ithreads" = "xyes"
3148 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3151 CFLAGS="$SAVE_CFLAGS"
3152 LDFLAGS="$SAVE_LDFLAGS"
3155 if test "x$with_libperl" = "xyes"
3157 SAVE_CFLAGS="$CFLAGS"
3158 SAVE_LDFLAGS="$LDFLAGS"
3159 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3160 # (see issues #41 and #42)
3161 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3162 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3164 AC_CACHE_CHECK([for broken Perl_load_module()],
3165 [c_cv_have_broken_perl_load_module],
3166 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3168 #define PERL_NO_GET_CONTEXT
3175 load_module (PERL_LOADMOD_NOIMPORT,
3176 newSVpv ("Collectd::Plugin::FooBar", 24),
3180 [c_cv_have_broken_perl_load_module="no"],
3181 [c_cv_have_broken_perl_load_module="yes"]
3185 CFLAGS="$SAVE_CFLAGS"
3186 LDFLAGS="$SAVE_LDFLAGS"
3188 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3189 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3191 if test "x$with_libperl" = "xyes"
3193 SAVE_CFLAGS="$CFLAGS"
3194 SAVE_LDFLAGS="$LDFLAGS"
3195 CFLAGS="$CFLAGS $PERL_CFLAGS"
3196 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3199 [struct mgvtbl.svt_local],
3200 [have_struct_mgvtbl_svt_local="yes"],
3201 [have_struct_mgvtbl_svt_local="no"],
3208 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3210 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3211 [Define if Perl's struct mgvtbl has member svt_local.])
3214 CFLAGS="$SAVE_CFLAGS"
3215 LDFLAGS="$SAVE_LDFLAGS"
3220 with_pg_config="pg_config"
3221 with_libpq_includedir=""
3222 with_libpq_libdir=""
3223 with_libpq_cppflags=""
3224 with_libpq_ldflags=""
3225 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3228 if test "x$withval" = "xno"
3231 else if test "x$withval" = "xyes"
3235 if test -f "$withval" && test -x "$withval";
3237 with_pg_config="$withval"
3238 else if test -x "$withval/bin/pg_config"
3240 with_pg_config="$withval/bin/pg_config"
3248 if test "x$with_libpq" = "xyes"
3250 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3253 if test $pg_config_status -eq 0
3255 if test -n "$with_libpq_includedir"; then
3256 for dir in $with_libpq_includedir; do
3257 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3261 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3264 SAVE_CPPFLAGS="$CPPFLAGS"
3265 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3267 AC_CHECK_HEADERS(libpq-fe.h, [],
3268 [with_libpq="no (libpq-fe.h not found)"], [])
3270 CPPFLAGS="$SAVE_CPPFLAGS"
3272 if test "x$with_libpq" = "xyes"
3274 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3277 if test $pg_config_status -eq 0
3279 if test -n "$with_libpq_libdir"; then
3280 for dir in $with_libpq_libdir; do
3281 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3285 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3288 SAVE_LDFLAGS="$LDFLAGS"
3289 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3291 AC_CHECK_LIB(pq, PQconnectdb,
3293 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3295 AC_CHECK_LIB(pq, PQserverVersion,
3297 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3299 LDFLAGS="$SAVE_LDFLAGS"
3301 if test "x$with_libpq" = "xyes"
3303 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3304 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3305 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3306 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3308 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3311 # --with-libpthread {{{
3312 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3313 [ if test "x$withval" != "xno" \
3314 && test "x$withval" != "xyes"
3316 LDFLAGS="$LDFLAGS -L$withval/lib"
3317 CPPFLAGS="$CPPFLAGS -I$withval/include"
3318 with_libpthread="yes"
3320 if test "x$withval" = "xno"
3322 with_libpthread="no (disabled)"
3325 ], [with_libpthread="yes"])
3326 if test "x$with_libpthread" = "xyes"
3328 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3331 if test "x$with_libpthread" = "xyes"
3333 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3335 if test "x$with_libpthread" = "xyes"
3341 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3342 [Wether or not to use pthread (POSIX threads) library])
3343 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3348 with_python_path="$PATH"
3349 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3351 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3353 with_python="$withval"
3354 else if test -x "$withval"
3356 with_python_prog="$withval"
3357 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3359 else if test -d "$withval"
3361 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3364 AC_MSG_WARN([Argument not recognized: $withval])
3366 ], [with_python="yes"])
3369 SAVE_CPPFLAGS="$CPPFLAGS"
3370 SAVE_LDFLAGS="$LDFLAGS"
3373 PATH="$with_python_path"
3375 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3377 AC_MSG_CHECKING([for python])
3378 with_python_prog="`which python 2>/dev/null`"
3379 if test "x$with_python_prog" = "x"
3381 AC_MSG_RESULT([not found])
3382 with_python="no (interpreter not found)"
3384 AC_MSG_RESULT([$with_python_prog])
3388 if test "x$with_python" = "xyes"
3390 AC_MSG_CHECKING([for Python CPPFLAGS])
3391 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3392 python_config_status=$?
3394 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3396 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3399 AC_MSG_RESULT([$python_include_path])
3403 if test "x$with_python" = "xyes"
3405 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3406 AC_CHECK_HEADERS(Python.h,
3407 [with_python="yes"],
3408 [with_python="no ('Python.h' not found)"])
3411 if test "x$with_python" = "xyes"
3413 AC_MSG_CHECKING([for Python LDFLAGS])
3414 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`
3415 python_config_status=$?
3417 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3419 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3422 AC_MSG_RESULT([$python_library_path])
3426 if test "x$with_python" = "xyes"
3428 AC_MSG_CHECKING([for Python LIBS])
3429 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`
3430 python_config_status=$?
3432 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3434 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3437 AC_MSG_RESULT([$python_library_flags])
3441 if test "x$with_python" = "xyes"
3443 LDFLAGS="-L$python_library_path $LDFLAGS"
3444 LIBS="$python_library_flags $LIBS"
3446 AC_CHECK_FUNC(PyObject_CallFunction,
3447 [with_python="yes"],
3448 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3452 CPPFLAGS="$SAVE_CPPFLAGS"
3453 LDFLAGS="$SAVE_LDFLAGS"
3456 if test "x$with_python" = "xyes"
3458 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3459 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3460 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3461 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3462 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3463 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3467 # --with-librabbitmq {{{
3468 with_librabbitmq_cppflags=""
3469 with_librabbitmq_ldflags=""
3470 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3472 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3474 with_librabbitmq_cppflags="-I$withval/include"
3475 with_librabbitmq_ldflags="-L$withval/lib"
3476 with_librabbitmq="yes"
3478 with_librabbitmq="$withval"
3482 with_librabbitmq="yes"
3484 SAVE_CPPFLAGS="$CPPFLAGS"
3485 SAVE_LDFLAGS="$LDFLAGS"
3486 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3487 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3488 if test "x$with_librabbitmq" = "xyes"
3490 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3492 if test "x$with_librabbitmq" = "xyes"
3494 # librabbitmq up to version 0.9.1 provides "library_errno", later
3495 # versions use "library_error". The library does not provide a version
3496 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3497 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3500 # include <stdlib.h>
3506 # include <stdint.h>
3509 # include <inttypes.h>
3514 if test "x$with_librabbitmq" = "xyes"
3516 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3518 if test "x$with_librabbitmq" = "xyes"
3520 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3521 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3522 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3523 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3524 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3525 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3526 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3528 CPPFLAGS="$SAVE_CPPFLAGS"
3529 LDFLAGS="$SAVE_LDFLAGS"
3530 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3533 # --with-librouteros {{{
3534 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3536 if test "x$withval" = "xyes"
3538 with_librouteros="yes"
3539 else if test "x$withval" = "xno"
3541 with_librouteros="no"
3543 with_librouteros="yes"
3544 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3545 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3548 [with_librouteros="yes"])
3550 SAVE_CPPFLAGS="$CPPFLAGS"
3551 SAVE_LDFLAGS="$LDFLAGS"
3553 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3554 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3556 if test "x$with_librouteros" = "xyes"
3558 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3560 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3562 AC_CHECK_HEADERS(routeros_api.h,
3563 [with_librouteros="yes"],
3564 [with_librouteros="no (routeros_api.h not found)"])
3566 if test "x$with_librouteros" = "xyes"
3568 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3570 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3572 AC_CHECK_LIB(routeros, ros_interface,
3573 [with_librouteros="yes"],
3574 [with_librouteros="no (symbol 'ros_interface' not found)"])
3577 CPPFLAGS="$SAVE_CPPFLAGS"
3578 LDFLAGS="$SAVE_LDFLAGS"
3580 if test "x$with_librouteros" = "xyes"
3582 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3583 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3584 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3585 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3587 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3591 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3594 librrd_threadsafe="yes"
3595 librrd_rrdc_update="no"
3596 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3597 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3599 librrd_cflags="-I$withval/include"
3600 librrd_ldflags="-L$withval/lib"
3603 with_librrd="$withval"
3605 ], [with_librrd="yes"])
3606 if test "x$with_librrd" = "xyes"
3608 SAVE_CPPFLAGS="$CPPFLAGS"
3609 SAVE_LDFLAGS="$LDFLAGS"
3611 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3612 LDFLAGS="$LDFLAGS $librrd_ldflags"
3614 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3616 CPPFLAGS="$SAVE_CPPFLAGS"
3617 LDFLAGS="$SAVE_LDFLAGS"
3619 if test "x$with_librrd" = "xyes"
3621 SAVE_CPPFLAGS="$CPPFLAGS"
3622 SAVE_LDFLAGS="$LDFLAGS"
3624 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3625 LDFLAGS="$LDFLAGS $librrd_ldflags"
3627 AC_CHECK_LIB(rrd_th, rrd_update_r,
3629 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3631 [librrd_threadsafe="no"
3632 AC_CHECK_LIB(rrd, rrd_update,
3634 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3636 [with_librrd="no (symbol 'rrd_update' not found)"],
3641 if test "x$librrd_threadsafe" = "xyes"
3643 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3645 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3648 CPPFLAGS="$SAVE_CPPFLAGS"
3649 LDFLAGS="$SAVE_LDFLAGS"
3651 if test "x$with_librrd" = "xyes"
3653 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3654 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3655 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3656 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3658 if test "x$librrd_threadsafe" = "xyes"
3660 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3664 # --with-libsensors {{{
3665 with_sensors_cflags=""
3666 with_sensors_ldflags=""
3667 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3669 if test "x$withval" = "xno"
3671 with_libsensors="no"
3673 with_libsensors="yes"
3674 if test "x$withval" != "xyes"
3676 with_sensors_cflags="-I$withval/include"
3677 with_sensors_ldflags="-L$withval/lib"
3678 with_libsensors="yes"
3683 if test "x$ac_system" = "xLinux"
3685 with_libsensors="yes"
3687 with_libsensors="no (Linux only library)"
3690 if test "x$with_libsensors" = "xyes"
3692 SAVE_CPPFLAGS="$CPPFLAGS"
3693 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3695 # AC_CHECK_HEADERS(sensors/sensors.h,
3697 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3699 # [with_libsensors="no (sensors/sensors.h not found)"])
3700 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3702 CPPFLAGS="$SAVE_CPPFLAGS"
3704 if test "x$with_libsensors" = "xyes"
3706 SAVE_CPPFLAGS="$CPPFLAGS"
3707 SAVE_LDFLAGS="$LDFLAGS"
3708 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3709 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3711 AC_CHECK_LIB(sensors, sensors_init,
3713 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3715 [with_libsensors="no (libsensors not found)"])
3717 CPPFLAGS="$SAVE_CPPFLAGS"
3718 LDFLAGS="$SAVE_LDFLAGS"
3720 if test "x$with_libsensors" = "xyes"
3722 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3723 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3724 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3725 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3727 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3730 # --with-libstatgrab {{{
3731 with_libstatgrab_cflags=""
3732 with_libstatgrab_ldflags=""
3733 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3735 if test "x$withval" != "xno" \
3736 && test "x$withval" != "xyes"
3738 with_libstatgrab_cflags="-I$withval/include"
3739 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3740 with_libstatgrab="yes"
3741 with_libstatgrab_pkg_config="no"
3743 with_libstatgrab="$withval"
3744 with_libstatgrab_pkg_config="yes"
3748 with_libstatgrab="yes"
3749 with_libstatgrab_pkg_config="yes"
3752 if test "x$with_libstatgrab" = "xyes" \
3753 && test "x$with_libstatgrab_pkg_config" = "xyes"
3755 if test "x$PKG_CONFIG" != "x"
3757 AC_MSG_CHECKING([pkg-config for libstatgrab])
3759 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3762 with_libstatgrab_pkg_config="no"
3763 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3764 temp_result="not found"
3766 AC_MSG_RESULT([$temp_result])
3768 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3769 with_libstatgrab_pkg_config="no"
3770 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3774 if test "x$with_libstatgrab" = "xyes" \
3775 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3776 && test "x$with_libstatgrab_cflags" = "x"
3778 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3779 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3782 with_libstatgrab_cflags="$temp_result"
3784 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3785 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3787 AC_MSG_RESULT([$temp_result])
3790 if test "x$with_libstatgrab" = "xyes" \
3791 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3792 && test "x$with_libstatgrab_ldflags" = "x"
3794 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3795 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3798 with_libstatgrab_ldflags="$temp_result"
3800 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3801 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3803 AC_MSG_RESULT([$temp_result])
3806 if test "x$with_libstatgrab" = "xyes"
3808 SAVE_CPPFLAGS="$CPPFLAGS"
3809 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3811 AC_CHECK_HEADERS(statgrab.h,
3812 [with_libstatgrab="yes"],
3813 [with_libstatgrab="no (statgrab.h not found)"])
3815 CPPFLAGS="$SAVE_CPPFLAGS"
3818 if test "x$with_libstatgrab" = "xyes"
3820 SAVE_CFLAGS="$CFLAGS"
3821 SAVE_LDFLAGS="$LDFLAGS"
3823 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3824 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3826 AC_CHECK_LIB(statgrab, sg_init,
3827 [with_libstatgrab="yes"],
3828 [with_libstatgrab="no (symbol sg_init not found)"])
3830 CFLAGS="$SAVE_CFLAGS"
3831 LDFLAGS="$SAVE_LDFLAGS"
3834 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3835 if test "x$with_libstatgrab" = "xyes"
3837 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3838 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3839 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3840 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3841 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3845 # --with-libtokyotyrant {{{
3846 with_libtokyotyrant_cppflags=""
3847 with_libtokyotyrant_ldflags=""
3848 with_libtokyotyrant_libs=""
3849 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3851 if test "x$withval" = "xno"
3853 with_libtokyotyrant="no"
3854 else if test "x$withval" = "xyes"
3856 with_libtokyotyrant="yes"
3858 with_libtokyotyrant_cppflags="-I$withval/include"
3859 with_libtokyotyrant_ldflags="-L$withval/include"
3860 with_libtokyotyrant_libs="-ltokyotyrant"
3861 with_libtokyotyrant="yes"
3865 with_libtokyotyrant="yes"
3868 if test "x$with_libtokyotyrant" = "xyes"
3870 if $PKG_CONFIG --exists tokyotyrant
3872 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3873 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3874 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3878 SAVE_CPPFLAGS="$CPPFLAGS"
3879 SAVE_LDFLAGS="$LDFLAGS"
3880 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3881 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3883 if test "x$with_libtokyotyrant" = "xyes"
3885 AC_CHECK_HEADERS(tcrdb.h,
3887 AC_DEFINE(HAVE_TCRDB_H, 1,
3888 [Define to 1 if you have the <tcrdb.h> header file.])
3889 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3892 if test "x$with_libtokyotyrant" = "xyes"
3894 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3896 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3897 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3899 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3900 [$with_libtokyotyrant_libs])
3903 CPPFLAGS="$SAVE_CPPFLAGS"
3904 LDFLAGS="$SAVE_LDFLAGS"
3906 if test "x$with_libtokyotyrant" = "xyes"
3908 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3909 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3910 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3911 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3912 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3913 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3915 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3918 # --with-libupsclient {{{
3919 with_libupsclient_config=""
3920 with_libupsclient_cflags=""
3921 with_libupsclient_libs=""
3922 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3924 if test "x$withval" = "xno"
3926 with_libupsclient="no"
3927 else if test "x$withval" = "xyes"
3929 with_libupsclient="use_pkgconfig"
3931 if test -x "$withval"
3933 with_libupsclient_config="$withval"
3934 with_libupsclient="use_libupsclient_config"
3935 else if test -x "$withval/bin/libupsclient-config"
3937 with_libupsclient_config="$withval/bin/libupsclient-config"
3938 with_libupsclient="use_libupsclient_config"
3940 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3941 with_libupsclient_cflags="-I$withval/include"
3942 with_libupsclient_libs="-L$withval/lib -lupsclient"
3943 with_libupsclient="yes"
3947 [with_libupsclient="use_pkgconfig"])
3949 # configure using libupsclient-config
3950 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3952 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3953 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3956 with_libupsclient="no ($with_libupsclient_config failed)"
3958 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3961 with_libupsclient="no ($with_libupsclient_config failed)"
3964 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3966 with_libupsclient="yes"
3969 # configure using pkg-config
3970 if test "x$with_libupsclient" = "xuse_pkgconfig"
3972 if test "x$PKG_CONFIG" = "x"
3974 with_libupsclient="no (Don't have pkg-config)"
3977 if test "x$with_libupsclient" = "xuse_pkgconfig"
3979 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3980 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3983 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3986 if test "x$with_libupsclient" = "xuse_pkgconfig"
3988 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3991 with_libupsclient="no ($PKG_CONFIG failed)"
3993 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3996 with_libupsclient="no ($PKG_CONFIG failed)"
3999 if test "x$with_libupsclient" = "xuse_pkgconfig"
4001 with_libupsclient="yes"
4004 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
4005 # the actual checks.
4006 if test "x$with_libupsclient" = "xyes"
4008 SAVE_CPPFLAGS="$CPPFLAGS"
4009 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4011 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
4013 CPPFLAGS="$SAVE_CPPFLAGS"
4015 if test "x$with_libupsclient" = "xyes"
4017 SAVE_CPPFLAGS="$CPPFLAGS"
4018 SAVE_LDFLAGS="$LDFLAGS"
4020 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4021 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
4023 AC_CHECK_LIB(upsclient, upscli_connect,
4024 [with_libupsclient="yes"],
4025 [with_libupsclient="no (symbol upscli_connect not found)"])
4027 CPPFLAGS="$SAVE_CPPFLAGS"
4028 LDFLAGS="$SAVE_LDFLAGS"
4030 if test "x$with_libupsclient" = "xyes"
4032 SAVE_CPPFLAGS="$CPPFLAGS"
4033 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4035 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4036 [#include <stdlib.h>
4038 #include <upsclient.h>])
4040 CPPFLAGS="$SAVE_CPPFLAGS"
4042 if test "x$with_libupsclient" = "xyes"
4044 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4045 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4046 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4047 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4051 # --with-libxmms {{{
4052 with_xmms_config="xmms-config"
4055 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4057 if test "x$withval" != "xno" \
4058 && test "x$withval" != "xyes"
4060 if test -f "$withval" && test -x "$withval";
4062 with_xmms_config="$withval"
4063 else if test -x "$withval/bin/xmms-config"
4065 with_xmms_config="$withval/bin/xmms-config"
4068 else if test "x$withval" = "xno"
4078 if test "x$with_libxmms" = "xyes"
4080 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4081 xmms_config_status=$?
4083 if test $xmms_config_status -ne 0
4088 if test "x$with_libxmms" = "xyes"
4090 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4091 xmms_config_status=$?
4093 if test $xmms_config_status -ne 0
4098 if test "x$with_libxmms" = "xyes"
4100 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4102 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4103 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4104 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4105 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4112 with_libxmms_numeric=0
4113 if test "x$with_libxmms" = "xyes"
4115 with_libxmms_numeric=1
4117 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4118 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4121 # --with-libyajl {{{
4122 with_libyajl_cppflags=""
4123 with_libyajl_ldflags=""
4124 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4126 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4128 with_libyajl_cppflags="-I$withval/include"
4129 with_libyajl_ldflags="-L$withval/lib"
4132 with_libyajl="$withval"
4138 if test "x$with_libyajl" = "xyes"
4140 SAVE_CPPFLAGS="$CPPFLAGS"
4141 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4143 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4144 AC_CHECK_HEADERS(yajl/yajl_version.h)
4146 CPPFLAGS="$SAVE_CPPFLAGS"
4148 if test "x$with_libyajl" = "xyes"
4150 SAVE_CPPFLAGS="$CPPFLAGS"
4151 SAVE_LDFLAGS="$LDFLAGS"
4152 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4153 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4155 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4157 CPPFLAGS="$SAVE_CPPFLAGS"
4158 LDFLAGS="$SAVE_LDFLAGS"
4160 if test "x$with_libyajl" = "xyes"
4162 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4163 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4164 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4165 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4166 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4167 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4168 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4170 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4173 # --with-libvarnish {{{
4174 with_libvarnish_cppflags=""
4175 with_libvarnish_cflags=""
4176 with_libvarnish_libs=""
4177 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4179 if test "x$withval" = "xno"
4181 with_libvarnish="no"
4182 else if test "x$withval" = "xyes"
4184 with_libvarnish="use_pkgconfig"
4185 else if test -d "$with_libvarnish/lib"
4187 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4188 with_libvarnish_cflags="-I$withval/include"
4189 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4190 with_libvarnish="yes"
4193 [with_libvarnish="use_pkgconfig"])
4195 # configure using pkg-config
4196 if test "x$with_libvarnish" = "xuse_pkgconfig"
4198 if test "x$PKG_CONFIG" = "x"
4200 with_libvarnish="no (Don't have pkg-config)"
4203 if test "x$with_libvarnish" = "xuse_pkgconfig"
4205 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4206 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4209 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4212 if test "x$with_libvarnish" = "xuse_pkgconfig"
4214 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4217 with_libvarnish="no ($PKG_CONFIG failed)"
4219 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4222 with_libvarnish="no ($PKG_CONFIG failed)"
4225 if test "x$with_libvarnish" = "xuse_pkgconfig"
4227 with_libvarnish="yes"
4230 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4231 # the actual checks.
4232 if test "x$with_libvarnish" = "xyes"
4234 SAVE_CPPFLAGS="$CPPFLAGS"
4235 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4236 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4238 CPPFLAGS="$SAVE_CPPFLAGS"
4240 if test "x$with_libvarnish" = "xyes"
4242 SAVE_CPPFLAGS="$CPPFLAGS"
4243 #SAVE_LDFLAGS="$LDFLAGS"
4245 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4246 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4248 AC_CHECK_HEADERS(varnish/vsc.h,
4249 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4250 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4252 CPPFLAGS="$SAVE_CPPFLAGS"
4253 #LDFLAGS="$SAVE_LDFLAGS"
4255 if test "x$with_libvarnish" = "xyes"
4257 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4258 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4259 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4260 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4264 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4265 with_libxml2="no (pkg-config isn't available)"
4266 with_libxml2_cflags=""
4267 with_libxml2_ldflags=""
4268 with_libvirt="no (pkg-config isn't available)"
4269 with_libvirt_cflags=""
4270 with_libvirt_ldflags=""
4271 if test "x$PKG_CONFIG" != "x"
4273 pkg-config --exists 'libxml-2.0' 2>/dev/null
4278 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4281 pkg-config --exists libvirt 2>/dev/null
4286 with_libvirt="no (pkg-config doesn't know libvirt)"
4289 if test "x$with_libxml2" = "xyes"
4291 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4296 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4302 if test "x$with_libxml2" = "xyes"
4304 SAVE_CPPFLAGS="$CPPFLAGS"
4305 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4307 AC_CHECK_HEADERS(libxml/parser.h, [],
4308 [with_libxml2="no (libxml/parser.h not found)"])
4310 CPPFLAGS="$SAVE_CPPFLAGS"
4312 if test "x$with_libxml2" = "xyes"
4314 SAVE_CFLAGS="$CFLAGS"
4315 SAVE_LDFLAGS="$LDFLAGS"
4317 CFLAGS="$CFLAGS $with_libxml2_cflags"
4318 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4320 AC_CHECK_LIB(xml2, xmlXPathEval,
4321 [with_libxml2="yes"],
4322 [with_libxml2="no (symbol xmlXPathEval not found)"])
4324 CFLAGS="$SAVE_CFLAGS"
4325 LDFLAGS="$SAVE_LDFLAGS"
4327 dnl Add the right compiler flags and libraries.
4328 if test "x$with_libxml2" = "xyes"; then
4329 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4330 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4331 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4332 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4334 if test "x$with_libvirt" = "xyes"
4336 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4341 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4347 if test "x$with_libvirt" = "xyes"
4349 SAVE_CPPFLAGS="$CPPFLAGS"
4350 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4352 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4353 [with_libvirt="no (libvirt/libvirt.h not found)"])
4355 CPPFLAGS="$SAVE_CPPFLAGS"
4357 if test "x$with_libvirt" = "xyes"
4359 SAVE_CFLAGS="$CFLAGS"
4360 SAVE_LDFLAGS="$LDFLAGS"
4362 CFLAGS="$CFLAGS $with_libvirt_cflags"
4363 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4365 AC_CHECK_LIB(virt, virDomainBlockStats,
4366 [with_libvirt="yes"],
4367 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4369 CFLAGS="$SAVE_CFLAGS"
4370 LDFLAGS="$SAVE_LDFLAGS"
4372 dnl Add the right compiler flags and libraries.
4373 if test "x$with_libvirt" = "xyes"; then
4374 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4375 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4376 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4377 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4381 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4382 with_libopenipmipthread="yes"
4383 with_libopenipmipthread_cflags=""
4384 with_libopenipmipthread_libs=""
4386 AC_MSG_CHECKING([for pkg-config])
4388 if test "x$PKG_CONFIG" = "x"
4390 with_libopenipmipthread="no"
4393 temp_result="$PKG_CONFIG"
4395 AC_MSG_RESULT([$temp_result])
4397 if test "x$with_libopenipmipthread" = "xyes"
4399 AC_MSG_CHECKING([for libOpenIPMIpthread])
4400 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4403 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4405 AC_MSG_RESULT([$with_libopenipmipthread])
4408 if test "x$with_libopenipmipthread" = "xyes"
4410 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4411 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4414 with_libopenipmipthread_cflags="$temp_result"
4416 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4417 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4419 AC_MSG_RESULT([$temp_result])
4422 if test "x$with_libopenipmipthread" = "xyes"
4424 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4425 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4428 with_libopenipmipthread_ldflags="$temp_result"
4430 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4431 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4433 AC_MSG_RESULT([$temp_result])
4436 if test "x$with_libopenipmipthread" = "xyes"
4438 SAVE_CPPFLAGS="$CPPFLAGS"
4439 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4441 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4442 [with_libopenipmipthread="yes"],
4443 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4444 [#include <OpenIPMI/ipmiif.h>
4445 #include <OpenIPMI/ipmi_err.h>
4446 #include <OpenIPMI/ipmi_posix.h>
4447 #include <OpenIPMI/ipmi_conn.h>
4450 CPPFLAGS="$SAVE_CPPFLAGS"
4453 if test "x$with_libopenipmipthread" = "xyes"
4455 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4456 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4457 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4458 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4462 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4463 [with_libnotify="yes"],
4464 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4467 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4470 # Check for enabled/disabled features
4473 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4474 # ------------------------------------------------------------
4476 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4481 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4486 m4_define([EnDis],[disabled])dnl
4487 m4_define([YesNo],[no])dnl
4493 m4_define([EnDis],[enabled])dnl
4494 m4_define([YesNo],[yes])dnl
4497 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4501 m4_if([$3], [feature], [],
4505 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4511 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4513 enable_$1='[YesNo]'dnl
4515 if test "x$enable_$1" = "xno"
4519 if test "x$enable_$1" = "xyes"
4523 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4528 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4529 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4531 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4533 # AC_PLUGIN(name, default, info)
4534 # ------------------------------------------------------------
4541 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4543 if test "x$enableval" = "xyes"
4546 else if test "x$enableval" = "xforce"
4551 enable_plugin="no (disabled on command line)"
4555 if test "x$enable_all_plugins" = "xauto"
4557 if test "x$2" = "xyes"
4564 enable_plugin="$enable_all_plugins"
4567 if test "x$enable_plugin" = "xyes"
4569 if test "x$2" = "xyes" || test "x$force" = "xyes"
4571 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4572 if test "x$2" != "xyes"
4574 dependency_warning="yes"
4576 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4577 dependency_error="yes"
4578 enable_plugin="no (dependency error)"
4581 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4582 enable_$1="$enable_plugin"
4584 )# AC_PLUGIN(name, default, info)
4586 m4_divert_once([HELP_ENABLE], [
4587 collectd features:])
4588 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4589 AC_COLLECTD([debug], [enable], [feature], [debugging])
4590 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4591 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4593 dependency_warning="no"
4594 dependency_error="no"
4599 plugin_conntrack="no"
4600 plugin_contextswitch="no"
4603 plugin_curl_json="no"
4604 plugin_curl_xml="no"
4610 plugin_interface="no"
4617 plugin_multimeter="no"
4621 plugin_processes="no"
4622 plugin_protocols="no"
4626 plugin_tcpconns="no"
4633 plugin_wireless="no"
4637 if test "x$ac_system" = "xLinux"
4639 plugin_battery="yes"
4640 plugin_conntrack="yes"
4641 plugin_contextswitch="yes"
4643 plugin_cpufreq="yes"
4645 plugin_entropy="yes"
4646 plugin_fscache="yes"
4647 plugin_interface="yes"
4653 plugin_processes="yes"
4654 plugin_protocols="yes"
4657 plugin_tcpconns="yes"
4658 plugin_thermal="yes"
4661 plugin_vserver="yes"
4662 plugin_wireless="yes"
4664 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4670 if test "x$ac_system" = "xOpenBSD"
4672 plugin_tcpconns="yes"
4676 if test "x$with_libiokit" = "xyes"
4678 plugin_battery="yes"
4684 if test "x$ac_system" = "xAIX"
4686 plugin_tcpconns="yes"
4689 if test "x$with_perfstat" = "xyes"
4692 plugin_contextswitch="yes"
4696 plugin_interface="yes"
4701 if test "x$with_procinfo" = "xyes"
4703 plugin_processes="yes"
4707 if test "x$with_kstat" = "xyes"
4711 plugin_zfs_arc="yes"
4714 if test "x$with_devinfo$with_kstat" = "xyesyes"
4718 plugin_interface="yes"
4724 if test "x$with_libstatgrab" = "xyes"
4728 plugin_interface="yes"
4735 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4738 if test "x$have_strptime" = "xyes"
4744 if test "x$with_libopenipmipthread" = "xyes"
4749 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4751 plugin_curl_json="yes"
4754 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4756 plugin_curl_xml="yes"
4759 if test "x$have_processor_info" = "xyes"
4763 if test "x$have_sysctl" = "xyes"
4768 if test "x$ac_system" = "xDarwin"
4773 if test "x$have_sysctlbyname" = "xyes"
4775 plugin_contextswitch="yes"
4778 plugin_tcpconns="yes"
4781 # Df plugin: Check if we know how to determine mount points first.
4782 #if test "x$have_listmntent" = "xyes"; then
4785 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4789 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4793 #if test "x$have_getmntent" = "xseq"
4797 if test "x$c_cv_have_one_getmntent" = "xyes"
4802 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4803 if test "x$plugin_df" = "xyes"
4806 if test "x$have_statfs" = "xyes"
4810 if test "x$have_statvfs" = "xyes"
4816 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
4818 plugin_ethstat="yes"
4821 if test "x$have_getifaddrs" = "xyes"
4823 plugin_interface="yes"
4826 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4828 plugin_libvirt="yes"
4831 if test "x$have_getloadavg" = "xyes"
4836 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4841 # Mac OS X memory interface
4842 if test "x$have_host_statistics" = "xyes"
4847 if test "x$have_termios_h" = "xyes"
4849 plugin_multimeter="yes"
4853 if test "x$have_thread_info" = "xyes"
4855 plugin_processes="yes"
4858 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4860 plugin_processes="yes"
4863 if test "x$with_kvm_getswapinfo" = "xyes"
4868 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4873 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4875 plugin_tcpconns="yes"
4878 if test "x$have_getutent" = "xyes"
4882 if test "x$have_getutxent" = "xyes"
4887 m4_divert_once([HELP_ENABLE], [
4890 AC_ARG_ENABLE([all-plugins],
4891 AC_HELP_STRING([--enable-all-plugins],
4892 [enable all plugins (auto by def)]),
4894 if test "x$enableval" = "xyes"
4896 enable_all_plugins="yes"
4897 else if test "x$enableval" = "xauto"
4899 enable_all_plugins="auto"
4901 enable_all_plugins="no"
4904 [enable_all_plugins="auto"])
4906 m4_divert_once([HELP_ENABLE], [])
4908 AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
4909 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4910 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4911 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4912 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4913 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4914 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4915 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4916 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4917 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4918 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4919 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4920 AC_PLUGIN([csv], [yes], [CSV output plugin])
4921 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4922 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4923 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4924 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4925 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4926 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4927 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4928 AC_PLUGIN([email], [yes], [EMail statistics])
4929 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4930 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
4931 AC_PLUGIN([exec], [yes], [Execution of external programs])
4932 AC_PLUGIN([filecount], [yes], [Count files in directories])
4933 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4934 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4935 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4936 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4937 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4938 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4939 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4940 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4941 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4942 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4943 AC_PLUGIN([load], [$plugin_load], [System load])
4944 AC_PLUGIN([logfile], [yes], [File logging plugin])
4945 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4946 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4947 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4948 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4949 AC_PLUGIN([match_regex], [yes], [The regex match])
4950 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4951 AC_PLUGIN([match_value], [yes], [The value match])
4952 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4953 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
4954 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4955 AC_PLUGIN([memcached], [yes], [memcached statistics])
4956 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4957 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4958 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4959 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4960 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4961 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4962 AC_PLUGIN([network], [yes], [Network communication plugin])
4963 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4964 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4965 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4966 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4967 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4968 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
4969 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4970 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4971 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4972 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4973 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4974 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4975 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
4976 # FIXME: Check for libevent, too.
4977 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4978 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4979 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4980 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4981 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4982 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4983 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4984 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
4985 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4986 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4987 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4988 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4989 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4990 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4991 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4992 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4993 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4994 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4995 AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files])
4996 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4997 AC_PLUGIN([target_notification], [yes], [The notification target])
4998 AC_PLUGIN([target_replace], [yes], [The replace target])
4999 AC_PLUGIN([target_scale],[yes], [The scale target])
5000 AC_PLUGIN([target_set], [yes], [The set target])
5001 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
5002 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
5003 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
5004 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
5005 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
5006 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
5007 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
5008 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
5009 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
5010 AC_PLUGIN([users], [$plugin_users], [User statistics])
5011 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
5012 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
5013 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
5014 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
5015 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
5016 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
5017 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
5018 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
5019 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
5020 AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin])
5021 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
5022 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
5024 dnl Default configuration file
5025 # Load either syslog or logfile
5026 LOAD_PLUGIN_SYSLOG=""
5027 LOAD_PLUGIN_LOGFILE=""
5029 AC_MSG_CHECKING([which default log plugin to load])
5030 default_log_plugin="none"
5031 if test "x$enable_syslog" = "xyes"
5033 default_log_plugin="syslog"
5035 LOAD_PLUGIN_SYSLOG="##"
5038 if test "x$enable_logfile" = "xyes"
5040 if test "x$default_log_plugin" = "xnone"
5042 default_log_plugin="logfile"
5044 LOAD_PLUGIN_LOGFILE="#"
5047 LOAD_PLUGIN_LOGFILE="##"
5049 AC_MSG_RESULT([$default_log_plugin])
5051 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5052 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5054 DEFAULT_LOG_LEVEL="info"
5055 if test "x$enable_debug" = "xyes"
5057 DEFAULT_LOG_LEVEL="debug"
5059 AC_SUBST(DEFAULT_LOG_LEVEL)
5061 # Load only one of rrdtool, network, csv in the default config.
5062 LOAD_PLUGIN_RRDTOOL=""
5063 LOAD_PLUGIN_NETWORK=""
5066 AC_MSG_CHECKING([which default write plugin to load])
5067 default_write_plugin="none"
5068 if test "x$enable_rrdtool" = "xyes"
5070 default_write_plugin="rrdtool"
5072 LOAD_PLUGIN_RRDTOOL="##"
5075 if test "x$enable_network" = "xyes"
5077 if test "x$default_write_plugin" = "xnone"
5079 default_write_plugin="network"
5081 LOAD_PLUGIN_NETWORK="#"
5084 LOAD_PLUGIN_NETWORK="##"
5087 if test "x$enable_csv" = "xyes"
5089 if test "x$default_write_plugin" = "xnone"
5091 default_write_plugin="csv"
5096 LOAD_PLUGIN_CSV="##"
5098 AC_MSG_RESULT([$default_write_plugin])
5100 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5101 AC_SUBST(LOAD_PLUGIN_NETWORK)
5102 AC_SUBST(LOAD_PLUGIN_CSV)
5105 if test "x$ac_system" = "xLinux" \
5106 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5108 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5111 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5113 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5117 PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
5118 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5120 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5122 PERL_BINDINGS_OPTIONS="$withval"
5123 with_perl_bindings="yes"
5125 with_perl_bindings="$withval"
5129 if test -n "$perl_interpreter"
5131 with_perl_bindings="yes"
5133 with_perl_bindings="no (no perl interpreter found)"
5136 if test "x$with_perl_bindings" = "xyes"
5138 PERL_BINDINGS="perl"
5142 AC_SUBST(PERL_BINDINGS)
5143 AC_SUBST(PERL_BINDINGS_OPTIONS)
5145 dnl libcollectdclient
5146 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5147 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5148 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5150 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5152 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5154 AC_SUBST(LCC_VERSION_MAJOR)
5155 AC_SUBST(LCC_VERSION_MINOR)
5156 AC_SUBST(LCC_VERSION_PATCH)
5157 AC_SUBST(LCC_VERSION_EXTRA)
5158 AC_SUBST(LCC_VERSION_STRING)
5160 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5162 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
5164 if test "x$with_librrd" = "xyes" \
5165 && test "x$librrd_threadsafe" != "xyes"
5167 with_librrd="yes (warning: librrd is not thread-safe)"
5170 if test "x$with_libperl" = "xyes"
5172 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5174 enable_perl="no (needs libperl)"
5177 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5179 enable_perl="no (libperl doesn't support ithreads)"
5182 if test "x$with_perl_bindings" = "xyes" \
5183 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5185 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5192 libcurl . . . . . . . $with_libcurl
5193 libdbi . . . . . . . $with_libdbi
5194 libcredis . . . . . . $with_libcredis
5195 libesmtp . . . . . . $with_libesmtp
5196 libganglia . . . . . $with_libganglia
5197 libgcrypt . . . . . . $with_libgcrypt
5198 libiokit . . . . . . $with_libiokit
5199 libiptc . . . . . . . $with_libiptc
5200 libjvm . . . . . . . $with_java
5201 libkstat . . . . . . $with_kstat
5202 libkvm . . . . . . . $with_libkvm
5203 libmemcached . . . . $with_libmemcached
5204 libmodbus . . . . . . $with_libmodbus
5205 libmysql . . . . . . $with_libmysql
5206 libnetapp . . . . . . $with_libnetapp
5207 libnetlink . . . . . $with_libnetlink
5208 libnetsnmp . . . . . $with_libnetsnmp
5209 libnotify . . . . . . $with_libnotify
5210 liboconfig . . . . . $with_liboconfig
5211 libopenipmi . . . . . $with_libopenipmipthread
5212 liboping . . . . . . $with_liboping
5213 libpcap . . . . . . . $with_libpcap
5214 libperfstat . . . . . $with_perfstat
5215 libperl . . . . . . . $with_libperl
5216 libpq . . . . . . . . $with_libpq
5217 libpthread . . . . . $with_libpthread
5218 librabbitmq . . . . . $with_librabbitmq
5219 librouteros . . . . . $with_librouteros
5220 librrd . . . . . . . $with_librrd
5221 libsensors . . . . . $with_libsensors
5222 libstatgrab . . . . . $with_libstatgrab
5223 libtokyotyrant . . . $with_libtokyotyrant
5224 libupsclient . . . . $with_libupsclient
5225 libvarnish . . . . . $with_libvarnish
5226 libvirt . . . . . . . $with_libvirt
5227 libxml2 . . . . . . . $with_libxml2
5228 libxmms . . . . . . . $with_libxmms
5229 libyajl . . . . . . . $with_libyajl
5230 libevent . . . . . . $with_libevent
5231 protobuf-c . . . . . $have_protoc_c
5232 oracle . . . . . . . $with_oracle
5233 python . . . . . . . $with_python
5236 daemon mode . . . . . $enable_daemon
5237 debug . . . . . . . . $enable_debug
5240 perl . . . . . . . . $with_perl_bindings
5243 aggregation . . . . . $enable_aggregation
5244 amqp . . . . . . . $enable_amqp
5245 apache . . . . . . . $enable_apache
5246 apcups . . . . . . . $enable_apcups
5247 apple_sensors . . . . $enable_apple_sensors
5248 ascent . . . . . . . $enable_ascent
5249 battery . . . . . . . $enable_battery
5250 bind . . . . . . . . $enable_bind
5251 conntrack . . . . . . $enable_conntrack
5252 contextswitch . . . . $enable_contextswitch
5253 cpu . . . . . . . . . $enable_cpu
5254 cpufreq . . . . . . . $enable_cpufreq
5255 csv . . . . . . . . . $enable_csv
5256 curl . . . . . . . . $enable_curl
5257 curl_json . . . . . . $enable_curl_json
5258 curl_xml . . . . . . $enable_curl_xml
5259 dbi . . . . . . . . . $enable_dbi
5260 df . . . . . . . . . $enable_df
5261 disk . . . . . . . . $enable_disk
5262 dns . . . . . . . . . $enable_dns
5263 email . . . . . . . . $enable_email
5264 entropy . . . . . . . $enable_entropy
5265 ethstat . . . . . . . $enable_ethstat
5266 exec . . . . . . . . $enable_exec
5267 filecount . . . . . . $enable_filecount
5268 fscache . . . . . . . $enable_fscache
5269 gmond . . . . . . . . $enable_gmond
5270 hddtemp . . . . . . . $enable_hddtemp
5271 interface . . . . . . $enable_interface
5272 ipmi . . . . . . . . $enable_ipmi
5273 iptables . . . . . . $enable_iptables
5274 ipvs . . . . . . . . $enable_ipvs
5275 irq . . . . . . . . . $enable_irq
5276 java . . . . . . . . $enable_java
5277 libvirt . . . . . . . $enable_libvirt
5278 load . . . . . . . . $enable_load
5279 logfile . . . . . . . $enable_logfile
5280 lpar . . . . . . . . $enable_lpar
5281 madwifi . . . . . . . $enable_madwifi
5282 match_empty_counter . $enable_match_empty_counter
5283 match_hashed . . . . $enable_match_hashed
5284 match_regex . . . . . $enable_match_regex
5285 match_timediff . . . $enable_match_timediff
5286 match_value . . . . . $enable_match_value
5287 mbmon . . . . . . . . $enable_mbmon
5288 md . . . . . . . . . $enable_md
5289 memcachec . . . . . . $enable_memcachec
5290 memcached . . . . . . $enable_memcached
5291 memory . . . . . . . $enable_memory
5292 modbus . . . . . . . $enable_modbus
5293 multimeter . . . . . $enable_multimeter
5294 mysql . . . . . . . . $enable_mysql
5295 netapp . . . . . . . $enable_netapp
5296 netlink . . . . . . . $enable_netlink
5297 network . . . . . . . $enable_network
5298 nfs . . . . . . . . . $enable_nfs
5299 nginx . . . . . . . . $enable_nginx
5300 notify_desktop . . . $enable_notify_desktop
5301 notify_email . . . . $enable_notify_email
5302 ntpd . . . . . . . . $enable_ntpd
5303 numa . . . . . . . . $enable_numa
5304 nut . . . . . . . . . $enable_nut
5305 olsrd . . . . . . . . $enable_olsrd
5306 onewire . . . . . . . $enable_onewire
5307 openvpn . . . . . . . $enable_openvpn
5308 oracle . . . . . . . $enable_oracle
5309 perl . . . . . . . . $enable_perl
5310 pf . . . . . . . . . $enable_pf
5311 pinba . . . . . . . . $enable_pinba
5312 ping . . . . . . . . $enable_ping
5313 postgresql . . . . . $enable_postgresql
5314 powerdns . . . . . . $enable_powerdns
5315 processes . . . . . . $enable_processes
5316 protocols . . . . . . $enable_protocols
5317 python . . . . . . . $enable_python
5318 redis . . . . . . . . $enable_redis
5319 routeros . . . . . . $enable_routeros
5320 rrdcached . . . . . . $enable_rrdcached
5321 rrdtool . . . . . . . $enable_rrdtool
5322 sensors . . . . . . . $enable_sensors
5323 serial . . . . . . . $enable_serial
5324 snmp . . . . . . . . $enable_snmp
5325 swap . . . . . . . . $enable_swap
5326 syslog . . . . . . . $enable_syslog
5327 table . . . . . . . . $enable_table
5328 tail . . . . . . . . $enable_tail
5329 tail_csv . . . . . . $enable_tail_csv
5330 tape . . . . . . . . $enable_tape
5331 target_notification . $enable_target_notification
5332 target_replace . . . $enable_target_replace
5333 target_scale . . . . $enable_target_scale
5334 target_set . . . . . $enable_target_set
5335 target_v5upgrade . . $enable_target_v5upgrade
5336 tcpconns . . . . . . $enable_tcpconns
5337 teamspeak2 . . . . . $enable_teamspeak2
5338 ted . . . . . . . . . $enable_ted
5339 thermal . . . . . . . $enable_thermal
5340 threshold . . . . . . $enable_threshold
5341 tokyotyrant . . . . . $enable_tokyotyrant
5342 unixsock . . . . . . $enable_unixsock
5343 uptime . . . . . . . $enable_uptime
5344 users . . . . . . . . $enable_users
5345 uuid . . . . . . . . $enable_uuid
5346 varnish . . . . . . . $enable_varnish
5347 vmem . . . . . . . . $enable_vmem
5348 vserver . . . . . . . $enable_vserver
5349 wireless . . . . . . $enable_wireless
5350 write_graphite . . . $enable_write_graphite
5351 write_http . . . . . $enable_write_http
5352 write_mongodb . . . . $enable_write_mongodb
5353 write_redis . . . . . $enable_write_redis
5354 write_riemann . . . . $enable_write_riemann
5355 xmms . . . . . . . . $enable_xmms
5356 zfs_arc . . . . . . . $enable_zfs_arc
5360 if test "x$dependency_error" = "xyes"; then
5361 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5364 if test "x$dependency_warning" = "xyes"; then
5365 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5368 # vim: set fdm=marker :