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/inet_diag.h, [], [],
405 # include <sys/types.h>
407 #if HAVE_SYS_SOCKET_H
408 # include <sys/socket.h>
410 #if HAVE_LINUX_INET_DIAG_H
411 # include <linux/inet_diag.h>
414 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
417 # include <sys/types.h>
419 #if HAVE_SYS_SOCKET_H
420 # include <sys/socket.h>
423 # include <linux/if.h>
428 AC_CHECK_HEADERS(linux/sockios.h,
429 [have_linux_sockios_h="yes"],
430 [have_linux_sockios_h="no"],
433 # include <sys/ioctl.h>
439 AC_CHECK_HEADERS(linux/ethtool.h,
440 [have_linux_ethtool_h="yes"],
441 [have_linux_ethtool_h="no"],
444 # include <sys/ioctl.h>
449 #if HAVE_LINUX_SOCKIOS_H
450 # include <linux/sockios.h>
455 have_linux_ip_vs_h="no"
456 have_net_ip_vs_h="no"
458 ip_vs_h_needs_kernel_cflags="no"
459 if test "x$ac_system" = "xLinux"
461 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
462 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
463 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
465 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
467 SAVE_CFLAGS="$CFLAGS"
468 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
470 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
472 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
473 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
474 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
476 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
478 ip_vs_h_needs_kernel_cflags="yes"
481 CFLAGS="$SAVE_CFLAGS"
484 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
487 AC_CHECK_HEADERS(sys/ucred.h, [], [],
490 # include <sys/types.h>
493 # include <sys/param.h>
497 # For mount interface
498 AC_CHECK_HEADERS(sys/mount.h, [], [],
501 # include <sys/types.h>
504 # include <sys/param.h>
508 # For the email plugin
509 AC_CHECK_HEADERS(linux/un.h, [], [],
511 #if HAVE_SYS_SOCKET_H
512 # include <sys/socket.h>
516 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)
519 AC_CHECK_HEADERS(arpa/nameser.h)
520 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
522 #if HAVE_ARPA_NAMESER_H
523 # include <arpa/nameser.h>
527 AC_CHECK_HEADERS(net/if_arp.h, [], [],
528 [#if HAVE_SYS_SOCKET_H
529 # include <sys/socket.h>
532 AC_CHECK_HEADERS(net/ppp_defs.h)
533 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
534 [#if HAVE_NET_PPP_DEFS_H
535 # include <net/ppp_defs.h>
538 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
543 # include <sys/types.h>
545 #if HAVE_SYS_SOCKET_H
546 # include <sys/socket.h>
551 #if HAVE_NETINET_IN_H
552 # include <netinet/in.h>
556 AC_CHECK_HEADERS(netinet/ip_compat.h)
558 have_net_pfvar_h="no"
559 AC_CHECK_HEADERS(net/pfvar.h,
560 [have_net_pfvar_h="yes"],
561 [have_net_pfvar_h="no"],
564 # include <sys/ioctl.h>
566 #if HAVE_SYS_SOCKET_H
567 # include <sys/socket.h>
574 # For the multimeter plugin
576 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
579 # Checks for typedefs, structures, and compiler characteristics.
588 # Checks for library functions.
590 AC_PROG_GCC_TRADITIONAL
591 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
595 SAVE_CFLAGS="$CFLAGS"
596 # Emulate behavior of src/Makefile.am
597 if test "x$GCC" = "xyes"
599 CFLAGS="$CFLAGS -Wall -Werror"
602 AC_CACHE_CHECK([for strtok_r],
603 [c_cv_have_strtok_r_default],
612 char buffer[] = "foo,bar,baz";
619 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
622 printf ("token = %s;\n", token);
626 [c_cv_have_strtok_r_default="yes"],
627 [c_cv_have_strtok_r_default="no"]
631 if test "x$c_cv_have_strtok_r_default" = "xno"
633 CFLAGS="$CFLAGS -D_REENTRANT=1"
635 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
636 [c_cv_have_strtok_r_reentrant],
645 char buffer[] = "foo,bar,baz";
652 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
655 printf ("token = %s;\n", token);
659 [c_cv_have_strtok_r_reentrant="yes"],
660 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
665 CFLAGS="$SAVE_CFLAGS"
666 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
668 CFLAGS="$CFLAGS -D_REENTRANT=1"
671 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
673 socket_needs_socket="no"
674 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
675 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
677 clock_gettime_needs_rt="no"
678 clock_gettime_needs_posix4="no"
679 have_clock_gettime="no"
680 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
681 if test "x$have_clock_gettime" = "xno"
683 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
684 have_clock_gettime="yes"])
686 if test "x$have_clock_gettime" = "xno"
688 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
689 have_clock_gettime="yes"])
691 if test "x$have_clock_gettime" = "xyes"
693 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
695 AC_MSG_WARN(cannot find clock_gettime)
698 nanosleep_needs_rt="no"
699 nanosleep_needs_posix4="no"
700 AC_CHECK_FUNCS(nanosleep,
702 AC_CHECK_LIB(rt, nanosleep,
703 [nanosleep_needs_rt="yes"],
704 AC_CHECK_LIB(posix4, nanosleep,
705 [nanosleep_needs_posix4="yes"],
706 AC_MSG_ERROR(cannot find nanosleep))))
708 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
709 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
711 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
712 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
713 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
714 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
715 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
716 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
717 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
718 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
719 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
720 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
721 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
722 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
724 # Check for strptime {{{
725 if test "x$GCC" = "xyes"
727 SAVE_CFLAGS="$CFLAGS"
728 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
731 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
732 if test "x$have_strptime" = "xyes"
734 AC_CACHE_CHECK([whether strptime is exported by default],
735 [c_cv_have_strptime_default],
736 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
742 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
745 [c_cv_have_strptime_default="yes"],
746 [c_cv_have_strptime_default="no"]))
748 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
750 AC_CACHE_CHECK([whether strptime needs standards mode],
751 [c_cv_have_strptime_standards],
752 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
754 #ifndef _ISOC99_SOURCE
755 # define _ISOC99_SOURCE 1
757 #ifndef _POSIX_C_SOURCE
758 # define _POSIX_C_SOURCE 200112L
760 #ifndef _XOPEN_SOURCE
761 # define _XOPEN_SOURCE 500
767 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
770 [c_cv_have_strptime_standards="yes"],
771 [c_cv_have_strptime_standards="no"]))
773 if test "x$c_cv_have_strptime_standards" = "xyes"
775 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
781 if test "x$GCC" = "xyes"
783 CFLAGS="$SAVE_CFLAGS"
785 # }}} Check for strptime
787 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
788 if test "x$have_swapctl" = "xyes"; then
789 AC_CACHE_CHECK([whether swapctl takes two arguments],
790 [c_cv_have_swapctl_two_args],
791 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
793 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
794 # undef _FILE_OFFSET_BITS
795 # undef _LARGEFILE64_SOURCE
797 #include <sys/stat.h>
798 #include <sys/swap.h>
801 int num = swapctl(0, NULL);
804 [c_cv_have_swapctl_two_args="yes"],
805 [c_cv_have_swapctl_two_args="no"]
808 AC_CACHE_CHECK([whether swapctl takes three arguments],
809 [c_cv_have_swapctl_three_args],
813 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
814 # undef _FILE_OFFSET_BITS
815 # undef _LARGEFILE64_SOURCE
817 #include <sys/stat.h>
818 #include <sys/swap.h>
821 int num = swapctl(0, NULL, 0);
824 [c_cv_have_swapctl_three_args="yes"],
825 [c_cv_have_swapctl_three_args="no"]
829 # Check for different versions of `swapctl' here..
830 if test "x$have_swapctl" = "xyes"; then
831 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
832 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
833 [Define if the function swapctl exists and takes two arguments.])
835 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
836 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
837 [Define if the function swapctl exists and takes three arguments.])
842 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
844 if test "x$withval" = "xno"; then
846 else if test "x$withval" = "xyes"; then
853 if test "x$nan_type" = "xnone"; then
854 AC_CACHE_CHECK([whether NAN is defined by default],
855 [c_cv_have_nan_default],
856 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
860 static double foo = NAN;
869 [c_cv_have_nan_default="yes"],
870 [c_cv_have_nan_default="no"]
873 if test "x$c_cv_have_nan_default" = "xyes"
878 if test "x$nan_type" = "xnone"; then
879 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
880 [c_cv_have_nan_isoc],
881 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
884 #define __USE_ISOC99 1
886 static double foo = NAN;
895 [c_cv_have_nan_isoc="yes"],
896 [c_cv_have_nan_isoc="no"]
899 if test "x$c_cv_have_nan_isoc" = "xyes"
904 if test "x$nan_type" = "xnone"; then
905 SAVE_LDFLAGS=$LDFLAGS
906 LDFLAGS="$LDFLAGS -lm"
907 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
908 [c_cv_have_nan_zero],
909 AC_RUN_IFELSE([AC_LANG_PROGRAM(
916 #define NAN (0.0 / 0.0)
918 # define isnan(f) ((f) != (f))
920 static double foo = NAN;
929 [c_cv_have_nan_zero="yes"],
930 [c_cv_have_nan_zero="no"]
933 LDFLAGS=$SAVE_LDFLAGS
934 if test "x$c_cv_have_nan_zero" = "xyes"
940 if test "x$nan_type" = "xdefault"; then
941 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
942 [Define if NAN is defined by default and can initialize static variables.])
943 else if test "x$nan_type" = "xisoc99"; then
944 AC_DEFINE(NAN_STATIC_ISOC, 1,
945 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
946 else if test "x$nan_type" = "xzero"; then
947 AC_DEFINE(NAN_ZERO_ZERO, 1,
948 [Define if NAN can be defined as (0.0 / 0.0)])
950 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
953 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
955 if test "x$withval" = "xnothing"; then
956 fp_layout_type="nothing"
957 else if test "x$withval" = "xendianflip"; then
958 fp_layout_type="endianflip"
959 else if test "x$withval" = "xintswap"; then
960 fp_layout_type="intswap"
962 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
965 [fp_layout_type="unknown"])
967 if test "x$fp_layout_type" = "xunknown"; then
968 AC_CACHE_CHECK([if doubles are stored in x86 representation],
969 [c_cv_fp_layout_need_nothing],
970 AC_RUN_IFELSE([AC_LANG_PROGRAM(
979 # include <inttypes.h>
982 # include <stdbool.h>
992 memcpy ((void *) &i0, (void *) &d, 8);
995 memcpy ((void *) c, (void *) &i1, 8);
997 if ((c[0] == 0x2f) && (c[1] == 0x25)
998 && (c[2] == 0xc0) && (c[3] == 0xc7)
999 && (c[4] == 0x43) && (c[5] == 0x2b)
1000 && (c[6] == 0x1f) && (c[7] == 0x5b))
1006 [c_cv_fp_layout_need_nothing="yes"],
1007 [c_cv_fp_layout_need_nothing="no"]
1010 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
1011 fp_layout_type="nothing"
1014 if test "x$fp_layout_type" = "xunknown"; then
1015 AC_CACHE_CHECK([if endianflip converts to x86 representation],
1016 [c_cv_fp_layout_need_endianflip],
1017 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1023 # include <stdint.h>
1026 # include <inttypes.h>
1029 # include <stdbool.h>
1031 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
1032 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
1033 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1034 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
1035 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
1036 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1037 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1038 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1047 memcpy ((void *) &i0, (void *) &d, 8);
1049 i1 = endianflip (i0);
1050 memcpy ((void *) c, (void *) &i1, 8);
1052 if ((c[0] == 0x2f) && (c[1] == 0x25)
1053 && (c[2] == 0xc0) && (c[3] == 0xc7)
1054 && (c[4] == 0x43) && (c[5] == 0x2b)
1055 && (c[6] == 0x1f) && (c[7] == 0x5b))
1061 [c_cv_fp_layout_need_endianflip="yes"],
1062 [c_cv_fp_layout_need_endianflip="no"]
1065 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1066 fp_layout_type="endianflip"
1069 if test "x$fp_layout_type" = "xunknown"; then
1070 AC_CACHE_CHECK([if intswap converts to x86 representation],
1071 [c_cv_fp_layout_need_intswap],
1072 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1078 # include <stdint.h>
1081 # include <inttypes.h>
1084 # include <stdbool.h>
1086 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1087 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1096 memcpy ((void *) &i0, (void *) &d, 8);
1099 memcpy ((void *) c, (void *) &i1, 8);
1101 if ((c[0] == 0x2f) && (c[1] == 0x25)
1102 && (c[2] == 0xc0) && (c[3] == 0xc7)
1103 && (c[4] == 0x43) && (c[5] == 0x2b)
1104 && (c[6] == 0x1f) && (c[7] == 0x5b))
1110 [c_cv_fp_layout_need_intswap="yes"],
1111 [c_cv_fp_layout_need_intswap="no"]
1114 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1115 fp_layout_type="intswap"
1119 if test "x$fp_layout_type" = "xnothing"; then
1120 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1121 [Define if doubles are stored in x86 representation.])
1122 else if test "x$fp_layout_type" = "xendianflip"; then
1123 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1124 [Define if endianflip is needed to convert to x86 representation.])
1125 else if test "x$fp_layout_type" = "xintswap"; then
1126 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1127 [Define if intswap is needed to convert to x86 representation.])
1129 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1133 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1134 have_getvfsstat="no"
1135 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1136 have_listmntent="no"
1137 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1140 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1141 if test "x$have_getmntent" = "xno"; then
1142 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1144 if test "x$have_getmntent" = "xno"; then
1145 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1147 if test "x$have_getmntent" = "xno"; then
1148 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1151 if test "x$have_getmntent" = "xc"; then
1152 AC_CACHE_CHECK([whether getmntent takes one argument],
1153 [c_cv_have_one_getmntent],
1157 #include "$srcdir/src/utils_mount.h"
1162 fh = setmntent ("/etc/mtab", "r");
1163 me = getmntent (fh);
1164 return(me->mnt_passno);
1167 [c_cv_have_one_getmntent="yes"],
1168 [c_cv_have_one_getmntent="no"]
1171 AC_CACHE_CHECK([whether getmntent takes two arguments],
1172 [c_cv_have_two_getmntent],
1176 #include "$srcdir/src/utils_mount.h"
1182 fh = fopen ("/etc/mnttab", "r");
1183 status = getmntent (fh, &mt);
1187 [c_cv_have_two_getmntent="yes"],
1188 [c_cv_have_two_getmntent="no"]
1193 # Check for different versions of `getmntent' here..
1195 if test "x$have_getmntent" = "xc"; then
1196 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1197 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1198 [Define if the function getmntent exists and takes one argument.])
1200 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1201 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1202 [Define if the function getmntent exists and takes two arguments.])
1205 if test "x$have_getmntent" = "xsun"; then
1206 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1207 [Define if the function getmntent exists. It's the version from libsun.])
1209 if test "x$have_getmntent" = "xseq"; then
1210 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1211 [Define if the function getmntent exists. It's the version from libseq.])
1213 if test "x$have_getmntent" = "xgen"; then
1214 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1215 [Define if the function getmntent exists. It's the version from libgen.])
1219 AC_CACHE_CHECK([if have htonll defined],
1221 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1223 #include <sys/types.h>
1224 #include <netinet/in.h>
1226 # include <inttypes.h>
1233 [c_cv_have_htonll="yes"],
1234 [c_cv_have_htonll="no"]
1237 if test "x$c_cv_have_htonll" = "xyes"
1239 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1242 # Check for structures
1243 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1244 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1247 #include <sys/types.h>
1248 #include <sys/socket.h>
1251 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1252 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1255 #include <sys/types.h>
1256 #include <sys/socket.h>
1257 #include <linux/if.h>
1258 #include <linux/netdevice.h>
1260 AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states],
1261 [AC_DEFINE(HAVE_STRUCT_LINUX_INET_DIAG_REQ, 1, [Define if struct inet_diag_req exists and is usable.])],
1264 #include <linux/inet_diag.h>
1268 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1271 #include <netinet/in.h>
1275 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1277 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1278 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1279 have_struct_kinfo_proc_freebsd="yes"
1282 have_struct_kinfo_proc_freebsd="no"
1286 #include <sys/param.h>
1287 #include <sys/sysctl.h>
1288 #include <sys/user.h>
1291 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1293 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1294 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1295 have_struct_kinfo_proc_openbsd="yes"
1298 have_struct_kinfo_proc_openbsd="no"
1301 #include <sys/param.h>
1302 #include <sys/sysctl.h>
1306 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1307 [#define _BSD_SOURCE
1309 # include <stdint.h>
1311 #if HAVE_SYS_TYPES_H
1312 # include <sys/types.h>
1314 #if HAVE_NETINET_IN_SYSTM_H
1315 # include <netinet/in_systm.h>
1317 #if HAVE_NETINET_IN_H
1318 # include <netinet/in.h>
1320 #if HAVE_NETINET_IP_H
1321 # include <netinet/ip.h>
1323 #if HAVE_NETINET_UDP_H
1324 # include <netinet/udp.h>
1327 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1328 [#define _BSD_SOURCE
1330 # include <stdint.h>
1332 #if HAVE_SYS_TYPES_H
1333 # include <sys/types.h>
1335 #if HAVE_NETINET_IN_SYSTM_H
1336 # include <netinet/in_systm.h>
1338 #if HAVE_NETINET_IN_H
1339 # include <netinet/in.h>
1341 #if HAVE_NETINET_IP_H
1342 # include <netinet/ip.h>
1344 #if HAVE_NETINET_UDP_H
1345 # include <netinet/udp.h>
1349 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1359 # Checks for libraries begin here
1362 with_libresolv="yes"
1363 AC_CHECK_LIB(resolv, res_search,
1365 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1367 [with_libresolv="no"])
1368 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1370 dnl Check for HAL (hardware abstraction library)
1372 AC_CHECK_LIB(hal,libhal_device_property_exists,
1373 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1375 if test "x$with_libhal" = "xyes"; then
1376 if test "x$PKG_CONFIG" != "x"; then
1377 BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`"
1378 BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`"
1379 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1380 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1384 m4_divert_once([HELP_WITH], [
1385 collectd additional packages:])
1387 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1389 if test "x$ac_system" = "xAIX"
1394 with_perfstat="no (AIX only)"
1395 with_procinfo="no (AIX only)"
1398 if test "x$with_perfstat" = "xyes"
1400 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1401 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1403 if test "x$with_perfstat" = "xyes"
1405 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1406 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1407 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1408 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1410 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1413 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1415 # Processes plugin under AIX.
1416 if test "x$with_procinfo" = "xyes"
1418 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1420 if test "x$with_procinfo" = "xyes"
1422 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1425 if test "x$ac_system" = "xSolaris"
1430 with_kstat="no (Solaris only)"
1431 with_devinfo="no (Solaris only)"
1434 if test "x$with_kstat" = "xyes"
1436 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1438 if test "x$with_kstat" = "xyes"
1440 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1441 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1443 if test "x$with_kstat" = "xyes"
1445 AC_DEFINE(HAVE_LIBKSTAT, 1,
1446 [Define to 1 if you have the 'kstat' library (-lkstat)])
1448 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1449 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1452 if test "x$ac_system" = "xDarwin"
1458 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1461 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1462 if test "x$with_kvm_getprocs" = "xyes"
1464 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1465 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1468 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1470 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1471 if test "x$with_kvm_getswapinfo" = "xyes"
1473 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1474 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1477 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1479 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1480 if test "x$with_kvm_nlist" = "xyes"
1482 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1483 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1484 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1487 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1489 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1490 if test "x$with_kvm_openfiles" = "xyes"
1492 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1493 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1496 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1498 # --with-libcredis {{{
1499 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1501 if test "x$withval" = "xyes"
1503 with_libcredis="yes"
1504 else if test "x$withval" = "xno"
1508 with_libcredis="yes"
1509 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1510 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1513 [with_libcredis="yes"])
1515 SAVE_CPPFLAGS="$CPPFLAGS"
1516 SAVE_LDFLAGS="$LDFLAGS"
1518 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1519 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1521 if test "x$with_libcredis" = "xyes"
1523 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1525 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1527 AC_CHECK_HEADERS(credis.h,
1528 [with_libcredis="yes"],
1529 [with_libcredis="no (credis.h not found)"])
1531 if test "x$with_libcredis" = "xyes"
1533 if test "x$LIBCREDIS_LDFLAGS" != "x"
1535 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1537 AC_CHECK_LIB(credis, credis_info,
1538 [with_libcredis="yes"],
1539 [with_libcredis="no (symbol 'credis_info' not found)"])
1543 CPPFLAGS="$SAVE_CPPFLAGS"
1544 LDFLAGS="$SAVE_LDFLAGS"
1546 if test "x$with_libcredis" = "xyes"
1548 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1549 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1550 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1551 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1553 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1556 # --with-libcurl {{{
1557 with_curl_config="curl-config"
1560 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1562 if test "x$withval" = "xno"
1565 else if test "x$withval" = "xyes"
1569 if test -f "$withval" && test -x "$withval"
1571 with_curl_config="$withval"
1573 else if test -x "$withval/bin/curl-config"
1575 with_curl_config="$withval/bin/curl-config"
1584 if test "x$with_libcurl" = "xyes"
1586 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1587 curl_config_status=$?
1589 if test $curl_config_status -ne 0
1591 with_libcurl="no ($with_curl_config failed)"
1593 SAVE_CPPFLAGS="$CPPFLAGS"
1594 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1596 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1598 CPPFLAGS="$SAVE_CPPFLAGS"
1601 if test "x$with_libcurl" = "xyes"
1603 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1604 curl_config_status=$?
1606 if test $curl_config_status -ne 0
1608 with_libcurl="no ($with_curl_config failed)"
1610 AC_CHECK_LIB(curl, curl_easy_init,
1611 [with_libcurl="yes"],
1612 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1616 if test "x$with_libcurl" = "xyes"
1618 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1619 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1620 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1621 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1623 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1627 with_libdbi_cppflags=""
1628 with_libdbi_ldflags=""
1629 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1631 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1633 with_libdbi_cppflags="-I$withval/include"
1634 with_libdbi_ldflags="-L$withval/lib"
1637 with_libdbi="$withval"
1643 if test "x$with_libdbi" = "xyes"
1645 SAVE_CPPFLAGS="$CPPFLAGS"
1646 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1648 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1650 CPPFLAGS="$SAVE_CPPFLAGS"
1652 if test "x$with_libdbi" = "xyes"
1654 SAVE_CPPFLAGS="$CPPFLAGS"
1655 SAVE_LDFLAGS="$LDFLAGS"
1656 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1657 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1659 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1661 CPPFLAGS="$SAVE_CPPFLAGS"
1662 LDFLAGS="$SAVE_LDFLAGS"
1664 if test "x$with_libdbi" = "xyes"
1666 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1667 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1668 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1669 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1670 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1671 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1673 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1676 # --with-libesmtp {{{
1677 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1679 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1681 LDFLAGS="$LDFLAGS -L$withval/lib"
1682 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1685 with_libesmtp="$withval"
1691 if test "x$with_libesmtp" = "xyes"
1693 AC_CHECK_LIB(esmtp, smtp_create_session,
1695 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1696 ], [with_libesmtp="no (libesmtp not found)"])
1698 if test "x$with_libesmtp" = "xyes"
1700 AC_CHECK_HEADERS(libesmtp.h,
1702 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1703 ], [with_libesmtp="no (libesmtp.h not found)"])
1705 if test "x$with_libesmtp" = "xyes"
1711 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1712 [Wether or not to use the esmtp library])
1713 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1716 # --with-libganglia {{{
1717 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1719 if test -f "$withval" && test -x "$withval"
1721 with_libganglia_config="$withval"
1722 with_libganglia="yes"
1723 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1725 with_libganglia_config="$withval/bin/ganglia-config"
1726 with_libganglia="yes"
1727 else if test -d "$withval"
1729 GANGLIA_CPPFLAGS="-I$withval/include"
1730 GANGLIA_LDFLAGS="-L$withval/lib"
1731 with_libganglia="yes"
1733 with_libganglia_config="ganglia-config"
1734 with_libganglia="$withval"
1738 with_libganglia_config="ganglia-config"
1739 with_libganglia="yes"
1742 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1744 if test "x$GANGLIA_CPPFLAGS" = "x"
1746 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1749 if test "x$GANGLIA_LDFLAGS" = "x"
1751 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1754 if test "x$GANGLIA_LIBS" = "x"
1756 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1760 SAVE_CPPFLAGS="$CPPFLAGS"
1761 SAVE_LDFLAGS="$LDFLAGS"
1762 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1763 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1765 if test "x$with_libganglia" = "xyes"
1767 AC_CHECK_HEADERS(gm_protocol.h,
1769 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1770 [Define to 1 if you have the <gm_protocol.h> header file.])
1771 ], [with_libganglia="no (gm_protocol.h not found)"])
1774 if test "x$with_libganglia" = "xyes"
1776 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1778 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1779 [Define to 1 if you have the ganglia library (-lganglia).])
1780 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1783 CPPFLAGS="$SAVE_CPPFLAGS"
1784 LDFLAGS="$SAVE_LDFLAGS"
1786 AC_SUBST(GANGLIA_CPPFLAGS)
1787 AC_SUBST(GANGLIA_LDFLAGS)
1788 AC_SUBST(GANGLIA_LIBS)
1789 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1792 # --with-libgcrypt {{{
1793 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1794 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1795 GCRYPT_LIBS="$GCRYPT_LIBS"
1796 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1798 if test -f "$withval" && test -x "$withval"
1800 with_libgcrypt_config="$withval"
1801 with_libgcrypt="yes"
1802 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1804 with_libgcrypt_config="$withval/bin/gcrypt-config"
1805 with_libgcrypt="yes"
1806 else if test -d "$withval"
1808 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1809 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1810 with_libgcrypt="yes"
1812 with_libgcrypt_config="gcrypt-config"
1813 with_libgcrypt="$withval"
1817 with_libgcrypt_config="libgcrypt-config"
1818 with_libgcrypt="yes"
1821 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1823 if test "x$GCRYPT_CPPFLAGS" = "x"
1825 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1828 if test "x$GCRYPT_LDFLAGS" = "x"
1830 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1831 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1834 if test "x$GCRYPT_LIBS" = "x"
1836 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1840 SAVE_CPPFLAGS="$CPPFLAGS"
1841 SAVE_LDFLAGS="$LDFLAGS"
1842 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1843 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1845 if test "x$with_libgcrypt" = "xyes"
1847 if test "x$GCRYPT_CPPFLAGS" != "x"
1849 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1851 AC_CHECK_HEADERS(gcrypt.h,
1852 [with_libgcrypt="yes"],
1853 [with_libgcrypt="no (gcrypt.h not found)"])
1856 if test "x$with_libgcrypt" = "xyes"
1858 if test "x$GCRYPT_LDFLAGS" != "x"
1860 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1862 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1863 [with_libgcrypt="yes"],
1864 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1866 if test "$with_libgcrypt" != "no"; then
1867 m4_ifdef([AM_PATH_LIBGCRYPT],[AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")])
1868 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
1869 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
1873 CPPFLAGS="$SAVE_CPPFLAGS"
1874 LDFLAGS="$SAVE_LDFLAGS"
1876 if test "x$with_libgcrypt" = "xyes"
1878 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1881 AC_SUBST(GCRYPT_CPPFLAGS)
1882 AC_SUBST(GCRYPT_LDFLAGS)
1883 AC_SUBST(GCRYPT_LIBS)
1884 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1887 # --with-libiptc {{{
1888 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1890 if test "x$withval" = "xshipped"
1893 else if test "x$withval" = "xyes"
1895 with_libiptc="pkgconfig"
1896 else if test "x$withval" = "xno"
1901 with_libiptc_cflags="-I$withval/include"
1902 with_libiptc_libs="-L$withval/lib"
1906 if test "x$ac_system" = "xLinux"
1908 with_libiptc="pkgconfig"
1910 with_libiptc="no (Linux only)"
1914 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1916 with_libiptc="no (Don't have pkg-config)"
1919 if test "x$with_libiptc" = "xpkgconfig"
1921 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1924 with_libiptc="no (pkg-config doesn't know libiptc)"
1927 if test "x$with_libiptc" = "xpkgconfig"
1929 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1932 with_libiptc="no ($PKG_CONFIG failed)"
1934 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1937 with_libiptc="no ($PKG_CONFIG failed)"
1941 SAVE_CPPFLAGS="$CPPFLAGS"
1942 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1944 # check whether the header file for libiptc is available.
1945 if test "x$with_libiptc" = "xpkgconfig"
1947 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1948 [with_libiptc="no (header file missing)"])
1950 # If the header file is available, check for the required type declaractions.
1951 # They may be missing in old versions of libiptc. In that case, they will be
1952 # declared in the iptables plugin.
1953 if test "x$with_libiptc" = "xpkgconfig"
1955 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1957 # Check for the iptc_init symbol in the library.
1958 # This could be in iptc or ip4tc
1959 if test "x$with_libiptc" = "xpkgconfig"
1962 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1963 [with_libiptc="pkgconfig"],
1964 [with_libiptc="no"],
1965 [$with_libiptc_libs])
1968 if test "x$with_libiptc" = "xpkgconfig"
1973 CPPFLAGS="$SAVE_CPPFLAGS"
1975 if test "x$with_libiptc" = "xown"
1977 with_libiptc_cflags=""
1978 with_libiptc_libs=""
1980 if test "x$with_libiptc" = "xown"
1982 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1984 with_libiptc="no (Linux iptables headers not found)"
1987 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1990 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1991 if test "x$with_libiptc" = "xown"
1993 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1997 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1998 if test "x$with_libiptc" = "xyes"
2000 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
2001 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
2002 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
2003 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
2008 with_java_home="$JAVA_HOME"
2009 with_java_vmtype="client"
2014 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
2016 if test "x$withval" = "xno"
2019 else if test "x$withval" = "xyes"
2023 with_java_home="$withval"
2028 if test "x$with_java" = "xyes"
2030 if test -d "$with_java_home"
2032 AC_MSG_CHECKING([for jni.h])
2033 TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2034 if test "x$TMPVAR" != "x"
2036 AC_MSG_RESULT([found in $TMPVAR])
2037 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2039 AC_MSG_RESULT([not found])
2042 AC_MSG_CHECKING([for jni_md.h])
2043 TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2044 if test "x$TMPVAR" != "x"
2046 AC_MSG_RESULT([found in $TMPVAR])
2047 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2049 AC_MSG_RESULT([not found])
2052 AC_MSG_CHECKING([for libjvm.so])
2053 TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2054 if test "x$TMPVAR" != "x"
2056 AC_MSG_RESULT([found in $TMPVAR])
2057 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
2059 AC_MSG_RESULT([not found])
2062 if test "x$JAVAC" = "x"
2064 AC_MSG_CHECKING([for javac])
2065 TMPVAR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2066 if test "x$TMPVAR" != "x"
2069 AC_MSG_RESULT([$JAVAC])
2071 AC_MSG_RESULT([not found])
2074 if test "x$JAR" = "x"
2076 AC_MSG_CHECKING([for jar])
2077 TMPVAR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2078 if test "x$TMPVAR" != "x"
2081 AC_MSG_RESULT([$JAR])
2083 AC_MSG_RESULT([not found])
2086 else if test "x$with_java_home" != "x"
2088 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2092 if test "x$JAVA_CPPFLAGS" != "x"
2094 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2096 if test "x$JAVA_CFLAGS" != "x"
2098 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2100 if test "x$JAVA_LDFLAGS" != "x"
2102 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2104 if test "x$JAVAC" = "x"
2106 with_javac_path="$PATH"
2107 if test "x$with_java_home" != "x"
2109 with_javac_path="$with_java_home:with_javac_path"
2110 if test -d "$with_java_home/bin"
2112 with_javac_path="$with_java_home/bin:with_javac_path"
2116 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2118 if test "x$JAVAC" = "x"
2120 with_java="no (javac not found)"
2122 if test "x$JAR" = "x"
2124 with_jar_path="$PATH"
2125 if test "x$with_java_home" != "x"
2127 with_jar_path="$with_java_home:$with_jar_path"
2128 if test -d "$with_java_home/bin"
2130 with_jar_path="$with_java_home/bin:$with_jar_path"
2134 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2136 if test "x$JAR" = "x"
2138 with_java="no (jar not found)"
2141 SAVE_CPPFLAGS="$CPPFLAGS"
2142 SAVE_CFLAGS="$CFLAGS"
2143 SAVE_LDFLAGS="$LDFLAGS"
2144 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2145 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2146 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2148 if test "x$with_java" = "xyes"
2150 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2152 if test "x$with_java" = "xyes"
2154 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2156 [with_java="no (libjvm not found)"],
2159 if test "x$with_java" = "xyes"
2161 JAVA_LIBS="$JAVA_LIBS -ljvm"
2162 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2165 CPPFLAGS="$SAVE_CPPFLAGS"
2166 CFLAGS="$SAVE_CFLAGS"
2167 LDFLAGS="$SAVE_LDFLAGS"
2169 AC_SUBST(JAVA_CPPFLAGS)
2170 AC_SUBST(JAVA_CFLAGS)
2171 AC_SUBST(JAVA_LDFLAGS)
2173 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2176 # --with-libmemcached {{{
2177 with_libmemcached_cppflags=""
2178 with_libmemcached_ldflags=""
2179 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2181 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2183 with_libmemcached_cppflags="-I$withval/include"
2184 with_libmemcached_ldflags="-L$withval/lib"
2185 with_libmemcached="yes"
2187 with_libmemcached="$withval"
2191 with_libmemcached="yes"
2193 if test "x$with_libmemcached" = "xyes"
2195 SAVE_CPPFLAGS="$CPPFLAGS"
2196 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2198 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2200 CPPFLAGS="$SAVE_CPPFLAGS"
2202 if test "x$with_libmemcached" = "xyes"
2204 SAVE_CPPFLAGS="$CPPFLAGS"
2205 SAVE_LDFLAGS="$LDFLAGS"
2206 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2207 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2209 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2211 CPPFLAGS="$SAVE_CPPFLAGS"
2212 LDFLAGS="$SAVE_LDFLAGS"
2214 if test "x$with_libmemcached" = "xyes"
2216 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2217 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2218 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2219 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2220 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2221 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2222 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2224 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2227 # --with-libmodbus {{{
2228 with_libmodbus_config=""
2229 with_libmodbus_cflags=""
2230 with_libmodbus_libs=""
2231 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2233 if test "x$withval" = "xno"
2236 else if test "x$withval" = "xyes"
2238 with_libmodbus="use_pkgconfig"
2239 else if test -d "$with_libmodbus/lib"
2241 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2242 with_libmodbus_cflags="-I$withval/include"
2243 with_libmodbus_libs="-L$withval/lib -lmodbus"
2244 with_libmodbus="yes"
2247 [with_libmodbus="use_pkgconfig"])
2249 # configure using pkg-config
2250 if test "x$with_libmodbus" = "xuse_pkgconfig"
2252 if test "x$PKG_CONFIG" = "x"
2254 with_libmodbus="no (Don't have pkg-config)"
2257 if test "x$with_libmodbus" = "xuse_pkgconfig"
2259 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2260 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2263 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2266 if test "x$with_libmodbus" = "xuse_pkgconfig"
2268 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2271 with_libmodbus="no ($PKG_CONFIG failed)"
2273 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2276 with_libmodbus="no ($PKG_CONFIG failed)"
2279 if test "x$with_libmodbus" = "xuse_pkgconfig"
2281 with_libmodbus="yes"
2284 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2285 # the actual checks.
2286 if test "x$with_libmodbus" = "xyes"
2288 SAVE_CPPFLAGS="$CPPFLAGS"
2289 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2291 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2293 CPPFLAGS="$SAVE_CPPFLAGS"
2295 if test "x$with_libmodbus" = "xyes"
2297 SAVE_CPPFLAGS="$CPPFLAGS"
2298 SAVE_LDFLAGS="$LDFLAGS"
2300 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2301 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2303 AC_CHECK_LIB(modbus, modbus_connect,
2304 [with_libmodbus="yes"],
2305 [with_libmodbus="no (symbol modbus_connect not found)"])
2307 CPPFLAGS="$SAVE_CPPFLAGS"
2308 LDFLAGS="$SAVE_LDFLAGS"
2310 if test "x$with_libmodbus" = "xyes"
2312 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2313 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2314 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2315 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2319 # --with-libmongoc {{{
2320 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2322 if test "x$withval" = "xyes"
2324 with_libmongoc="yes"
2325 else if test "x$withval" = "xno"
2329 with_libmongoc="yes"
2330 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2331 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2334 [with_libmongoc="yes"])
2336 SAVE_CPPFLAGS="$CPPFLAGS"
2337 SAVE_LDFLAGS="$LDFLAGS"
2339 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2340 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2342 if test "x$with_libmongoc" = "xyes"
2344 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2346 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2348 AC_CHECK_HEADERS(mongo.h,
2349 [with_libmongoc="yes"],
2350 [with_libmongoc="no ('mongo.h' not found)"],
2352 # define MONGO_HAVE_STDINT 1
2354 # define MONGO_USE_LONG_LONG_INT 1
2358 if test "x$with_libmongoc" = "xyes"
2360 if test "x$LIBMONGOC_LDFLAGS" != "x"
2362 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2364 AC_CHECK_LIB(mongoc, mongo_run_command,
2365 [with_libmongoc="yes"],
2366 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2369 CPPFLAGS="$SAVE_CPPFLAGS"
2370 LDFLAGS="$SAVE_LDFLAGS"
2372 if test "x$with_libmongoc" = "xyes"
2374 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2375 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2376 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2377 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2379 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2382 # --with-libmysql {{{
2383 with_mysql_config="mysql_config"
2384 with_mysql_cflags=""
2386 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2388 if test "x$withval" = "xno"
2391 else if test "x$withval" = "xyes"
2395 if test -f "$withval" && test -x "$withval";
2397 with_mysql_config="$withval"
2398 else if test -x "$withval/bin/mysql_config"
2400 with_mysql_config="$withval/bin/mysql_config"
2408 if test "x$with_libmysql" = "xyes"
2410 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2411 mysql_config_status=$?
2413 if test $mysql_config_status -ne 0
2415 with_libmysql="no ($with_mysql_config failed)"
2417 SAVE_CPPFLAGS="$CPPFLAGS"
2418 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2421 have_mysql_mysql_h="no"
2422 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2424 if test "x$have_mysql_h" = "xno"
2426 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2429 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2431 with_libmysql="no (mysql.h not found)"
2434 CPPFLAGS="$SAVE_CPPFLAGS"
2437 if test "x$with_libmysql" = "xyes"
2439 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2440 mysql_config_status=$?
2442 if test $mysql_config_status -ne 0
2444 with_libmysql="no ($with_mysql_config failed)"
2446 AC_CHECK_LIB(mysqlclient, mysql_init,
2447 [with_libmysql="yes"],
2448 [with_libmysql="no (symbol 'mysql_init' not found)"],
2451 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2452 [with_libmysql="yes"],
2453 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2457 if test "x$with_libmysql" = "xyes"
2459 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2460 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2461 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2462 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2464 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2467 # --with-libnetlink {{{
2468 with_libnetlink_cflags=""
2469 with_libnetlink_libs="-lnetlink"
2470 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2472 echo "libnetlink: withval = $withval"
2473 if test "x$withval" = "xyes"
2475 with_libnetlink="yes"
2476 else if test "x$withval" = "xno"
2478 with_libnetlink="no"
2480 if test -d "$withval/include"
2482 with_libnetlink_cflags="-I$withval/include"
2483 with_libnetlink_libs="-L$withval/lib -lnetlink"
2484 with_libnetlink="yes"
2486 AC_MSG_ERROR("no such directory: $withval/include")
2491 if test "x$ac_system" = "xLinux"
2493 with_libnetlink="yes"
2495 with_libnetlink="no (Linux only library)"
2498 if test "x$with_libnetlink" = "xyes"
2500 SAVE_CFLAGS="$CFLAGS"
2501 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2503 with_libnetlink="no (libnetlink.h not found)"
2505 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2507 with_libnetlink="yes"
2511 #include <sys/types.h>
2512 #include <asm/types.h>
2513 #include <sys/socket.h>
2514 #include <linux/netlink.h>
2515 #include <linux/rtnetlink.h>])
2516 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2518 #include <sys/types.h>
2519 #include <asm/types.h>
2520 #include <sys/socket.h>])
2522 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2525 #include <sys/types.h>
2526 #include <asm/types.h>
2527 #include <sys/socket.h>
2528 #include <linux/netlink.h>
2529 #include <linux/rtnetlink.h>
2532 int retval = TCA_STATS2;
2536 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2538 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2541 #include <sys/types.h>
2542 #include <asm/types.h>
2543 #include <sys/socket.h>
2544 #include <linux/netlink.h>
2545 #include <linux/rtnetlink.h>
2548 int retval = TCA_STATS;
2552 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2554 CFLAGS="$SAVE_CFLAGS"
2556 if test "x$with_libnetlink" = "xyes"
2558 AC_CHECK_LIB(netlink, rtnl_open,
2559 [with_libnetlink="yes"],
2560 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2561 [$with_libnetlink_libs])
2563 if test "x$with_libnetlink" = "xyes"
2565 SAVE_CFLAGS="$CFLAGS"
2566 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2569 [if function 'rtnl_dump_filter' expects five arguments],
2570 [c_cv_rtnl_dump_filter_five_args],
2571 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2574 #include <sys/types.h>
2575 #include <asm/types.h>
2576 #include <sys/socket.h>
2577 #if HAVE_LIBNETLINK_H
2578 # include <libnetlink.h>
2579 #elif HAVE_IPROUTE_LIBNETLINK_H
2580 # include <iproute/libnetlink.h>
2581 #elif HAVE_LINUX_LIBNETLINK_H
2582 # include <linux/libnetlink.h>
2586 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2591 [c_cv_rtnl_dump_filter_five_args="yes"],
2592 [c_cv_rtnl_dump_filter_five_args="no"]
2597 [if function 'rtnl_dump_filter' expects three arguments],
2598 [c_cv_rtnl_dump_filter_three_args],
2599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2602 #include <sys/types.h>
2603 #include <asm/types.h>
2604 #include <sys/socket.h>
2605 #if HAVE_LIBNETLINK_H
2606 # include <libnetlink.h>
2607 #elif HAVE_IPROUTE_LIBNETLINK_H
2608 # include <iproute/libnetlink.h>
2609 #elif HAVE_LINUX_LIBNETLINK_H
2610 # include <linux/libnetlink.h>
2614 if (rtnl_dump_filter(NULL, NULL, NULL))
2619 [c_cv_rtnl_dump_filter_three_args="yes"],
2620 [c_cv_rtnl_dump_filter_three_args="no"]
2624 CFLAGS="$SAVE_CFLAGS"
2626 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2628 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2629 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2631 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2633 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2634 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2637 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2638 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2639 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2640 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2642 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2645 # --with-libnetapp {{{
2646 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2647 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2648 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2649 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2650 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2651 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2652 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2654 if test -d "$withval"
2656 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2657 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2658 with_libnetapp="yes"
2660 with_libnetapp="$withval"
2664 with_libnetapp="yes"
2667 SAVE_CPPFLAGS="$CPPFLAGS"
2668 SAVE_LDFLAGS="$LDFLAGS"
2669 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2670 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2672 if test "x$with_libnetapp" = "xyes"
2674 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2676 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2678 AC_CHECK_HEADERS(netapp_api.h,
2679 [with_libnetapp="yes"],
2680 [with_libnetapp="no (netapp_api.h not found)"])
2683 if test "x$with_libnetapp" = "xyes"
2685 if test "x$LIBNETAPP_LDFLAGS" != "x"
2687 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2690 if test "x$LIBNETAPP_LIBS" = "x"
2692 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2694 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2696 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2697 [with_libnetapp="yes"],
2698 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2700 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2703 CPPFLAGS="$SAVE_CPPFLAGS"
2704 LDFLAGS="$SAVE_LDFLAGS"
2706 if test "x$with_libnetapp" = "xyes"
2708 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2711 AC_SUBST(LIBNETAPP_CPPFLAGS)
2712 AC_SUBST(LIBNETAPP_LDFLAGS)
2713 AC_SUBST(LIBNETAPP_LIBS)
2714 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2717 # --with-libnetsnmp {{{
2718 with_snmp_config="net-snmp-config"
2721 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2723 if test "x$withval" = "xno"
2725 with_libnetsnmp="no"
2726 else if test "x$withval" = "xyes"
2728 with_libnetsnmp="yes"
2730 if test -x "$withval"
2732 with_snmp_config="$withval"
2733 with_libnetsnmp="yes"
2735 with_snmp_config="$withval/bin/net-snmp-config"
2736 with_libnetsnmp="yes"
2740 [with_libnetsnmp="yes"])
2741 if test "x$with_libnetsnmp" = "xyes"
2743 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2744 snmp_config_status=$?
2746 if test $snmp_config_status -ne 0
2748 with_libnetsnmp="no ($with_snmp_config failed)"
2750 SAVE_CPPFLAGS="$CPPFLAGS"
2751 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2753 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2755 CPPFLAGS="$SAVE_CPPFLAGS"
2758 if test "x$with_libnetsnmp" = "xyes"
2760 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2761 snmp_config_status=$?
2763 if test $snmp_config_status -ne 0
2765 with_libnetsnmp="no ($with_snmp_config failed)"
2767 AC_CHECK_LIB(netsnmp, init_snmp,
2768 [with_libnetsnmp="yes"],
2769 [with_libnetsnmp="no (libnetsnmp not found)"],
2773 if test "x$with_libnetsnmp" = "xyes"
2775 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2776 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2777 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2778 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2780 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2783 # --with-liboconfig {{{
2784 with_own_liboconfig="no"
2785 liboconfig_LDFLAGS="$LDFLAGS"
2786 liboconfig_CPPFLAGS="$CPPFLAGS"
2787 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2789 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2791 if test -d "$withval/lib"
2793 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2795 if test -d "$withval/include"
2797 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2800 if test "x$withval" = "xno"
2802 AC_MSG_ERROR("liboconfig is required")
2806 with_liboconfig="yes"
2809 save_LDFLAGS="$LDFLAGS"
2810 save_CPPFLAGS="$CPPFLAGS"
2811 LDFLAGS="$liboconfig_LDFLAGS"
2812 CPPFLAGS="$liboconfig_CPPFLAGS"
2813 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2815 with_liboconfig="yes"
2816 with_own_liboconfig="no"
2819 with_liboconfig="yes"
2820 with_own_liboconfig="yes"
2821 LDFLAGS="$save_LDFLAGS"
2822 CPPFLAGS="$save_CPPFLAGS"
2825 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2826 if test "x$with_own_liboconfig" = "xyes"
2828 with_liboconfig="yes (shipped version)"
2832 # --with-liboping {{{
2833 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2835 if test "x$withval" = "xyes"
2838 else if test "x$withval" = "xno"
2843 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2844 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2847 [with_liboping="yes"])
2849 SAVE_CPPFLAGS="$CPPFLAGS"
2850 SAVE_LDFLAGS="$LDFLAGS"
2852 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2853 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2855 if test "x$with_liboping" = "xyes"
2857 if test "x$LIBOPING_CPPFLAGS" != "x"
2859 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2861 AC_CHECK_HEADERS(oping.h,
2862 [with_liboping="yes"],
2863 [with_liboping="no (oping.h not found)"])
2865 if test "x$with_liboping" = "xyes"
2867 if test "x$LIBOPING_LDFLAGS" != "x"
2869 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2871 AC_CHECK_LIB(oping, ping_construct,
2872 [with_liboping="yes"],
2873 [with_liboping="no (symbol 'ping_construct' not found)"])
2876 CPPFLAGS="$SAVE_CPPFLAGS"
2877 LDFLAGS="$SAVE_LDFLAGS"
2879 if test "x$with_liboping" = "xyes"
2881 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2882 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2883 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2884 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2886 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2890 with_oracle_cppflags=""
2892 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2894 if test "x$withval" = "xyes"
2896 if test "x$ORACLE_HOME" = "x"
2898 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2901 else if test "x$withval" = "xno"
2906 ORACLE_HOME="$withval"
2910 if test "x$ORACLE_HOME" = "x"
2912 with_oracle="no (ORACLE_HOME is not set)"
2917 if test "x$ORACLE_HOME" != "x"
2919 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2921 if test -e "$ORACLE_HOME/lib/ldflags"
2923 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2925 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2926 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2928 if test "x$with_oracle" = "xyes"
2930 SAVE_CPPFLAGS="$CPPFLAGS"
2931 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2933 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2935 CPPFLAGS="$SAVE_CPPFLAGS"
2937 if test "x$with_oracle" = "xyes"
2939 SAVE_CPPFLAGS="$CPPFLAGS"
2941 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2942 LIBS="$LIBS $with_oracle_libs"
2944 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2946 CPPFLAGS="$SAVE_CPPFLAGS"
2949 if test "x$with_oracle" = "xyes"
2951 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2952 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2953 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2954 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2958 # --with-libowcapi {{{
2959 with_libowcapi_cppflags=""
2960 with_libowcapi_libs="-lowcapi"
2961 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2963 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2965 with_libowcapi_cppflags="-I$withval/include"
2966 with_libowcapi_libs="-L$withval/lib -lowcapi"
2967 with_libowcapi="yes"
2969 with_libowcapi="$withval"
2973 with_libowcapi="yes"
2975 if test "x$with_libowcapi" = "xyes"
2977 SAVE_CPPFLAGS="$CPPFLAGS"
2978 CPPFLAGS="$with_libowcapi_cppflags"
2980 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2982 CPPFLAGS="$SAVE_CPPFLAGS"
2984 if test "x$with_libowcapi" = "xyes"
2986 SAVE_LDFLAGS="$LDFLAGS"
2987 SAVE_CPPFLAGS="$CPPFLAGS"
2988 LDFLAGS="$with_libowcapi_libs"
2989 CPPFLAGS="$with_libowcapi_cppflags"
2991 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2993 LDFLAGS="$SAVE_LDFLAGS"
2994 CPPFLAGS="$SAVE_CPPFLAGS"
2996 if test "x$with_libowcapi" = "xyes"
2998 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2999 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
3000 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
3001 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
3005 # --with-libpcap {{{
3006 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
3008 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3010 LDFLAGS="$LDFLAGS -L$withval/lib"
3011 CPPFLAGS="$CPPFLAGS -I$withval/include"
3014 with_libpcap="$withval"
3020 if test "x$with_libpcap" = "xyes"
3022 AC_CHECK_LIB(pcap, pcap_open_live,
3024 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
3025 ], [with_libpcap="no (libpcap not found)"])
3027 if test "x$with_libpcap" = "xyes"
3029 AC_CHECK_HEADERS(pcap.h,,
3030 [with_libpcap="no (pcap.h not found)"])
3032 if test "x$with_libpcap" = "xyes"
3034 AC_CHECK_HEADERS(pcap-bpf.h,,
3035 [with_libpcap="no (pcap-bpf.h not found)"])
3037 if test "x$with_libpcap" = "xyes"
3039 AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP],
3040 [c_cv_libpcap_have_pcap_error_iface_not_up],
3041 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
3046 int val = PCAP_ERROR_IFACE_NOT_UP;
3050 [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
3051 [c_cv_libpcap_have_pcap_error_iface_not_up="no"]))
3053 if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes"
3055 with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)"
3057 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3060 # --with-libperl {{{
3061 perl_interpreter="perl"
3062 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3064 if test -f "$withval" && test -x "$withval"
3066 perl_interpreter="$withval"
3068 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3070 LDFLAGS="$LDFLAGS -L$withval/lib"
3071 CPPFLAGS="$CPPFLAGS -I$withval/include"
3072 perl_interpreter="$withval/bin/perl"
3075 with_libperl="$withval"
3082 AC_MSG_CHECKING([for perl])
3083 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3084 if test -x "$perl_interpreter"
3086 AC_MSG_RESULT([yes ($perl_interpreter)])
3092 AC_SUBST(PERL, "$perl_interpreter")
3094 if test "x$with_libperl" = "xyes" \
3095 && test -n "$perl_interpreter"
3097 SAVE_CFLAGS="$CFLAGS"
3099 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3100 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3101 PERL_LIBS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3102 CFLAGS="$CFLAGS $PERL_CFLAGS"
3103 LIBS="$LIBS $PERL_LIBS"
3105 AC_CACHE_CHECK([for libperl],
3106 [c_cv_have_libperl],
3107 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3109 #define PERL_NO_GET_CONTEXT
3116 load_module (PERL_LOADMOD_NOIMPORT,
3117 newSVpv ("Collectd::Plugin::FooBar", 24),
3121 [c_cv_have_libperl="yes"],
3122 [c_cv_have_libperl="no"]
3126 if test "x$c_cv_have_libperl" = "xyes"
3128 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3129 AC_SUBST(PERL_CFLAGS)
3135 CFLAGS="$SAVE_CFLAGS"
3137 else if test -z "$perl_interpreter"; then
3138 with_libperl="no (no perl interpreter found)"
3139 c_cv_have_libperl="no"
3141 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3143 if test "x$with_libperl" = "xyes"
3145 SAVE_CFLAGS="$CFLAGS"
3147 CFLAGS="$CFLAGS $PERL_CFLAGS"
3148 LIBS="$LIBS $PERL_LIBS"
3150 AC_CACHE_CHECK([if perl supports ithreads],
3151 [c_cv_have_perl_ithreads],
3152 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3158 #if !defined(USE_ITHREADS)
3159 # error "Perl does not support ithreads!"
3160 #endif /* !defined(USE_ITHREADS) */
3164 [c_cv_have_perl_ithreads="yes"],
3165 [c_cv_have_perl_ithreads="no"]
3169 if test "x$c_cv_have_perl_ithreads" = "xyes"
3171 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3174 CFLAGS="$SAVE_CFLAGS"
3178 if test "x$with_libperl" = "xyes"
3180 SAVE_CFLAGS="$CFLAGS"
3182 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3183 # (see issues #41 and #42)
3184 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3185 LIBS="$LIBS $PERL_LIBS"
3187 AC_CACHE_CHECK([for broken Perl_load_module()],
3188 [c_cv_have_broken_perl_load_module],
3189 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3191 #define PERL_NO_GET_CONTEXT
3198 load_module (PERL_LOADMOD_NOIMPORT,
3199 newSVpv ("Collectd::Plugin::FooBar", 24),
3203 [c_cv_have_broken_perl_load_module="no"],
3204 [c_cv_have_broken_perl_load_module="yes"]
3208 CFLAGS="$SAVE_CFLAGS"
3211 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3212 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3214 if test "x$with_libperl" = "xyes"
3216 SAVE_CFLAGS="$CFLAGS"
3218 CFLAGS="$CFLAGS $PERL_CFLAGS"
3219 LIBS="$LIBS $PERL_LIBS"
3222 [struct mgvtbl.svt_local],
3223 [have_struct_mgvtbl_svt_local="yes"],
3224 [have_struct_mgvtbl_svt_local="no"],
3231 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3233 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3234 [Define if Perl's struct mgvtbl has member svt_local.])
3237 CFLAGS="$SAVE_CFLAGS"
3243 with_pg_config="pg_config"
3244 with_libpq_includedir=""
3245 with_libpq_libdir=""
3246 with_libpq_cppflags=""
3247 with_libpq_ldflags=""
3248 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3251 if test "x$withval" = "xno"
3254 else if test "x$withval" = "xyes"
3258 if test -f "$withval" && test -x "$withval";
3260 with_pg_config="$withval"
3261 else if test -x "$withval/bin/pg_config"
3263 with_pg_config="$withval/bin/pg_config"
3271 if test "x$with_libpq" = "xyes"
3273 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3276 if test $pg_config_status -eq 0
3278 if test -n "$with_libpq_includedir"; then
3279 for dir in $with_libpq_includedir; do
3280 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3284 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3287 SAVE_CPPFLAGS="$CPPFLAGS"
3288 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3290 AC_CHECK_HEADERS(libpq-fe.h, [],
3291 [with_libpq="no (libpq-fe.h not found)"], [])
3293 CPPFLAGS="$SAVE_CPPFLAGS"
3295 if test "x$with_libpq" = "xyes"
3297 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3300 if test $pg_config_status -eq 0
3302 if test -n "$with_libpq_libdir"; then
3303 for dir in $with_libpq_libdir; do
3304 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3308 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3311 SAVE_LDFLAGS="$LDFLAGS"
3312 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3314 AC_CHECK_LIB(pq, PQconnectdb,
3316 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3318 AC_CHECK_LIB(pq, PQserverVersion,
3320 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3322 LDFLAGS="$SAVE_LDFLAGS"
3324 if test "x$with_libpq" = "xyes"
3326 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3327 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3328 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3329 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3331 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3334 # --with-libpthread {{{
3335 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3336 [ if test "x$withval" != "xno" \
3337 && test "x$withval" != "xyes"
3339 LDFLAGS="$LDFLAGS -L$withval/lib"
3340 CPPFLAGS="$CPPFLAGS -I$withval/include"
3341 with_libpthread="yes"
3343 if test "x$withval" = "xno"
3345 with_libpthread="no (disabled)"
3348 ], [with_libpthread="yes"])
3349 if test "x$with_libpthread" = "xyes"
3351 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3354 if test "x$with_libpthread" = "xyes"
3356 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3358 if test "x$with_libpthread" = "xyes"
3364 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3365 [Wether or not to use pthread (POSIX threads) library])
3366 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3371 with_python_path="$PATH"
3372 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3374 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3376 with_python="$withval"
3377 else if test -x "$withval"
3379 with_python_prog="$withval"
3380 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3382 else if test -d "$withval"
3384 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3387 AC_MSG_WARN([Argument not recognized: $withval])
3389 ], [with_python="yes"])
3392 SAVE_CPPFLAGS="$CPPFLAGS"
3393 SAVE_LDFLAGS="$LDFLAGS"
3396 PATH="$with_python_path"
3398 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3400 AC_MSG_CHECKING([for python])
3401 with_python_prog="`which python 2>/dev/null`"
3402 if test "x$with_python_prog" = "x"
3404 AC_MSG_RESULT([not found])
3405 with_python="no (interpreter not found)"
3407 AC_MSG_RESULT([$with_python_prog])
3411 if test "x$with_python" = "xyes"
3413 AC_MSG_CHECKING([for Python CPPFLAGS])
3414 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3415 python_config_status=$?
3417 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3419 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3422 AC_MSG_RESULT([$python_include_path])
3426 if test "x$with_python" = "xyes"
3428 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3429 AC_CHECK_HEADERS(Python.h,
3430 [with_python="yes"],
3431 [with_python="no ('Python.h' not found)"])
3434 if test "x$with_python" = "xyes"
3436 AC_MSG_CHECKING([for Python LDFLAGS])
3437 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`
3438 python_config_status=$?
3440 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3442 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3445 AC_MSG_RESULT([$python_library_path])
3449 if test "x$with_python" = "xyes"
3451 AC_MSG_CHECKING([for Python LIBS])
3452 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`
3453 python_config_status=$?
3455 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3457 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3460 AC_MSG_RESULT([$python_library_flags])
3464 if test "x$with_python" = "xyes"
3466 LDFLAGS="-L$python_library_path $LDFLAGS"
3467 LIBS="$python_library_flags $LIBS"
3469 AC_CHECK_FUNC(PyObject_CallFunction,
3470 [with_python="yes"],
3471 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3475 CPPFLAGS="$SAVE_CPPFLAGS"
3476 LDFLAGS="$SAVE_LDFLAGS"
3479 if test "x$with_python" = "xyes"
3481 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3482 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3483 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3484 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3485 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3486 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3490 # --with-librabbitmq {{{
3491 with_librabbitmq_cppflags=""
3492 with_librabbitmq_ldflags=""
3493 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3495 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3497 with_librabbitmq_cppflags="-I$withval/include"
3498 with_librabbitmq_ldflags="-L$withval/lib"
3499 with_librabbitmq="yes"
3501 with_librabbitmq="$withval"
3505 with_librabbitmq="yes"
3507 SAVE_CPPFLAGS="$CPPFLAGS"
3508 SAVE_LDFLAGS="$LDFLAGS"
3509 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3510 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3511 if test "x$with_librabbitmq" = "xyes"
3513 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3515 if test "x$with_librabbitmq" = "xyes"
3517 # librabbitmq up to version 0.9.1 provides "library_errno", later
3518 # versions use "library_error". The library does not provide a version
3519 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3520 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3523 # include <stdlib.h>
3529 # include <stdint.h>
3532 # include <inttypes.h>
3537 if test "x$with_librabbitmq" = "xyes"
3539 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3541 if test "x$with_librabbitmq" = "xyes"
3543 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3544 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3545 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3546 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3547 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3548 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3549 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3551 CPPFLAGS="$SAVE_CPPFLAGS"
3552 LDFLAGS="$SAVE_LDFLAGS"
3553 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3555 with_amqp_tcp_socket="no"
3556 if test "x$with_librabbitmq" = "xyes"
3558 SAVE_CPPFLAGS="$CPPFLAGS"
3559 SAVE_LDFLAGS="$LDFLAGS"
3561 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3562 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3565 AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h)
3566 AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"])
3567 if test "x$with_amqp_tcp_socket" = "xyes"
3569 AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1,
3570 [Define if librabbitmq provides the new TCP socket interface.])
3573 AC_CHECK_DECLS(amqp_socket_close,
3574 [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"],
3577 #ifdef HAVE_AMQP_TCP_SOCKET_H
3578 # include <amqp_tcp_socket.h>
3580 #ifdef HAVE_AMQP_SOCKET_H
3581 # include <amqp_socket.h>
3585 CPPFLAGS="$SAVE_CPPFLAGS"
3586 LDFLAGS="$SAVE_LDFLAGS"
3591 # --with-librouteros {{{
3592 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3594 if test "x$withval" = "xyes"
3596 with_librouteros="yes"
3597 else if test "x$withval" = "xno"
3599 with_librouteros="no"
3601 with_librouteros="yes"
3602 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3603 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3606 [with_librouteros="yes"])
3608 SAVE_CPPFLAGS="$CPPFLAGS"
3609 SAVE_LDFLAGS="$LDFLAGS"
3611 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3612 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3614 if test "x$with_librouteros" = "xyes"
3616 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3618 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3620 AC_CHECK_HEADERS(routeros_api.h,
3621 [with_librouteros="yes"],
3622 [with_librouteros="no (routeros_api.h not found)"])
3624 if test "x$with_librouteros" = "xyes"
3626 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3628 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3630 AC_CHECK_LIB(routeros, ros_interface,
3631 [with_librouteros="yes"],
3632 [with_librouteros="no (symbol 'ros_interface' not found)"])
3635 CPPFLAGS="$SAVE_CPPFLAGS"
3636 LDFLAGS="$SAVE_LDFLAGS"
3638 if test "x$with_librouteros" = "xyes"
3640 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3641 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3642 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3643 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3645 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3649 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3652 librrd_threadsafe="yes"
3653 librrd_rrdc_update="no"
3654 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3655 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3657 librrd_cflags="-I$withval/include"
3658 librrd_ldflags="-L$withval/lib"
3661 with_librrd="$withval"
3663 ], [with_librrd="yes"])
3664 if test "x$with_librrd" = "xyes"
3666 SAVE_CPPFLAGS="$CPPFLAGS"
3667 SAVE_LDFLAGS="$LDFLAGS"
3669 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3670 LDFLAGS="$LDFLAGS $librrd_ldflags"
3672 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3674 CPPFLAGS="$SAVE_CPPFLAGS"
3675 LDFLAGS="$SAVE_LDFLAGS"
3677 if test "x$with_librrd" = "xyes"
3679 SAVE_CPPFLAGS="$CPPFLAGS"
3680 SAVE_LDFLAGS="$LDFLAGS"
3682 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3683 LDFLAGS="$LDFLAGS $librrd_ldflags"
3685 AC_CHECK_LIB(rrd_th, rrd_update_r,
3687 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3689 [librrd_threadsafe="no"
3690 AC_CHECK_LIB(rrd, rrd_update,
3692 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3694 [with_librrd="no (symbol 'rrd_update' not found)"],
3699 if test "x$librrd_threadsafe" = "xyes"
3701 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3703 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3706 CPPFLAGS="$SAVE_CPPFLAGS"
3707 LDFLAGS="$SAVE_LDFLAGS"
3709 if test "x$with_librrd" = "xyes"
3711 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3712 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3713 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3714 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3716 if test "x$librrd_threadsafe" = "xyes"
3718 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3722 # --with-libsensors {{{
3723 with_sensors_cflags=""
3724 with_sensors_ldflags=""
3725 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3727 if test "x$withval" = "xno"
3729 with_libsensors="no"
3731 with_libsensors="yes"
3732 if test "x$withval" != "xyes"
3734 with_sensors_cflags="-I$withval/include"
3735 with_sensors_ldflags="-L$withval/lib"
3736 with_libsensors="yes"
3741 if test "x$ac_system" = "xLinux"
3743 with_libsensors="yes"
3745 with_libsensors="no (Linux only library)"
3748 if test "x$with_libsensors" = "xyes"
3750 SAVE_CPPFLAGS="$CPPFLAGS"
3751 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3753 # AC_CHECK_HEADERS(sensors/sensors.h,
3755 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3757 # [with_libsensors="no (sensors/sensors.h not found)"])
3758 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3760 CPPFLAGS="$SAVE_CPPFLAGS"
3762 if test "x$with_libsensors" = "xyes"
3764 SAVE_CPPFLAGS="$CPPFLAGS"
3765 SAVE_LDFLAGS="$LDFLAGS"
3766 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3767 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3769 AC_CHECK_LIB(sensors, sensors_init,
3771 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3773 [with_libsensors="no (libsensors not found)"])
3775 CPPFLAGS="$SAVE_CPPFLAGS"
3776 LDFLAGS="$SAVE_LDFLAGS"
3778 if test "x$with_libsensors" = "xyes"
3780 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3781 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3782 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3783 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3785 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3788 # --with-libstatgrab {{{
3789 with_libstatgrab_cflags=""
3790 with_libstatgrab_ldflags=""
3791 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3793 if test "x$withval" != "xno" \
3794 && test "x$withval" != "xyes"
3796 with_libstatgrab_cflags="-I$withval/include"
3797 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3798 with_libstatgrab="yes"
3799 with_libstatgrab_pkg_config="no"
3801 with_libstatgrab="$withval"
3802 with_libstatgrab_pkg_config="yes"
3806 with_libstatgrab="yes"
3807 with_libstatgrab_pkg_config="yes"
3810 if test "x$with_libstatgrab" = "xyes" \
3811 && test "x$with_libstatgrab_pkg_config" = "xyes"
3813 if test "x$PKG_CONFIG" != "x"
3815 AC_MSG_CHECKING([pkg-config for libstatgrab])
3817 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3820 with_libstatgrab_pkg_config="no"
3821 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3822 temp_result="not found"
3824 AC_MSG_RESULT([$temp_result])
3826 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3827 with_libstatgrab_pkg_config="no"
3828 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3832 if test "x$with_libstatgrab" = "xyes" \
3833 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3834 && test "x$with_libstatgrab_cflags" = "x"
3836 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3837 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3840 with_libstatgrab_cflags="$temp_result"
3842 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3843 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3845 AC_MSG_RESULT([$temp_result])
3848 if test "x$with_libstatgrab" = "xyes" \
3849 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3850 && test "x$with_libstatgrab_ldflags" = "x"
3852 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3853 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3856 with_libstatgrab_ldflags="$temp_result"
3858 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3859 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3861 AC_MSG_RESULT([$temp_result])
3864 if test "x$with_libstatgrab" = "xyes"
3866 SAVE_CPPFLAGS="$CPPFLAGS"
3867 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3869 AC_CHECK_HEADERS(statgrab.h,
3870 [with_libstatgrab="yes"],
3871 [with_libstatgrab="no (statgrab.h not found)"])
3873 CPPFLAGS="$SAVE_CPPFLAGS"
3876 if test "x$with_libstatgrab" = "xyes"
3878 SAVE_CFLAGS="$CFLAGS"
3879 SAVE_LDFLAGS="$LDFLAGS"
3881 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3882 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3884 AC_CHECK_LIB(statgrab, sg_init,
3885 [with_libstatgrab="yes"],
3886 [with_libstatgrab="no (symbol sg_init not found)"])
3888 CFLAGS="$SAVE_CFLAGS"
3889 LDFLAGS="$SAVE_LDFLAGS"
3892 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3893 if test "x$with_libstatgrab" = "xyes"
3895 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3896 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3897 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3898 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3899 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3903 # --with-libtokyotyrant {{{
3904 with_libtokyotyrant_cppflags=""
3905 with_libtokyotyrant_ldflags=""
3906 with_libtokyotyrant_libs=""
3907 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3909 if test "x$withval" = "xno"
3911 with_libtokyotyrant="no"
3912 else if test "x$withval" = "xyes"
3914 with_libtokyotyrant="yes"
3916 with_libtokyotyrant_cppflags="-I$withval/include"
3917 with_libtokyotyrant_ldflags="-L$withval/include"
3918 with_libtokyotyrant_libs="-ltokyotyrant"
3919 with_libtokyotyrant="yes"
3923 with_libtokyotyrant="yes"
3926 if test "x$with_libtokyotyrant" = "xyes"
3928 if $PKG_CONFIG --exists tokyotyrant
3930 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3931 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`"
3932 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`"
3936 SAVE_CPPFLAGS="$CPPFLAGS"
3937 SAVE_LDFLAGS="$LDFLAGS"
3938 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3939 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3941 if test "x$with_libtokyotyrant" = "xyes"
3943 AC_CHECK_HEADERS(tcrdb.h,
3945 AC_DEFINE(HAVE_TCRDB_H, 1,
3946 [Define to 1 if you have the <tcrdb.h> header file.])
3947 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3950 if test "x$with_libtokyotyrant" = "xyes"
3952 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3954 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3955 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3957 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3958 [$with_libtokyotyrant_libs])
3961 CPPFLAGS="$SAVE_CPPFLAGS"
3962 LDFLAGS="$SAVE_LDFLAGS"
3964 if test "x$with_libtokyotyrant" = "xyes"
3966 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3967 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3968 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3969 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3970 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3971 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3973 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3976 # --with-libupsclient {{{
3977 with_libupsclient_config=""
3978 with_libupsclient_cflags=""
3979 with_libupsclient_libs=""
3980 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3982 if test "x$withval" = "xno"
3984 with_libupsclient="no"
3985 else if test "x$withval" = "xyes"
3987 with_libupsclient="use_pkgconfig"
3989 if test -x "$withval"
3991 with_libupsclient_config="$withval"
3992 with_libupsclient="use_libupsclient_config"
3993 else if test -x "$withval/bin/libupsclient-config"
3995 with_libupsclient_config="$withval/bin/libupsclient-config"
3996 with_libupsclient="use_libupsclient_config"
3998 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3999 with_libupsclient_cflags="-I$withval/include"
4000 with_libupsclient_libs="-L$withval/lib -lupsclient"
4001 with_libupsclient="yes"
4005 [with_libupsclient="use_pkgconfig"])
4007 # configure using libupsclient-config
4008 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4010 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
4011 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
4014 with_libupsclient="no ($with_libupsclient_config failed)"
4016 with_libupsclient_libs="`$with_libupsclient_config --libs`"
4019 with_libupsclient="no ($with_libupsclient_config failed)"
4022 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4024 with_libupsclient="yes"
4027 # configure using pkg-config
4028 if test "x$with_libupsclient" = "xuse_pkgconfig"
4030 if test "x$PKG_CONFIG" = "x"
4032 with_libupsclient="no (Don't have pkg-config)"
4035 if test "x$with_libupsclient" = "xuse_pkgconfig"
4037 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
4038 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
4041 with_libupsclient="no (pkg-config doesn't know libupsclient)"
4044 if test "x$with_libupsclient" = "xuse_pkgconfig"
4046 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
4049 with_libupsclient="no ($PKG_CONFIG failed)"
4051 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
4054 with_libupsclient="no ($PKG_CONFIG failed)"
4057 if test "x$with_libupsclient" = "xuse_pkgconfig"
4059 with_libupsclient="yes"
4062 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
4063 # the actual checks.
4064 if test "x$with_libupsclient" = "xyes"
4066 SAVE_CPPFLAGS="$CPPFLAGS"
4067 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4069 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
4071 CPPFLAGS="$SAVE_CPPFLAGS"
4073 if test "x$with_libupsclient" = "xyes"
4075 SAVE_CPPFLAGS="$CPPFLAGS"
4076 SAVE_LDFLAGS="$LDFLAGS"
4078 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4079 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
4081 AC_CHECK_LIB(upsclient, upscli_connect,
4082 [with_libupsclient="yes"],
4083 [with_libupsclient="no (symbol upscli_connect not found)"])
4085 CPPFLAGS="$SAVE_CPPFLAGS"
4086 LDFLAGS="$SAVE_LDFLAGS"
4088 if test "x$with_libupsclient" = "xyes"
4090 SAVE_CPPFLAGS="$CPPFLAGS"
4091 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4093 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4094 [#include <stdlib.h>
4096 #include <upsclient.h>])
4098 CPPFLAGS="$SAVE_CPPFLAGS"
4100 if test "x$with_libupsclient" = "xyes"
4102 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4103 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4104 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4105 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4109 # --with-libxmms {{{
4110 with_xmms_config="xmms-config"
4113 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4115 if test "x$withval" != "xno" \
4116 && test "x$withval" != "xyes"
4118 if test -f "$withval" && test -x "$withval";
4120 with_xmms_config="$withval"
4121 else if test -x "$withval/bin/xmms-config"
4123 with_xmms_config="$withval/bin/xmms-config"
4126 else if test "x$withval" = "xno"
4136 if test "x$with_libxmms" = "xyes"
4138 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4139 xmms_config_status=$?
4141 if test $xmms_config_status -ne 0
4146 if test "x$with_libxmms" = "xyes"
4148 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4149 xmms_config_status=$?
4151 if test $xmms_config_status -ne 0
4156 if test "x$with_libxmms" = "xyes"
4158 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4160 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4161 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4162 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4163 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4170 with_libxmms_numeric=0
4171 if test "x$with_libxmms" = "xyes"
4173 with_libxmms_numeric=1
4175 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4176 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4179 # --with-libyajl {{{
4180 with_libyajl_cppflags=""
4181 with_libyajl_ldflags=""
4182 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4184 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4186 with_libyajl_cppflags="-I$withval/include"
4187 with_libyajl_ldflags="-L$withval/lib"
4190 with_libyajl="$withval"
4196 if test "x$with_libyajl" = "xyes"
4198 SAVE_CPPFLAGS="$CPPFLAGS"
4199 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4201 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4202 AC_CHECK_HEADERS(yajl/yajl_version.h)
4204 CPPFLAGS="$SAVE_CPPFLAGS"
4206 if test "x$with_libyajl" = "xyes"
4208 SAVE_CPPFLAGS="$CPPFLAGS"
4209 SAVE_LDFLAGS="$LDFLAGS"
4210 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4211 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4213 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4215 CPPFLAGS="$SAVE_CPPFLAGS"
4216 LDFLAGS="$SAVE_LDFLAGS"
4218 if test "x$with_libyajl" = "xyes"
4220 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4221 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4222 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4223 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4224 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4225 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4226 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4228 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4231 # --with-libvarnish {{{
4232 with_libvarnish_cppflags=""
4233 with_libvarnish_cflags=""
4234 with_libvarnish_libs=""
4235 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4237 if test "x$withval" = "xno"
4239 with_libvarnish="no"
4240 else if test "x$withval" = "xyes"
4242 with_libvarnish="use_pkgconfig"
4243 else if test -d "$with_libvarnish/lib"
4245 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4246 with_libvarnish_cflags="-I$withval/include"
4247 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4248 with_libvarnish="yes"
4251 [with_libvarnish="use_pkgconfig"])
4253 # configure using pkg-config
4254 if test "x$with_libvarnish" = "xuse_pkgconfig"
4256 if test "x$PKG_CONFIG" = "x"
4258 with_libvarnish="no (Don't have pkg-config)"
4261 if test "x$with_libvarnish" = "xuse_pkgconfig"
4263 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4264 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4267 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4270 if test "x$with_libvarnish" = "xuse_pkgconfig"
4272 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4275 with_libvarnish="no ($PKG_CONFIG failed)"
4277 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4280 with_libvarnish="no ($PKG_CONFIG failed)"
4283 if test "x$with_libvarnish" = "xuse_pkgconfig"
4285 with_libvarnish="yes"
4288 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4289 # the actual checks.
4290 if test "x$with_libvarnish" = "xyes"
4292 SAVE_CPPFLAGS="$CPPFLAGS"
4293 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4294 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4296 CPPFLAGS="$SAVE_CPPFLAGS"
4298 if test "x$with_libvarnish" = "xyes"
4300 SAVE_CPPFLAGS="$CPPFLAGS"
4301 #SAVE_LDFLAGS="$LDFLAGS"
4303 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4304 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4306 AC_CHECK_HEADERS(varnish/vsc.h,
4307 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4308 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4310 CPPFLAGS="$SAVE_CPPFLAGS"
4311 #LDFLAGS="$SAVE_LDFLAGS"
4313 if test "x$with_libvarnish" = "xyes"
4315 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4316 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4317 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4318 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4322 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4323 with_libxml2="no (pkg-config isn't available)"
4324 with_libxml2_cflags=""
4325 with_libxml2_ldflags=""
4326 with_libvirt="no (pkg-config isn't available)"
4327 with_libvirt_cflags=""
4328 with_libvirt_ldflags=""
4329 if test "x$PKG_CONFIG" != "x"
4331 $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
4336 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4339 $PKG_CONFIG --exists libvirt 2>/dev/null
4344 with_libvirt="no (pkg-config doesn't know libvirt)"
4347 if test "x$with_libxml2" = "xyes"
4349 with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
4354 with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
4360 if test "x$with_libxml2" = "xyes"
4362 SAVE_CPPFLAGS="$CPPFLAGS"
4363 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4365 AC_CHECK_HEADERS(libxml/parser.h, [],
4366 [with_libxml2="no (libxml/parser.h not found)"])
4368 CPPFLAGS="$SAVE_CPPFLAGS"
4370 if test "x$with_libxml2" = "xyes"
4372 SAVE_CFLAGS="$CFLAGS"
4373 SAVE_LDFLAGS="$LDFLAGS"
4375 CFLAGS="$CFLAGS $with_libxml2_cflags"
4376 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4378 AC_CHECK_LIB(xml2, xmlXPathEval,
4379 [with_libxml2="yes"],
4380 [with_libxml2="no (symbol xmlXPathEval not found)"])
4382 CFLAGS="$SAVE_CFLAGS"
4383 LDFLAGS="$SAVE_LDFLAGS"
4385 dnl Add the right compiler flags and libraries.
4386 if test "x$with_libxml2" = "xyes"; then
4387 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4388 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4389 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4390 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4392 if test "x$with_libvirt" = "xyes"
4394 with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`"
4399 with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`"
4405 if test "x$with_libvirt" = "xyes"
4407 SAVE_CPPFLAGS="$CPPFLAGS"
4408 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4410 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4411 [with_libvirt="no (libvirt/libvirt.h not found)"])
4413 CPPFLAGS="$SAVE_CPPFLAGS"
4415 if test "x$with_libvirt" = "xyes"
4417 SAVE_CFLAGS="$CFLAGS"
4418 SAVE_LDFLAGS="$LDFLAGS"
4420 CFLAGS="$CFLAGS $with_libvirt_cflags"
4421 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4423 AC_CHECK_LIB(virt, virDomainBlockStats,
4424 [with_libvirt="yes"],
4425 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4427 CFLAGS="$SAVE_CFLAGS"
4428 LDFLAGS="$SAVE_LDFLAGS"
4430 dnl Add the right compiler flags and libraries.
4431 if test "x$with_libvirt" = "xyes"; then
4432 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4433 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4434 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4435 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4439 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4440 with_libopenipmipthread="yes"
4441 with_libopenipmipthread_cflags=""
4442 with_libopenipmipthread_libs=""
4444 AC_MSG_CHECKING([for pkg-config])
4446 if test "x$PKG_CONFIG" = "x"
4448 with_libopenipmipthread="no"
4451 temp_result="$PKG_CONFIG"
4453 AC_MSG_RESULT([$temp_result])
4455 if test "x$with_libopenipmipthread" = "xyes"
4457 AC_MSG_CHECKING([for libOpenIPMIpthread])
4458 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4461 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4463 AC_MSG_RESULT([$with_libopenipmipthread])
4466 if test "x$with_libopenipmipthread" = "xyes"
4468 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4469 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4472 with_libopenipmipthread_cflags="$temp_result"
4474 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4475 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4477 AC_MSG_RESULT([$temp_result])
4480 if test "x$with_libopenipmipthread" = "xyes"
4482 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4483 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4486 with_libopenipmipthread_ldflags="$temp_result"
4488 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4489 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4491 AC_MSG_RESULT([$temp_result])
4494 if test "x$with_libopenipmipthread" = "xyes"
4496 SAVE_CPPFLAGS="$CPPFLAGS"
4497 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4499 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4500 [with_libopenipmipthread="yes"],
4501 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4502 [#include <OpenIPMI/ipmiif.h>
4503 #include <OpenIPMI/ipmi_err.h>
4504 #include <OpenIPMI/ipmi_posix.h>
4505 #include <OpenIPMI/ipmi_conn.h>
4508 CPPFLAGS="$SAVE_CPPFLAGS"
4511 if test "x$with_libopenipmipthread" = "xyes"
4513 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4514 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4515 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4516 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4520 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4521 [with_libnotify="yes"],
4522 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4525 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4528 # Check for enabled/disabled features
4531 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4532 # ------------------------------------------------------------
4534 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4539 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4544 m4_define([EnDis],[disabled])dnl
4545 m4_define([YesNo],[no])dnl
4551 m4_define([EnDis],[enabled])dnl
4552 m4_define([YesNo],[yes])dnl
4555 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4559 m4_if([$3], [feature], [],
4563 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4569 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4571 enable_$1='[YesNo]'dnl
4573 if test "x$enable_$1" = "xno"
4577 if test "x$enable_$1" = "xyes"
4581 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4586 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4587 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4589 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4591 # AC_PLUGIN(name, default, info)
4592 # ------------------------------------------------------------
4599 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4601 if test "x$enableval" = "xyes"
4604 else if test "x$enableval" = "xforce"
4609 enable_plugin="no (disabled on command line)"
4613 if test "x$enable_all_plugins" = "xauto"
4615 if test "x$2" = "xyes"
4622 enable_plugin="$enable_all_plugins"
4625 if test "x$enable_plugin" = "xyes"
4627 if test "x$2" = "xyes" || test "x$force" = "xyes"
4629 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4630 if test "x$2" != "xyes"
4632 dependency_warning="yes"
4634 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4635 dependency_error="yes"
4636 enable_plugin="no (dependency error)"
4639 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4640 enable_$1="$enable_plugin"
4642 )# AC_PLUGIN(name, default, info)
4644 m4_divert_once([HELP_ENABLE], [
4645 collectd features:])
4646 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4647 AC_COLLECTD([debug], [enable], [feature], [debugging])
4648 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4649 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4651 dependency_warning="no"
4652 dependency_error="no"
4657 plugin_conntrack="no"
4658 plugin_contextswitch="no"
4661 plugin_curl_json="no"
4662 plugin_curl_xml="no"
4668 plugin_interface="no"
4675 plugin_multimeter="no"
4679 plugin_processes="no"
4680 plugin_protocols="no"
4684 plugin_tcpconns="no"
4691 plugin_wireless="no"
4695 if test "x$ac_system" = "xLinux"
4697 plugin_battery="yes"
4698 plugin_conntrack="yes"
4699 plugin_contextswitch="yes"
4701 plugin_cpufreq="yes"
4703 plugin_entropy="yes"
4704 plugin_fscache="yes"
4705 plugin_interface="yes"
4711 plugin_processes="yes"
4712 plugin_protocols="yes"
4715 plugin_tcpconns="yes"
4716 plugin_thermal="yes"
4719 plugin_vserver="yes"
4720 plugin_wireless="yes"
4722 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4728 if test "x$ac_system" = "xOpenBSD"
4730 plugin_tcpconns="yes"
4734 if test "x$with_libiokit" = "xyes"
4736 plugin_battery="yes"
4742 if test "x$ac_system" = "xAIX"
4744 plugin_tcpconns="yes"
4747 if test "x$with_perfstat" = "xyes"
4750 plugin_contextswitch="yes"
4754 plugin_interface="yes"
4759 if test "x$with_procinfo" = "xyes"
4761 plugin_processes="yes"
4765 if test "x$with_kstat" = "xyes"
4769 plugin_zfs_arc="yes"
4772 if test "x$with_devinfo$with_kstat" = "xyesyes"
4776 plugin_interface="yes"
4782 if test "x$with_libstatgrab" = "xyes"
4786 plugin_interface="yes"
4793 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4796 if test "x$have_strptime" = "xyes"
4802 if test "x$with_libopenipmipthread" = "xyes"
4807 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4809 plugin_curl_json="yes"
4812 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4814 plugin_curl_xml="yes"
4817 if test "x$have_processor_info" = "xyes"
4821 if test "x$have_sysctl" = "xyes"
4826 if test "x$ac_system" = "xDarwin"
4831 if test "x$have_sysctlbyname" = "xyes"
4833 plugin_contextswitch="yes"
4836 plugin_tcpconns="yes"
4839 # Df plugin: Check if we know how to determine mount points first.
4840 #if test "x$have_listmntent" = "xyes"; then
4843 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4847 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4851 #if test "x$have_getmntent" = "xseq"
4855 if test "x$c_cv_have_one_getmntent" = "xyes"
4860 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4861 if test "x$plugin_df" = "xyes"
4864 if test "x$have_statfs" = "xyes"
4868 if test "x$have_statvfs" = "xyes"
4874 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
4876 plugin_ethstat="yes"
4879 if test "x$have_getifaddrs" = "xyes"
4881 plugin_interface="yes"
4884 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4886 plugin_libvirt="yes"
4889 if test "x$have_getloadavg" = "xyes"
4894 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4899 # Mac OS X memory interface
4900 if test "x$have_host_statistics" = "xyes"
4905 if test "x$have_termios_h" = "xyes"
4907 plugin_multimeter="yes"
4911 if test "x$have_thread_info" = "xyes"
4913 plugin_processes="yes"
4916 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4918 plugin_processes="yes"
4921 if test "x$with_kvm_getswapinfo" = "xyes"
4926 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4931 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4933 plugin_tcpconns="yes"
4936 if test "x$have_getutent" = "xyes"
4940 if test "x$have_getutxent" = "xyes"
4945 m4_divert_once([HELP_ENABLE], [
4948 AC_ARG_ENABLE([all-plugins],
4949 AC_HELP_STRING([--enable-all-plugins],
4950 [enable all plugins (auto by def)]),
4952 if test "x$enableval" = "xyes"
4954 enable_all_plugins="yes"
4955 else if test "x$enableval" = "xauto"
4957 enable_all_plugins="auto"
4959 enable_all_plugins="no"
4962 [enable_all_plugins="auto"])
4964 m4_divert_once([HELP_ENABLE], [])
4966 AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
4967 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4968 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4969 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4970 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4971 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4972 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4973 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4974 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4975 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4976 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4977 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4978 AC_PLUGIN([csv], [yes], [CSV output plugin])
4979 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4980 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4981 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4982 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4983 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4984 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4985 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4986 AC_PLUGIN([email], [yes], [EMail statistics])
4987 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4988 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
4989 AC_PLUGIN([exec], [yes], [Execution of external programs])
4990 AC_PLUGIN([filecount], [yes], [Count files in directories])
4991 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4992 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4993 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4994 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4995 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4996 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4997 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4998 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4999 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
5000 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
5001 AC_PLUGIN([load], [$plugin_load], [System load])
5002 AC_PLUGIN([logfile], [yes], [File logging plugin])
5003 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
5004 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
5005 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
5006 AC_PLUGIN([match_hashed], [yes], [The hashed match])
5007 AC_PLUGIN([match_regex], [yes], [The regex match])
5008 AC_PLUGIN([match_timediff], [yes], [The timediff match])
5009 AC_PLUGIN([match_value], [yes], [The value match])
5010 AC_PLUGIN([mbmon], [yes], [Query mbmond])
5011 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
5012 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
5013 AC_PLUGIN([memcached], [yes], [memcached statistics])
5014 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
5015 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
5016 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
5017 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
5018 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
5019 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
5020 AC_PLUGIN([network], [yes], [Network communication plugin])
5021 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
5022 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
5023 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
5024 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
5025 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
5026 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
5027 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
5028 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
5029 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
5030 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
5031 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
5032 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
5033 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
5034 # FIXME: Check for libevent, too.
5035 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
5036 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
5037 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
5038 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
5039 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
5040 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
5041 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
5042 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
5043 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
5044 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
5045 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
5046 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
5047 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
5048 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
5049 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
5050 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
5051 AC_PLUGIN([table], [yes], [Parsing of tabular data])
5052 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
5053 AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files])
5054 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
5055 AC_PLUGIN([target_notification], [yes], [The notification target])
5056 AC_PLUGIN([target_replace], [yes], [The replace target])
5057 AC_PLUGIN([target_scale],[yes], [The scale target])
5058 AC_PLUGIN([target_set], [yes], [The set target])
5059 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
5060 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
5061 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
5062 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
5063 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
5064 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
5065 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
5066 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
5067 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
5068 AC_PLUGIN([users], [$plugin_users], [User statistics])
5069 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
5070 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
5071 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
5072 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
5073 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
5074 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
5075 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
5076 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
5077 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
5078 AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin])
5079 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
5080 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
5082 dnl Default configuration file
5083 # Load either syslog or logfile
5084 LOAD_PLUGIN_SYSLOG=""
5085 LOAD_PLUGIN_LOGFILE=""
5087 AC_MSG_CHECKING([which default log plugin to load])
5088 default_log_plugin="none"
5089 if test "x$enable_syslog" = "xyes"
5091 default_log_plugin="syslog"
5093 LOAD_PLUGIN_SYSLOG="##"
5096 if test "x$enable_logfile" = "xyes"
5098 if test "x$default_log_plugin" = "xnone"
5100 default_log_plugin="logfile"
5102 LOAD_PLUGIN_LOGFILE="#"
5105 LOAD_PLUGIN_LOGFILE="##"
5107 AC_MSG_RESULT([$default_log_plugin])
5109 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5110 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5112 DEFAULT_LOG_LEVEL="info"
5113 if test "x$enable_debug" = "xyes"
5115 DEFAULT_LOG_LEVEL="debug"
5117 AC_SUBST(DEFAULT_LOG_LEVEL)
5119 # Load only one of rrdtool, network, csv in the default config.
5120 LOAD_PLUGIN_RRDTOOL=""
5121 LOAD_PLUGIN_NETWORK=""
5124 AC_MSG_CHECKING([which default write plugin to load])
5125 default_write_plugin="none"
5126 if test "x$enable_rrdtool" = "xyes"
5128 default_write_plugin="rrdtool"
5130 LOAD_PLUGIN_RRDTOOL="##"
5133 if test "x$enable_network" = "xyes"
5135 if test "x$default_write_plugin" = "xnone"
5137 default_write_plugin="network"
5139 LOAD_PLUGIN_NETWORK="#"
5142 LOAD_PLUGIN_NETWORK="##"
5145 if test "x$enable_csv" = "xyes"
5147 if test "x$default_write_plugin" = "xnone"
5149 default_write_plugin="csv"
5154 LOAD_PLUGIN_CSV="##"
5156 AC_MSG_RESULT([$default_write_plugin])
5158 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5159 AC_SUBST(LOAD_PLUGIN_NETWORK)
5160 AC_SUBST(LOAD_PLUGIN_CSV)
5163 if test "x$ac_system" = "xLinux" \
5164 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5166 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5169 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5171 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5175 PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
5176 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5178 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5180 PERL_BINDINGS_OPTIONS="$withval"
5181 with_perl_bindings="yes"
5183 with_perl_bindings="$withval"
5187 if test -n "$perl_interpreter"
5189 with_perl_bindings="yes"
5191 with_perl_bindings="no (no perl interpreter found)"
5194 if test "x$with_perl_bindings" = "xyes"
5196 PERL_BINDINGS="perl"
5200 AC_SUBST(PERL_BINDINGS)
5201 AC_SUBST(PERL_BINDINGS_OPTIONS)
5203 dnl libcollectdclient
5204 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5205 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5206 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5208 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5210 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5212 AC_SUBST(LCC_VERSION_MAJOR)
5213 AC_SUBST(LCC_VERSION_MINOR)
5214 AC_SUBST(LCC_VERSION_PATCH)
5215 AC_SUBST(LCC_VERSION_EXTRA)
5216 AC_SUBST(LCC_VERSION_STRING)
5218 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5220 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
5222 if test "x$with_librrd" = "xyes" \
5223 && test "x$librrd_threadsafe" != "xyes"
5225 with_librrd="yes (warning: librrd is not thread-safe)"
5228 if test "x$with_libperl" = "xyes"
5230 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5232 enable_perl="no (needs libperl)"
5235 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5237 enable_perl="no (libperl doesn't support ithreads)"
5240 if test "x$with_perl_bindings" = "xyes" \
5241 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5243 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5250 libcredis . . . . . . $with_libcredis
5251 libcurl . . . . . . . $with_libcurl
5252 libdbi . . . . . . . $with_libdbi
5253 libesmtp . . . . . . $with_libesmtp
5254 libganglia . . . . . $with_libganglia
5255 libgcrypt . . . . . . $with_libgcrypt
5256 libhal . . . . . . . $with_libhal
5257 libiokit . . . . . . $with_libiokit
5258 libiptc . . . . . . . $with_libiptc
5259 libjvm . . . . . . . $with_java
5260 libkstat . . . . . . $with_kstat
5261 libkvm . . . . . . . $with_libkvm
5262 libmemcached . . . . $with_libmemcached
5263 libmodbus . . . . . . $with_libmodbus
5264 libmongoc . . . . . . $with_libmongoc
5265 libmysql . . . . . . $with_libmysql
5266 libnetapp . . . . . . $with_libnetapp
5267 libnetlink . . . . . $with_libnetlink
5268 libnetsnmp . . . . . $with_libnetsnmp
5269 libnotify . . . . . . $with_libnotify
5270 liboconfig . . . . . $with_liboconfig
5271 libopenipmi . . . . . $with_libopenipmipthread
5272 liboping . . . . . . $with_liboping
5273 libowcapi . . . . . . $with_libowcapi
5274 libpcap . . . . . . . $with_libpcap
5275 libperfstat . . . . . $with_perfstat
5276 libperl . . . . . . . $with_libperl
5277 libpq . . . . . . . . $with_libpq
5278 libpthread . . . . . $with_libpthread
5279 librabbitmq . . . . . $with_librabbitmq
5280 librouteros . . . . . $with_librouteros
5281 librrd . . . . . . . $with_librrd
5282 libsensors . . . . . $with_libsensors
5283 libstatgrab . . . . . $with_libstatgrab
5284 libtokyotyrant . . . $with_libtokyotyrant
5285 libupsclient . . . . $with_libupsclient
5286 libvarnish . . . . . $with_libvarnish
5287 libvirt . . . . . . . $with_libvirt
5288 libxml2 . . . . . . . $with_libxml2
5289 libxmms . . . . . . . $with_libxmms
5290 libyajl . . . . . . . $with_libyajl
5291 oracle . . . . . . . $with_oracle
5292 protobuf-c . . . . . $have_protoc_c
5293 python . . . . . . . $with_python
5296 daemon mode . . . . . $enable_daemon
5297 debug . . . . . . . . $enable_debug
5300 perl . . . . . . . . $with_perl_bindings
5303 aggregation . . . . . $enable_aggregation
5304 amqp . . . . . . . $enable_amqp
5305 apache . . . . . . . $enable_apache
5306 apcups . . . . . . . $enable_apcups
5307 apple_sensors . . . . $enable_apple_sensors
5308 ascent . . . . . . . $enable_ascent
5309 battery . . . . . . . $enable_battery
5310 bind . . . . . . . . $enable_bind
5311 conntrack . . . . . . $enable_conntrack
5312 contextswitch . . . . $enable_contextswitch
5313 cpu . . . . . . . . . $enable_cpu
5314 cpufreq . . . . . . . $enable_cpufreq
5315 csv . . . . . . . . . $enable_csv
5316 curl . . . . . . . . $enable_curl
5317 curl_json . . . . . . $enable_curl_json
5318 curl_xml . . . . . . $enable_curl_xml
5319 dbi . . . . . . . . . $enable_dbi
5320 df . . . . . . . . . $enable_df
5321 disk . . . . . . . . $enable_disk
5322 dns . . . . . . . . . $enable_dns
5323 email . . . . . . . . $enable_email
5324 entropy . . . . . . . $enable_entropy
5325 ethstat . . . . . . . $enable_ethstat
5326 exec . . . . . . . . $enable_exec
5327 filecount . . . . . . $enable_filecount
5328 fscache . . . . . . . $enable_fscache
5329 gmond . . . . . . . . $enable_gmond
5330 hddtemp . . . . . . . $enable_hddtemp
5331 interface . . . . . . $enable_interface
5332 ipmi . . . . . . . . $enable_ipmi
5333 iptables . . . . . . $enable_iptables
5334 ipvs . . . . . . . . $enable_ipvs
5335 irq . . . . . . . . . $enable_irq
5336 java . . . . . . . . $enable_java
5337 libvirt . . . . . . . $enable_libvirt
5338 load . . . . . . . . $enable_load
5339 logfile . . . . . . . $enable_logfile
5340 lpar . . . . . . . . $enable_lpar
5341 madwifi . . . . . . . $enable_madwifi
5342 match_empty_counter . $enable_match_empty_counter
5343 match_hashed . . . . $enable_match_hashed
5344 match_regex . . . . . $enable_match_regex
5345 match_timediff . . . $enable_match_timediff
5346 match_value . . . . . $enable_match_value
5347 mbmon . . . . . . . . $enable_mbmon
5348 md . . . . . . . . . $enable_md
5349 memcachec . . . . . . $enable_memcachec
5350 memcached . . . . . . $enable_memcached
5351 memory . . . . . . . $enable_memory
5352 modbus . . . . . . . $enable_modbus
5353 multimeter . . . . . $enable_multimeter
5354 mysql . . . . . . . . $enable_mysql
5355 netapp . . . . . . . $enable_netapp
5356 netlink . . . . . . . $enable_netlink
5357 network . . . . . . . $enable_network
5358 nfs . . . . . . . . . $enable_nfs
5359 nginx . . . . . . . . $enable_nginx
5360 notify_desktop . . . $enable_notify_desktop
5361 notify_email . . . . $enable_notify_email
5362 ntpd . . . . . . . . $enable_ntpd
5363 numa . . . . . . . . $enable_numa
5364 nut . . . . . . . . . $enable_nut
5365 olsrd . . . . . . . . $enable_olsrd
5366 onewire . . . . . . . $enable_onewire
5367 openvpn . . . . . . . $enable_openvpn
5368 oracle . . . . . . . $enable_oracle
5369 perl . . . . . . . . $enable_perl
5370 pf . . . . . . . . . $enable_pf
5371 pinba . . . . . . . . $enable_pinba
5372 ping . . . . . . . . $enable_ping
5373 postgresql . . . . . $enable_postgresql
5374 powerdns . . . . . . $enable_powerdns
5375 processes . . . . . . $enable_processes
5376 protocols . . . . . . $enable_protocols
5377 python . . . . . . . $enable_python
5378 redis . . . . . . . . $enable_redis
5379 routeros . . . . . . $enable_routeros
5380 rrdcached . . . . . . $enable_rrdcached
5381 rrdtool . . . . . . . $enable_rrdtool
5382 sensors . . . . . . . $enable_sensors
5383 serial . . . . . . . $enable_serial
5384 snmp . . . . . . . . $enable_snmp
5385 swap . . . . . . . . $enable_swap
5386 syslog . . . . . . . $enable_syslog
5387 table . . . . . . . . $enable_table
5388 tail . . . . . . . . $enable_tail
5389 tail_csv . . . . . . $enable_tail_csv
5390 tape . . . . . . . . $enable_tape
5391 target_notification . $enable_target_notification
5392 target_replace . . . $enable_target_replace
5393 target_scale . . . . $enable_target_scale
5394 target_set . . . . . $enable_target_set
5395 target_v5upgrade . . $enable_target_v5upgrade
5396 tcpconns . . . . . . $enable_tcpconns
5397 teamspeak2 . . . . . $enable_teamspeak2
5398 ted . . . . . . . . . $enable_ted
5399 thermal . . . . . . . $enable_thermal
5400 threshold . . . . . . $enable_threshold
5401 tokyotyrant . . . . . $enable_tokyotyrant
5402 unixsock . . . . . . $enable_unixsock
5403 uptime . . . . . . . $enable_uptime
5404 users . . . . . . . . $enable_users
5405 uuid . . . . . . . . $enable_uuid
5406 varnish . . . . . . . $enable_varnish
5407 vmem . . . . . . . . $enable_vmem
5408 vserver . . . . . . . $enable_vserver
5409 wireless . . . . . . $enable_wireless
5410 write_graphite . . . $enable_write_graphite
5411 write_http . . . . . $enable_write_http
5412 write_mongodb . . . . $enable_write_mongodb
5413 write_redis . . . . . $enable_write_redis
5414 write_riemann . . . . $enable_write_riemann
5415 xmms . . . . . . . . $enable_xmms
5416 zfs_arc . . . . . . . $enable_zfs_arc
5420 if test "x$dependency_error" = "xyes"; then
5421 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5424 if test "x$dependency_warning" = "xyes"; then
5425 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5428 # vim: set fdm=marker :