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);
1166 [c_cv_have_one_getmntent="yes"],
1167 [c_cv_have_one_getmntent="no"]
1170 AC_CACHE_CHECK([whether getmntent takes two arguments],
1171 [c_cv_have_two_getmntent],
1175 #include "$srcdir/src/utils_mount.h"
1181 fh = fopen ("/etc/mnttab", "r");
1182 status = getmntent (fh, &mt);
1185 [c_cv_have_two_getmntent="yes"],
1186 [c_cv_have_two_getmntent="no"]
1191 # Check for different versions of `getmntent' here..
1193 if test "x$have_getmntent" = "xc"; then
1194 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1195 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1196 [Define if the function getmntent exists and takes one argument.])
1198 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1199 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1200 [Define if the function getmntent exists and takes two arguments.])
1203 if test "x$have_getmntent" = "xsun"; then
1204 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1205 [Define if the function getmntent exists. It's the version from libsun.])
1207 if test "x$have_getmntent" = "xseq"; then
1208 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1209 [Define if the function getmntent exists. It's the version from libseq.])
1211 if test "x$have_getmntent" = "xgen"; then
1212 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1213 [Define if the function getmntent exists. It's the version from libgen.])
1217 AC_CACHE_CHECK([if have htonll defined],
1219 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1221 #include <sys/types.h>
1222 #include <netinet/in.h>
1224 # include <inttypes.h>
1231 [c_cv_have_htonll="yes"],
1232 [c_cv_have_htonll="no"]
1235 if test "x$c_cv_have_htonll" = "xyes"
1237 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1240 # Check for structures
1241 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1242 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1245 #include <sys/types.h>
1246 #include <sys/socket.h>
1249 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1250 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1253 #include <sys/types.h>
1254 #include <sys/socket.h>
1255 #include <linux/if.h>
1256 #include <linux/netdevice.h>
1258 AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states],
1259 [AC_DEFINE(HAVE_STRUCT_LINUX_INET_DIAG_REQ, 1, [Define if struct inet_diag_req exists and is usable.])],
1262 #include <linux/inet_diag.h>
1266 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1269 #include <netinet/in.h>
1273 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1275 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1276 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1277 have_struct_kinfo_proc_freebsd="yes"
1280 have_struct_kinfo_proc_freebsd="no"
1284 #include <sys/param.h>
1285 #include <sys/sysctl.h>
1286 #include <sys/user.h>
1289 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1291 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1292 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1293 have_struct_kinfo_proc_openbsd="yes"
1296 have_struct_kinfo_proc_openbsd="no"
1299 #include <sys/param.h>
1300 #include <sys/sysctl.h>
1304 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1305 [#define _BSD_SOURCE
1307 # include <stdint.h>
1309 #if HAVE_SYS_TYPES_H
1310 # include <sys/types.h>
1312 #if HAVE_NETINET_IN_SYSTM_H
1313 # include <netinet/in_systm.h>
1315 #if HAVE_NETINET_IN_H
1316 # include <netinet/in.h>
1318 #if HAVE_NETINET_IP_H
1319 # include <netinet/ip.h>
1321 #if HAVE_NETINET_UDP_H
1322 # include <netinet/udp.h>
1325 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1326 [#define _BSD_SOURCE
1328 # include <stdint.h>
1330 #if HAVE_SYS_TYPES_H
1331 # include <sys/types.h>
1333 #if HAVE_NETINET_IN_SYSTM_H
1334 # include <netinet/in_systm.h>
1336 #if HAVE_NETINET_IN_H
1337 # include <netinet/in.h>
1339 #if HAVE_NETINET_IP_H
1340 # include <netinet/ip.h>
1342 #if HAVE_NETINET_UDP_H
1343 # include <netinet/udp.h>
1347 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1357 # Checks for libraries begin here
1360 with_libresolv="yes"
1361 AC_CHECK_LIB(resolv, res_search,
1363 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1365 [with_libresolv="no"])
1366 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1368 dnl Check for HAL (hardware abstraction library)
1370 AC_CHECK_LIB(hal,libhal_device_property_exists,
1371 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1373 if test "x$with_libhal" = "xyes"; then
1374 if test "x$PKG_CONFIG" != "x"; then
1375 BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`"
1376 BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`"
1377 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1378 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1382 m4_divert_once([HELP_WITH], [
1383 collectd additional packages:])
1385 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1387 if test "x$ac_system" = "xAIX"
1392 with_perfstat="no (AIX only)"
1393 with_procinfo="no (AIX only)"
1396 if test "x$with_perfstat" = "xyes"
1398 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1399 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1401 if test "x$with_perfstat" = "xyes"
1403 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1404 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1405 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1406 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1408 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1411 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1413 # Processes plugin under AIX.
1414 if test "x$with_procinfo" = "xyes"
1416 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1418 if test "x$with_procinfo" = "xyes"
1420 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1423 if test "x$ac_system" = "xSolaris"
1428 with_kstat="no (Solaris only)"
1429 with_devinfo="no (Solaris only)"
1432 if test "x$with_kstat" = "xyes"
1434 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1436 if test "x$with_kstat" = "xyes"
1438 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1439 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1441 if test "x$with_kstat" = "xyes"
1443 AC_DEFINE(HAVE_LIBKSTAT, 1,
1444 [Define to 1 if you have the 'kstat' library (-lkstat)])
1446 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1447 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1450 if test "x$ac_system" = "xDarwin"
1456 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1459 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1460 if test "x$with_kvm_getprocs" = "xyes"
1462 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1463 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1466 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1468 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1469 if test "x$with_kvm_getswapinfo" = "xyes"
1471 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1472 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1475 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1477 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1478 if test "x$with_kvm_nlist" = "xyes"
1480 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1481 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1482 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1485 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1487 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1488 if test "x$with_kvm_openfiles" = "xyes"
1490 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1491 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1494 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1496 # --with-libcredis {{{
1497 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1499 if test "x$withval" = "xyes"
1501 with_libcredis="yes"
1502 else if test "x$withval" = "xno"
1506 with_libcredis="yes"
1507 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1508 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1511 [with_libcredis="yes"])
1513 SAVE_CPPFLAGS="$CPPFLAGS"
1514 SAVE_LDFLAGS="$LDFLAGS"
1516 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1517 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1519 if test "x$with_libcredis" = "xyes"
1521 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1523 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1525 AC_CHECK_HEADERS(credis.h,
1526 [with_libcredis="yes"],
1527 [with_libcredis="no (credis.h not found)"])
1529 if test "x$with_libcredis" = "xyes"
1531 if test "x$LIBCREDIS_LDFLAGS" != "x"
1533 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1535 AC_CHECK_LIB(credis, credis_info,
1536 [with_libcredis="yes"],
1537 [with_libcredis="no (symbol 'credis_info' not found)"])
1541 CPPFLAGS="$SAVE_CPPFLAGS"
1542 LDFLAGS="$SAVE_LDFLAGS"
1544 if test "x$with_libcredis" = "xyes"
1546 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1547 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1548 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1549 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1551 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1554 # --with-libcurl {{{
1555 with_curl_config="curl-config"
1558 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1560 if test "x$withval" = "xno"
1563 else if test "x$withval" = "xyes"
1567 if test -f "$withval" && test -x "$withval"
1569 with_curl_config="$withval"
1571 else if test -x "$withval/bin/curl-config"
1573 with_curl_config="$withval/bin/curl-config"
1582 if test "x$with_libcurl" = "xyes"
1584 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1585 curl_config_status=$?
1587 if test $curl_config_status -ne 0
1589 with_libcurl="no ($with_curl_config failed)"
1591 SAVE_CPPFLAGS="$CPPFLAGS"
1592 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1594 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1596 CPPFLAGS="$SAVE_CPPFLAGS"
1599 if test "x$with_libcurl" = "xyes"
1601 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1602 curl_config_status=$?
1604 if test $curl_config_status -ne 0
1606 with_libcurl="no ($with_curl_config failed)"
1608 AC_CHECK_LIB(curl, curl_easy_init,
1609 [with_libcurl="yes"],
1610 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1614 if test "x$with_libcurl" = "xyes"
1616 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1617 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1618 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1619 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1621 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1625 with_libdbi_cppflags=""
1626 with_libdbi_ldflags=""
1627 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1629 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1631 with_libdbi_cppflags="-I$withval/include"
1632 with_libdbi_ldflags="-L$withval/lib"
1635 with_libdbi="$withval"
1641 if test "x$with_libdbi" = "xyes"
1643 SAVE_CPPFLAGS="$CPPFLAGS"
1644 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1646 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1648 CPPFLAGS="$SAVE_CPPFLAGS"
1650 if test "x$with_libdbi" = "xyes"
1652 SAVE_CPPFLAGS="$CPPFLAGS"
1653 SAVE_LDFLAGS="$LDFLAGS"
1654 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1655 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1657 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1659 CPPFLAGS="$SAVE_CPPFLAGS"
1660 LDFLAGS="$SAVE_LDFLAGS"
1662 if test "x$with_libdbi" = "xyes"
1664 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1665 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1666 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1667 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1668 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1669 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1671 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1674 # --with-libesmtp {{{
1675 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1677 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1679 LDFLAGS="$LDFLAGS -L$withval/lib"
1680 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1683 with_libesmtp="$withval"
1689 if test "x$with_libesmtp" = "xyes"
1691 AC_CHECK_LIB(esmtp, smtp_create_session,
1693 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1694 ], [with_libesmtp="no (libesmtp not found)"])
1696 if test "x$with_libesmtp" = "xyes"
1698 AC_CHECK_HEADERS(libesmtp.h,
1700 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1701 ], [with_libesmtp="no (libesmtp.h not found)"])
1703 if test "x$with_libesmtp" = "xyes"
1709 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1710 [Wether or not to use the esmtp library])
1711 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1714 # --with-libganglia {{{
1715 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1717 if test -f "$withval" && test -x "$withval"
1719 with_libganglia_config="$withval"
1720 with_libganglia="yes"
1721 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1723 with_libganglia_config="$withval/bin/ganglia-config"
1724 with_libganglia="yes"
1725 else if test -d "$withval"
1727 GANGLIA_CPPFLAGS="-I$withval/include"
1728 GANGLIA_LDFLAGS="-L$withval/lib"
1729 with_libganglia="yes"
1731 with_libganglia_config="ganglia-config"
1732 with_libganglia="$withval"
1736 with_libganglia_config="ganglia-config"
1737 with_libganglia="yes"
1740 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1742 if test "x$GANGLIA_CPPFLAGS" = "x"
1744 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1747 if test "x$GANGLIA_LDFLAGS" = "x"
1749 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1752 if test "x$GANGLIA_LIBS" = "x"
1754 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1758 SAVE_CPPFLAGS="$CPPFLAGS"
1759 SAVE_LDFLAGS="$LDFLAGS"
1760 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1761 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1763 if test "x$with_libganglia" = "xyes"
1765 AC_CHECK_HEADERS(gm_protocol.h,
1767 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1768 [Define to 1 if you have the <gm_protocol.h> header file.])
1769 ], [with_libganglia="no (gm_protocol.h not found)"])
1772 if test "x$with_libganglia" = "xyes"
1774 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1776 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1777 [Define to 1 if you have the ganglia library (-lganglia).])
1778 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1781 CPPFLAGS="$SAVE_CPPFLAGS"
1782 LDFLAGS="$SAVE_LDFLAGS"
1784 AC_SUBST(GANGLIA_CPPFLAGS)
1785 AC_SUBST(GANGLIA_LDFLAGS)
1786 AC_SUBST(GANGLIA_LIBS)
1787 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1790 # --with-libgcrypt {{{
1791 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1792 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1793 GCRYPT_LIBS="$GCRYPT_LIBS"
1794 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1796 if test -f "$withval" && test -x "$withval"
1798 with_libgcrypt_config="$withval"
1799 with_libgcrypt="yes"
1800 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1802 with_libgcrypt_config="$withval/bin/gcrypt-config"
1803 with_libgcrypt="yes"
1804 else if test -d "$withval"
1806 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1807 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1808 with_libgcrypt="yes"
1810 with_libgcrypt_config="gcrypt-config"
1811 with_libgcrypt="$withval"
1815 with_libgcrypt_config="libgcrypt-config"
1816 with_libgcrypt="yes"
1819 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1821 if test "x$GCRYPT_CPPFLAGS" = "x"
1823 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1826 if test "x$GCRYPT_LDFLAGS" = "x"
1828 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1829 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1832 if test "x$GCRYPT_LIBS" = "x"
1834 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1838 SAVE_CPPFLAGS="$CPPFLAGS"
1839 SAVE_LDFLAGS="$LDFLAGS"
1840 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1841 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1843 if test "x$with_libgcrypt" = "xyes"
1845 if test "x$GCRYPT_CPPFLAGS" != "x"
1847 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1849 AC_CHECK_HEADERS(gcrypt.h,
1850 [with_libgcrypt="yes"],
1851 [with_libgcrypt="no (gcrypt.h not found)"])
1854 if test "x$with_libgcrypt" = "xyes"
1856 if test "x$GCRYPT_LDFLAGS" != "x"
1858 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1860 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1861 [with_libgcrypt="yes"],
1862 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1864 if test "$with_libgcrypt" != "no"; then
1865 m4_ifdef([AM_PATH_LIBGCRYPT],[AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")])
1866 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
1867 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
1871 CPPFLAGS="$SAVE_CPPFLAGS"
1872 LDFLAGS="$SAVE_LDFLAGS"
1874 if test "x$with_libgcrypt" = "xyes"
1876 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1879 AC_SUBST(GCRYPT_CPPFLAGS)
1880 AC_SUBST(GCRYPT_LDFLAGS)
1881 AC_SUBST(GCRYPT_LIBS)
1882 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1885 # --with-libiptc {{{
1886 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1888 if test "x$withval" = "xshipped"
1891 else if test "x$withval" = "xyes"
1893 with_libiptc="pkgconfig"
1894 else if test "x$withval" = "xno"
1899 with_libiptc_cflags="-I$withval/include"
1900 with_libiptc_libs="-L$withval/lib"
1904 if test "x$ac_system" = "xLinux"
1906 with_libiptc="pkgconfig"
1908 with_libiptc="no (Linux only)"
1912 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1914 with_libiptc="no (Don't have pkg-config)"
1917 if test "x$with_libiptc" = "xpkgconfig"
1919 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1922 with_libiptc="no (pkg-config doesn't know libiptc)"
1925 if test "x$with_libiptc" = "xpkgconfig"
1927 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1930 with_libiptc="no ($PKG_CONFIG failed)"
1932 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1935 with_libiptc="no ($PKG_CONFIG failed)"
1939 SAVE_CPPFLAGS="$CPPFLAGS"
1940 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1942 # check whether the header file for libiptc is available.
1943 if test "x$with_libiptc" = "xpkgconfig"
1945 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1946 [with_libiptc="no (header file missing)"])
1948 # If the header file is available, check for the required type declaractions.
1949 # They may be missing in old versions of libiptc. In that case, they will be
1950 # declared in the iptables plugin.
1951 if test "x$with_libiptc" = "xpkgconfig"
1953 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1955 # Check for the iptc_init symbol in the library.
1956 # This could be in iptc or ip4tc
1957 if test "x$with_libiptc" = "xpkgconfig"
1960 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1961 [with_libiptc="pkgconfig"],
1962 [with_libiptc="no"],
1963 [$with_libiptc_libs])
1966 if test "x$with_libiptc" = "xpkgconfig"
1971 CPPFLAGS="$SAVE_CPPFLAGS"
1973 if test "x$with_libiptc" = "xown"
1975 with_libiptc_cflags=""
1976 with_libiptc_libs=""
1978 if test "x$with_libiptc" = "xown"
1980 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1982 with_libiptc="no (Linux iptables headers not found)"
1985 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1988 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1989 if test "x$with_libiptc" = "xown"
1991 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1995 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1996 if test "x$with_libiptc" = "xyes"
1998 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1999 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
2000 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
2001 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
2006 with_java_home="$JAVA_HOME"
2007 if test "x$with_java_home" = "x"
2009 with_java_home="/usr/lib/jvm"
2011 with_java_vmtype="client"
2016 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
2018 if test "x$withval" = "xno"
2021 else if test "x$withval" = "xyes"
2025 with_java_home="$withval"
2030 if test "x$with_java" = "xyes"
2032 if test -d "$with_java_home"
2034 AC_MSG_CHECKING([for jni.h])
2035 TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2036 if test "x$TMPVAR" != "x"
2038 AC_MSG_RESULT([found in $TMPVAR])
2039 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2041 AC_MSG_RESULT([not found])
2044 AC_MSG_CHECKING([for jni_md.h])
2045 TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2046 if test "x$TMPVAR" != "x"
2048 AC_MSG_RESULT([found in $TMPVAR])
2049 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2051 AC_MSG_RESULT([not found])
2054 AC_MSG_CHECKING([for libjvm.so])
2055 TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2056 if test "x$TMPVAR" != "x"
2058 AC_MSG_RESULT([found in $TMPVAR])
2059 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
2061 AC_MSG_RESULT([not found])
2064 if test "x$JAVAC" = "x"
2066 AC_MSG_CHECKING([for javac])
2067 TMPVAR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2068 if test "x$TMPVAR" != "x"
2071 AC_MSG_RESULT([$JAVAC])
2073 AC_MSG_RESULT([not found])
2076 if test "x$JAR" = "x"
2078 AC_MSG_CHECKING([for jar])
2079 TMPVAR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2080 if test "x$TMPVAR" != "x"
2083 AC_MSG_RESULT([$JAR])
2085 AC_MSG_RESULT([not found])
2088 else if test "x$with_java_home" != "x"
2090 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2094 if test "x$JAVA_CPPFLAGS" != "x"
2096 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2098 if test "x$JAVA_CFLAGS" != "x"
2100 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2102 if test "x$JAVA_LDFLAGS" != "x"
2104 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2106 if test "x$JAVAC" = "x"
2108 with_javac_path="$PATH"
2109 if test "x$with_java_home" != "x"
2111 with_javac_path="$with_java_home:with_javac_path"
2112 if test -d "$with_java_home/bin"
2114 with_javac_path="$with_java_home/bin:with_javac_path"
2118 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2120 if test "x$JAVAC" = "x"
2122 with_java="no (javac not found)"
2124 if test "x$JAR" = "x"
2126 with_jar_path="$PATH"
2127 if test "x$with_java_home" != "x"
2129 with_jar_path="$with_java_home:$with_jar_path"
2130 if test -d "$with_java_home/bin"
2132 with_jar_path="$with_java_home/bin:$with_jar_path"
2136 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2138 if test "x$JAR" = "x"
2140 with_java="no (jar not found)"
2143 SAVE_CPPFLAGS="$CPPFLAGS"
2144 SAVE_CFLAGS="$CFLAGS"
2145 SAVE_LDFLAGS="$LDFLAGS"
2146 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2147 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2148 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2150 if test "x$with_java" = "xyes"
2152 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2154 if test "x$with_java" = "xyes"
2156 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2158 [with_java="no (libjvm not found)"],
2161 if test "x$with_java" = "xyes"
2163 JAVA_LIBS="$JAVA_LIBS -ljvm"
2164 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2167 CPPFLAGS="$SAVE_CPPFLAGS"
2168 CFLAGS="$SAVE_CFLAGS"
2169 LDFLAGS="$SAVE_LDFLAGS"
2171 AC_SUBST(JAVA_CPPFLAGS)
2172 AC_SUBST(JAVA_CFLAGS)
2173 AC_SUBST(JAVA_LDFLAGS)
2175 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2178 # --with-libmemcached {{{
2179 with_libmemcached_cppflags=""
2180 with_libmemcached_ldflags=""
2181 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2183 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2185 with_libmemcached_cppflags="-I$withval/include"
2186 with_libmemcached_ldflags="-L$withval/lib"
2187 with_libmemcached="yes"
2189 with_libmemcached="$withval"
2193 with_libmemcached="yes"
2195 if test "x$with_libmemcached" = "xyes"
2197 SAVE_CPPFLAGS="$CPPFLAGS"
2198 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2200 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2202 CPPFLAGS="$SAVE_CPPFLAGS"
2204 if test "x$with_libmemcached" = "xyes"
2206 SAVE_CPPFLAGS="$CPPFLAGS"
2207 SAVE_LDFLAGS="$LDFLAGS"
2208 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2209 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2211 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2213 CPPFLAGS="$SAVE_CPPFLAGS"
2214 LDFLAGS="$SAVE_LDFLAGS"
2216 if test "x$with_libmemcached" = "xyes"
2218 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2219 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2220 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2221 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2222 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2223 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2224 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2226 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2229 # --with-libmodbus {{{
2230 with_libmodbus_config=""
2231 with_libmodbus_cflags=""
2232 with_libmodbus_libs=""
2233 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2235 if test "x$withval" = "xno"
2238 else if test "x$withval" = "xyes"
2240 with_libmodbus="use_pkgconfig"
2241 else if test -d "$with_libmodbus/lib"
2243 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2244 with_libmodbus_cflags="-I$withval/include"
2245 with_libmodbus_libs="-L$withval/lib -lmodbus"
2246 with_libmodbus="yes"
2249 [with_libmodbus="use_pkgconfig"])
2251 # configure using pkg-config
2252 if test "x$with_libmodbus" = "xuse_pkgconfig"
2254 if test "x$PKG_CONFIG" = "x"
2256 with_libmodbus="no (Don't have pkg-config)"
2259 if test "x$with_libmodbus" = "xuse_pkgconfig"
2261 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2262 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2265 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2268 if test "x$with_libmodbus" = "xuse_pkgconfig"
2270 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2273 with_libmodbus="no ($PKG_CONFIG failed)"
2275 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2278 with_libmodbus="no ($PKG_CONFIG failed)"
2281 if test "x$with_libmodbus" = "xuse_pkgconfig"
2283 with_libmodbus="yes"
2286 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2287 # the actual checks.
2288 if test "x$with_libmodbus" = "xyes"
2290 SAVE_CPPFLAGS="$CPPFLAGS"
2291 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2293 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2295 CPPFLAGS="$SAVE_CPPFLAGS"
2297 if test "x$with_libmodbus" = "xyes"
2299 SAVE_CPPFLAGS="$CPPFLAGS"
2300 SAVE_LDFLAGS="$LDFLAGS"
2302 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2303 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2305 AC_CHECK_LIB(modbus, modbus_connect,
2306 [with_libmodbus="yes"],
2307 [with_libmodbus="no (symbol modbus_connect not found)"])
2309 CPPFLAGS="$SAVE_CPPFLAGS"
2310 LDFLAGS="$SAVE_LDFLAGS"
2312 if test "x$with_libmodbus" = "xyes"
2314 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2315 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2316 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2317 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2321 # --with-libmongoc {{{
2322 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2324 if test "x$withval" = "xyes"
2326 with_libmongoc="yes"
2327 else if test "x$withval" = "xno"
2331 with_libmongoc="yes"
2332 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2333 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2336 [with_libmongoc="yes"])
2338 SAVE_CPPFLAGS="$CPPFLAGS"
2339 SAVE_LDFLAGS="$LDFLAGS"
2341 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2342 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2344 if test "x$with_libmongoc" = "xyes"
2346 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2348 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2350 AC_CHECK_HEADERS(mongo.h,
2351 [with_libmongoc="yes"],
2352 [with_libmongoc="no ('mongo.h' not found)"],
2354 # define MONGO_HAVE_STDINT 1
2356 # define MONGO_USE_LONG_LONG_INT 1
2360 if test "x$with_libmongoc" = "xyes"
2362 if test "x$LIBMONGOC_LDFLAGS" != "x"
2364 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2366 AC_CHECK_LIB(mongoc, mongo_run_command,
2367 [with_libmongoc="yes"],
2368 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2371 CPPFLAGS="$SAVE_CPPFLAGS"
2372 LDFLAGS="$SAVE_LDFLAGS"
2374 if test "x$with_libmongoc" = "xyes"
2376 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2377 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2378 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2379 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2381 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2384 # --with-libmysql {{{
2385 with_mysql_config="mysql_config"
2386 with_mysql_cflags=""
2388 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2390 if test "x$withval" = "xno"
2393 else if test "x$withval" = "xyes"
2397 if test -f "$withval" && test -x "$withval";
2399 with_mysql_config="$withval"
2400 else if test -x "$withval/bin/mysql_config"
2402 with_mysql_config="$withval/bin/mysql_config"
2410 if test "x$with_libmysql" = "xyes"
2412 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2413 mysql_config_status=$?
2415 if test $mysql_config_status -ne 0
2417 with_libmysql="no ($with_mysql_config failed)"
2419 SAVE_CPPFLAGS="$CPPFLAGS"
2420 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2423 have_mysql_mysql_h="no"
2424 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2426 if test "x$have_mysql_h" = "xno"
2428 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2431 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2433 with_libmysql="no (mysql.h not found)"
2436 CPPFLAGS="$SAVE_CPPFLAGS"
2439 if test "x$with_libmysql" = "xyes"
2441 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2442 mysql_config_status=$?
2444 if test $mysql_config_status -ne 0
2446 with_libmysql="no ($with_mysql_config failed)"
2448 AC_CHECK_LIB(mysqlclient, mysql_init,
2449 [with_libmysql="yes"],
2450 [with_libmysql="no (symbol 'mysql_init' not found)"],
2453 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2454 [with_libmysql="yes"],
2455 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2459 if test "x$with_libmysql" = "xyes"
2461 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2462 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2463 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2464 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2466 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2469 # --with-libnetlink {{{
2470 with_libnetlink_cflags=""
2471 with_libnetlink_libs="-lnetlink"
2472 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2474 echo "libnetlink: withval = $withval"
2475 if test "x$withval" = "xyes"
2477 with_libnetlink="yes"
2478 else if test "x$withval" = "xno"
2480 with_libnetlink="no"
2482 if test -d "$withval/include"
2484 with_libnetlink_cflags="-I$withval/include"
2485 with_libnetlink_libs="-L$withval/lib -lnetlink"
2486 with_libnetlink="yes"
2488 AC_MSG_ERROR("no such directory: $withval/include")
2493 if test "x$ac_system" = "xLinux"
2495 with_libnetlink="yes"
2497 with_libnetlink="no (Linux only library)"
2500 if test "x$with_libnetlink" = "xyes"
2502 SAVE_CFLAGS="$CFLAGS"
2503 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2505 with_libnetlink="no (libnetlink.h not found)"
2507 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2509 with_libnetlink="yes"
2513 #include <sys/types.h>
2514 #include <asm/types.h>
2515 #include <sys/socket.h>
2516 #include <linux/netlink.h>
2517 #include <linux/rtnetlink.h>])
2518 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2520 #include <sys/types.h>
2521 #include <asm/types.h>
2522 #include <sys/socket.h>])
2524 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2527 #include <sys/types.h>
2528 #include <asm/types.h>
2529 #include <sys/socket.h>
2530 #include <linux/netlink.h>
2531 #include <linux/rtnetlink.h>
2534 int retval = TCA_STATS2;
2538 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2540 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2543 #include <sys/types.h>
2544 #include <asm/types.h>
2545 #include <sys/socket.h>
2546 #include <linux/netlink.h>
2547 #include <linux/rtnetlink.h>
2550 int retval = TCA_STATS;
2554 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2556 CFLAGS="$SAVE_CFLAGS"
2558 if test "x$with_libnetlink" = "xyes"
2560 AC_CHECK_LIB(netlink, rtnl_open,
2561 [with_libnetlink="yes"],
2562 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2563 [$with_libnetlink_libs])
2565 if test "x$with_libnetlink" = "xyes"
2567 SAVE_CFLAGS="$CFLAGS"
2568 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2571 [if function 'rtnl_dump_filter' expects five arguments],
2572 [c_cv_rtnl_dump_filter_five_args],
2573 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2576 #include <sys/types.h>
2577 #include <asm/types.h>
2578 #include <sys/socket.h>
2579 #if HAVE_LIBNETLINK_H
2580 # include <libnetlink.h>
2581 #elif HAVE_IPROUTE_LIBNETLINK_H
2582 # include <iproute/libnetlink.h>
2583 #elif HAVE_LINUX_LIBNETLINK_H
2584 # include <linux/libnetlink.h>
2588 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2593 [c_cv_rtnl_dump_filter_five_args="yes"],
2594 [c_cv_rtnl_dump_filter_five_args="no"]
2599 [if function 'rtnl_dump_filter' expects three arguments],
2600 [c_cv_rtnl_dump_filter_three_args],
2601 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2604 #include <sys/types.h>
2605 #include <asm/types.h>
2606 #include <sys/socket.h>
2607 #if HAVE_LIBNETLINK_H
2608 # include <libnetlink.h>
2609 #elif HAVE_IPROUTE_LIBNETLINK_H
2610 # include <iproute/libnetlink.h>
2611 #elif HAVE_LINUX_LIBNETLINK_H
2612 # include <linux/libnetlink.h>
2616 if (rtnl_dump_filter(NULL, NULL, NULL))
2621 [c_cv_rtnl_dump_filter_three_args="yes"],
2622 [c_cv_rtnl_dump_filter_three_args="no"]
2626 CFLAGS="$SAVE_CFLAGS"
2628 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2630 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2631 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2633 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2635 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2636 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2639 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2640 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2641 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2642 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2644 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2647 # --with-libnetapp {{{
2648 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2649 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2650 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2651 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2652 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2653 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2654 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2656 if test -d "$withval"
2658 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2659 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2660 with_libnetapp="yes"
2662 with_libnetapp="$withval"
2666 with_libnetapp="yes"
2669 SAVE_CPPFLAGS="$CPPFLAGS"
2670 SAVE_LDFLAGS="$LDFLAGS"
2671 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2672 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2674 if test "x$with_libnetapp" = "xyes"
2676 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2678 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2680 AC_CHECK_HEADERS(netapp_api.h,
2681 [with_libnetapp="yes"],
2682 [with_libnetapp="no (netapp_api.h not found)"])
2685 if test "x$with_libnetapp" = "xyes"
2687 if test "x$LIBNETAPP_LDFLAGS" != "x"
2689 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2692 if test "x$LIBNETAPP_LIBS" = "x"
2694 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2696 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2698 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2699 [with_libnetapp="yes"],
2700 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2702 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2705 CPPFLAGS="$SAVE_CPPFLAGS"
2706 LDFLAGS="$SAVE_LDFLAGS"
2708 if test "x$with_libnetapp" = "xyes"
2710 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2713 AC_SUBST(LIBNETAPP_CPPFLAGS)
2714 AC_SUBST(LIBNETAPP_LDFLAGS)
2715 AC_SUBST(LIBNETAPP_LIBS)
2716 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2719 # --with-libnetsnmp {{{
2720 with_snmp_config="net-snmp-config"
2723 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2725 if test "x$withval" = "xno"
2727 with_libnetsnmp="no"
2728 else if test "x$withval" = "xyes"
2730 with_libnetsnmp="yes"
2732 if test -x "$withval"
2734 with_snmp_config="$withval"
2735 with_libnetsnmp="yes"
2737 with_snmp_config="$withval/bin/net-snmp-config"
2738 with_libnetsnmp="yes"
2742 [with_libnetsnmp="yes"])
2743 if test "x$with_libnetsnmp" = "xyes"
2745 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2746 snmp_config_status=$?
2748 if test $snmp_config_status -ne 0
2750 with_libnetsnmp="no ($with_snmp_config failed)"
2752 SAVE_CPPFLAGS="$CPPFLAGS"
2753 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2755 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2757 CPPFLAGS="$SAVE_CPPFLAGS"
2760 if test "x$with_libnetsnmp" = "xyes"
2762 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2763 snmp_config_status=$?
2765 if test $snmp_config_status -ne 0
2767 with_libnetsnmp="no ($with_snmp_config failed)"
2769 AC_CHECK_LIB(netsnmp, init_snmp,
2770 [with_libnetsnmp="yes"],
2771 [with_libnetsnmp="no (libnetsnmp not found)"],
2775 if test "x$with_libnetsnmp" = "xyes"
2777 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2778 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2779 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2780 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2782 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2785 # --with-liboconfig {{{
2786 with_own_liboconfig="no"
2787 liboconfig_LDFLAGS="$LDFLAGS"
2788 liboconfig_CPPFLAGS="$CPPFLAGS"
2789 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2791 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2793 if test -d "$withval/lib"
2795 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2797 if test -d "$withval/include"
2799 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2802 if test "x$withval" = "xno"
2804 AC_MSG_ERROR("liboconfig is required")
2808 with_liboconfig="yes"
2811 save_LDFLAGS="$LDFLAGS"
2812 save_CPPFLAGS="$CPPFLAGS"
2813 LDFLAGS="$liboconfig_LDFLAGS"
2814 CPPFLAGS="$liboconfig_CPPFLAGS"
2815 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2817 with_liboconfig="yes"
2818 with_own_liboconfig="no"
2821 with_liboconfig="yes"
2822 with_own_liboconfig="yes"
2823 LDFLAGS="$save_LDFLAGS"
2824 CPPFLAGS="$save_CPPFLAGS"
2827 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2828 if test "x$with_own_liboconfig" = "xyes"
2830 with_liboconfig="yes (shipped version)"
2834 # --with-liboping {{{
2835 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2837 if test "x$withval" = "xyes"
2840 else if test "x$withval" = "xno"
2845 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2846 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2849 [with_liboping="yes"])
2851 SAVE_CPPFLAGS="$CPPFLAGS"
2852 SAVE_LDFLAGS="$LDFLAGS"
2854 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2855 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2857 if test "x$with_liboping" = "xyes"
2859 if test "x$LIBOPING_CPPFLAGS" != "x"
2861 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2863 AC_CHECK_HEADERS(oping.h,
2864 [with_liboping="yes"],
2865 [with_liboping="no (oping.h not found)"])
2867 if test "x$with_liboping" = "xyes"
2869 if test "x$LIBOPING_LDFLAGS" != "x"
2871 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2873 AC_CHECK_LIB(oping, ping_construct,
2874 [with_liboping="yes"],
2875 [with_liboping="no (symbol 'ping_construct' not found)"])
2878 CPPFLAGS="$SAVE_CPPFLAGS"
2879 LDFLAGS="$SAVE_LDFLAGS"
2881 if test "x$with_liboping" = "xyes"
2883 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2884 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2885 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2886 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2888 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2892 with_oracle_cppflags=""
2894 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2896 if test "x$withval" = "xyes"
2898 if test "x$ORACLE_HOME" = "x"
2900 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2903 else if test "x$withval" = "xno"
2908 ORACLE_HOME="$withval"
2912 if test "x$ORACLE_HOME" = "x"
2914 with_oracle="no (ORACLE_HOME is not set)"
2919 if test "x$ORACLE_HOME" != "x"
2921 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2923 if test -e "$ORACLE_HOME/lib/ldflags"
2925 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2927 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2928 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2930 if test "x$with_oracle" = "xyes"
2932 SAVE_CPPFLAGS="$CPPFLAGS"
2933 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2935 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2937 CPPFLAGS="$SAVE_CPPFLAGS"
2939 if test "x$with_oracle" = "xyes"
2941 SAVE_CPPFLAGS="$CPPFLAGS"
2943 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2944 LIBS="$LIBS $with_oracle_libs"
2946 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2948 CPPFLAGS="$SAVE_CPPFLAGS"
2951 if test "x$with_oracle" = "xyes"
2953 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2954 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2955 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2956 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2960 # --with-libowcapi {{{
2961 with_libowcapi_cppflags=""
2962 with_libowcapi_libs="-lowcapi"
2963 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2965 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2967 with_libowcapi_cppflags="-I$withval/include"
2968 with_libowcapi_libs="-L$withval/lib -lowcapi"
2969 with_libowcapi="yes"
2971 with_libowcapi="$withval"
2975 with_libowcapi="yes"
2977 if test "x$with_libowcapi" = "xyes"
2979 SAVE_CPPFLAGS="$CPPFLAGS"
2980 CPPFLAGS="$with_libowcapi_cppflags"
2982 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2984 CPPFLAGS="$SAVE_CPPFLAGS"
2986 if test "x$with_libowcapi" = "xyes"
2988 SAVE_LDFLAGS="$LDFLAGS"
2989 SAVE_CPPFLAGS="$CPPFLAGS"
2990 LDFLAGS="$with_libowcapi_libs"
2991 CPPFLAGS="$with_libowcapi_cppflags"
2993 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2995 LDFLAGS="$SAVE_LDFLAGS"
2996 CPPFLAGS="$SAVE_CPPFLAGS"
2998 if test "x$with_libowcapi" = "xyes"
3000 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
3001 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
3002 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
3003 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
3007 # --with-libpcap {{{
3008 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
3010 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3012 LDFLAGS="$LDFLAGS -L$withval/lib"
3013 CPPFLAGS="$CPPFLAGS -I$withval/include"
3016 with_libpcap="$withval"
3022 if test "x$with_libpcap" = "xyes"
3024 AC_CHECK_LIB(pcap, pcap_open_live,
3026 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
3027 ], [with_libpcap="no (libpcap not found)"])
3029 if test "x$with_libpcap" = "xyes"
3031 AC_CHECK_HEADERS(pcap.h,,
3032 [with_libpcap="no (pcap.h not found)"])
3034 if test "x$with_libpcap" = "xyes"
3036 AC_CHECK_HEADERS(pcap-bpf.h,,
3037 [with_libpcap="no (pcap-bpf.h not found)"])
3039 if test "x$with_libpcap" = "xyes"
3041 AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP],
3042 [c_cv_libpcap_have_pcap_error_iface_not_up],
3043 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
3048 int val = PCAP_ERROR_IFACE_NOT_UP;
3051 [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
3052 [c_cv_libpcap_have_pcap_error_iface_not_up="no"]))
3054 if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes"
3056 with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)"
3058 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3061 # --with-libperl {{{
3062 perl_interpreter="perl"
3063 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3065 if test -f "$withval" && test -x "$withval"
3067 perl_interpreter="$withval"
3069 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3071 LDFLAGS="$LDFLAGS -L$withval/lib"
3072 CPPFLAGS="$CPPFLAGS -I$withval/include"
3073 perl_interpreter="$withval/bin/perl"
3076 with_libperl="$withval"
3083 AC_MSG_CHECKING([for perl])
3084 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3085 if test -x "$perl_interpreter"
3087 AC_MSG_RESULT([yes ($perl_interpreter)])
3093 AC_SUBST(PERL, "$perl_interpreter")
3095 if test "x$with_libperl" = "xyes" \
3096 && test -n "$perl_interpreter"
3098 SAVE_CFLAGS="$CFLAGS"
3100 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3101 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3102 PERL_LIBS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3103 CFLAGS="$CFLAGS $PERL_CFLAGS"
3104 LIBS="$LIBS $PERL_LIBS"
3106 AC_CACHE_CHECK([for libperl],
3107 [c_cv_have_libperl],
3108 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3110 #define PERL_NO_GET_CONTEXT
3117 load_module (PERL_LOADMOD_NOIMPORT,
3118 newSVpv ("Collectd::Plugin::FooBar", 24),
3122 [c_cv_have_libperl="yes"],
3123 [c_cv_have_libperl="no"]
3127 if test "x$c_cv_have_libperl" = "xyes"
3129 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3130 AC_SUBST(PERL_CFLAGS)
3136 CFLAGS="$SAVE_CFLAGS"
3138 else if test -z "$perl_interpreter"; then
3139 with_libperl="no (no perl interpreter found)"
3140 c_cv_have_libperl="no"
3142 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3144 if test "x$with_libperl" = "xyes"
3146 SAVE_CFLAGS="$CFLAGS"
3148 CFLAGS="$CFLAGS $PERL_CFLAGS"
3149 LIBS="$LIBS $PERL_LIBS"
3151 AC_CACHE_CHECK([if perl supports ithreads],
3152 [c_cv_have_perl_ithreads],
3153 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3159 #if !defined(USE_ITHREADS)
3160 # error "Perl does not support ithreads!"
3161 #endif /* !defined(USE_ITHREADS) */
3165 [c_cv_have_perl_ithreads="yes"],
3166 [c_cv_have_perl_ithreads="no"]
3170 if test "x$c_cv_have_perl_ithreads" = "xyes"
3172 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3175 CFLAGS="$SAVE_CFLAGS"
3179 if test "x$with_libperl" = "xyes"
3181 SAVE_CFLAGS="$CFLAGS"
3183 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3184 # (see issues #41 and #42)
3185 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3186 LIBS="$LIBS $PERL_LIBS"
3188 AC_CACHE_CHECK([for broken Perl_load_module()],
3189 [c_cv_have_broken_perl_load_module],
3190 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3192 #define PERL_NO_GET_CONTEXT
3199 load_module (PERL_LOADMOD_NOIMPORT,
3200 newSVpv ("Collectd::Plugin::FooBar", 24),
3204 [c_cv_have_broken_perl_load_module="no"],
3205 [c_cv_have_broken_perl_load_module="yes"]
3209 CFLAGS="$SAVE_CFLAGS"
3212 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3213 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3215 if test "x$with_libperl" = "xyes"
3217 SAVE_CFLAGS="$CFLAGS"
3219 CFLAGS="$CFLAGS $PERL_CFLAGS"
3220 LIBS="$LIBS $PERL_LIBS"
3223 [struct mgvtbl.svt_local],
3224 [have_struct_mgvtbl_svt_local="yes"],
3225 [have_struct_mgvtbl_svt_local="no"],
3232 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3234 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3235 [Define if Perl's struct mgvtbl has member svt_local.])
3238 CFLAGS="$SAVE_CFLAGS"
3244 with_pg_config="pg_config"
3245 with_libpq_includedir=""
3246 with_libpq_libdir=""
3247 with_libpq_cppflags=""
3248 with_libpq_ldflags=""
3249 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3252 if test "x$withval" = "xno"
3255 else if test "x$withval" = "xyes"
3259 if test -f "$withval" && test -x "$withval";
3261 with_pg_config="$withval"
3262 else if test -x "$withval/bin/pg_config"
3264 with_pg_config="$withval/bin/pg_config"
3272 if test "x$with_libpq" = "xyes"
3274 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3277 if test $pg_config_status -eq 0
3279 if test -n "$with_libpq_includedir"; then
3280 for dir in $with_libpq_includedir; do
3281 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3285 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3288 SAVE_CPPFLAGS="$CPPFLAGS"
3289 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3291 AC_CHECK_HEADERS(libpq-fe.h, [],
3292 [with_libpq="no (libpq-fe.h not found)"], [])
3294 CPPFLAGS="$SAVE_CPPFLAGS"
3296 if test "x$with_libpq" = "xyes"
3298 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3301 if test $pg_config_status -eq 0
3303 if test -n "$with_libpq_libdir"; then
3304 for dir in $with_libpq_libdir; do
3305 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3309 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3312 SAVE_LDFLAGS="$LDFLAGS"
3313 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3315 AC_CHECK_LIB(pq, PQconnectdb,
3317 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3319 AC_CHECK_LIB(pq, PQserverVersion,
3321 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3323 LDFLAGS="$SAVE_LDFLAGS"
3325 if test "x$with_libpq" = "xyes"
3327 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3328 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3329 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3330 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3332 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3335 # --with-libpthread {{{
3336 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3337 [ if test "x$withval" != "xno" \
3338 && test "x$withval" != "xyes"
3340 LDFLAGS="$LDFLAGS -L$withval/lib"
3341 CPPFLAGS="$CPPFLAGS -I$withval/include"
3342 with_libpthread="yes"
3344 if test "x$withval" = "xno"
3346 with_libpthread="no (disabled)"
3349 ], [with_libpthread="yes"])
3350 if test "x$with_libpthread" = "xyes"
3352 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3355 if test "x$with_libpthread" = "xyes"
3357 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3359 if test "x$with_libpthread" = "xyes"
3365 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3366 [Wether or not to use pthread (POSIX threads) library])
3367 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3372 with_python_path="$PATH"
3373 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3375 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3377 with_python="$withval"
3378 else if test -x "$withval"
3380 with_python_prog="$withval"
3381 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3383 else if test -d "$withval"
3385 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3388 AC_MSG_WARN([Argument not recognized: $withval])
3390 ], [with_python="yes"])
3393 SAVE_CPPFLAGS="$CPPFLAGS"
3394 SAVE_LDFLAGS="$LDFLAGS"
3397 PATH="$with_python_path"
3399 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3401 AC_MSG_CHECKING([for python])
3402 with_python_prog="`which python 2>/dev/null`"
3403 if test "x$with_python_prog" = "x"
3405 AC_MSG_RESULT([not found])
3406 with_python="no (interpreter not found)"
3408 AC_MSG_RESULT([$with_python_prog])
3412 if test "x$with_python" = "xyes"
3414 AC_MSG_CHECKING([for Python CPPFLAGS])
3415 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3416 python_config_status=$?
3418 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3420 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3423 AC_MSG_RESULT([$python_include_path])
3427 if test "x$with_python" = "xyes"
3429 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3430 AC_CHECK_HEADERS(Python.h,
3431 [with_python="yes"],
3432 [with_python="no ('Python.h' not found)"])
3435 if test "x$with_python" = "xyes"
3437 AC_MSG_CHECKING([for Python LDFLAGS])
3438 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`
3439 python_config_status=$?
3441 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3443 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3446 AC_MSG_RESULT([$python_library_path])
3450 if test "x$with_python" = "xyes"
3452 AC_MSG_CHECKING([for Python LIBS])
3453 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`
3454 python_config_status=$?
3456 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3458 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3461 AC_MSG_RESULT([$python_library_flags])
3465 if test "x$with_python" = "xyes"
3467 LDFLAGS="-L$python_library_path $LDFLAGS"
3468 LIBS="$python_library_flags $LIBS"
3470 AC_CHECK_FUNC(PyObject_CallFunction,
3471 [with_python="yes"],
3472 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3476 CPPFLAGS="$SAVE_CPPFLAGS"
3477 LDFLAGS="$SAVE_LDFLAGS"
3480 if test "x$with_python" = "xyes"
3482 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3483 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3484 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3485 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3486 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3487 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3491 # --with-librabbitmq {{{
3492 with_librabbitmq_cppflags=""
3493 with_librabbitmq_ldflags=""
3494 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3496 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3498 with_librabbitmq_cppflags="-I$withval/include"
3499 with_librabbitmq_ldflags="-L$withval/lib"
3500 with_librabbitmq="yes"
3502 with_librabbitmq="$withval"
3506 with_librabbitmq="yes"
3508 SAVE_CPPFLAGS="$CPPFLAGS"
3509 SAVE_LDFLAGS="$LDFLAGS"
3510 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3511 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3512 if test "x$with_librabbitmq" = "xyes"
3514 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3516 if test "x$with_librabbitmq" = "xyes"
3518 # librabbitmq up to version 0.9.1 provides "library_errno", later
3519 # versions use "library_error". The library does not provide a version
3520 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3521 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3524 # include <stdlib.h>
3530 # include <stdint.h>
3533 # include <inttypes.h>
3538 if test "x$with_librabbitmq" = "xyes"
3540 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3542 if test "x$with_librabbitmq" = "xyes"
3544 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3545 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3546 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3547 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3548 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3549 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3550 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3552 CPPFLAGS="$SAVE_CPPFLAGS"
3553 LDFLAGS="$SAVE_LDFLAGS"
3554 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3556 with_amqp_tcp_socket="no"
3557 if test "x$with_librabbitmq" = "xyes"
3559 SAVE_CPPFLAGS="$CPPFLAGS"
3560 SAVE_LDFLAGS="$LDFLAGS"
3562 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3563 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3566 AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h)
3567 AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"])
3568 if test "x$with_amqp_tcp_socket" = "xyes"
3570 AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1,
3571 [Define if librabbitmq provides the new TCP socket interface.])
3574 AC_CHECK_DECLS(amqp_socket_close,
3575 [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"],
3578 #ifdef HAVE_AMQP_TCP_SOCKET_H
3579 # include <amqp_tcp_socket.h>
3581 #ifdef HAVE_AMQP_SOCKET_H
3582 # include <amqp_socket.h>
3586 CPPFLAGS="$SAVE_CPPFLAGS"
3587 LDFLAGS="$SAVE_LDFLAGS"
3592 # --with-librouteros {{{
3593 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3595 if test "x$withval" = "xyes"
3597 with_librouteros="yes"
3598 else if test "x$withval" = "xno"
3600 with_librouteros="no"
3602 with_librouteros="yes"
3603 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3604 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3607 [with_librouteros="yes"])
3609 SAVE_CPPFLAGS="$CPPFLAGS"
3610 SAVE_LDFLAGS="$LDFLAGS"
3612 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3613 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3615 if test "x$with_librouteros" = "xyes"
3617 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3619 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3621 AC_CHECK_HEADERS(routeros_api.h,
3622 [with_librouteros="yes"],
3623 [with_librouteros="no (routeros_api.h not found)"])
3625 if test "x$with_librouteros" = "xyes"
3627 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3629 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3631 AC_CHECK_LIB(routeros, ros_interface,
3632 [with_librouteros="yes"],
3633 [with_librouteros="no (symbol 'ros_interface' not found)"])
3636 CPPFLAGS="$SAVE_CPPFLAGS"
3637 LDFLAGS="$SAVE_LDFLAGS"
3639 if test "x$with_librouteros" = "xyes"
3641 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3642 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3643 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3644 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3646 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3650 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3653 librrd_threadsafe="yes"
3654 librrd_rrdc_update="no"
3655 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3656 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3658 librrd_cflags="-I$withval/include"
3659 librrd_ldflags="-L$withval/lib"
3662 with_librrd="$withval"
3664 ], [with_librrd="yes"])
3665 if test "x$with_librrd" = "xyes"
3667 SAVE_CPPFLAGS="$CPPFLAGS"
3668 SAVE_LDFLAGS="$LDFLAGS"
3670 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3671 LDFLAGS="$LDFLAGS $librrd_ldflags"
3673 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3675 CPPFLAGS="$SAVE_CPPFLAGS"
3676 LDFLAGS="$SAVE_LDFLAGS"
3678 if test "x$with_librrd" = "xyes"
3680 SAVE_CPPFLAGS="$CPPFLAGS"
3681 SAVE_LDFLAGS="$LDFLAGS"
3683 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3684 LDFLAGS="$LDFLAGS $librrd_ldflags"
3686 AC_CHECK_LIB(rrd_th, rrd_update_r,
3688 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3690 [librrd_threadsafe="no"
3691 AC_CHECK_LIB(rrd, rrd_update,
3693 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3695 [with_librrd="no (symbol 'rrd_update' not found)"],
3700 if test "x$librrd_threadsafe" = "xyes"
3702 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3704 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3707 CPPFLAGS="$SAVE_CPPFLAGS"
3708 LDFLAGS="$SAVE_LDFLAGS"
3710 if test "x$with_librrd" = "xyes"
3712 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3713 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3714 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3715 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3717 if test "x$librrd_threadsafe" = "xyes"
3719 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3723 # --with-libsensors {{{
3724 with_sensors_cflags=""
3725 with_sensors_ldflags=""
3726 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3728 if test "x$withval" = "xno"
3730 with_libsensors="no"
3732 with_libsensors="yes"
3733 if test "x$withval" != "xyes"
3735 with_sensors_cflags="-I$withval/include"
3736 with_sensors_ldflags="-L$withval/lib"
3737 with_libsensors="yes"
3742 if test "x$ac_system" = "xLinux"
3744 with_libsensors="yes"
3746 with_libsensors="no (Linux only library)"
3749 if test "x$with_libsensors" = "xyes"
3751 SAVE_CPPFLAGS="$CPPFLAGS"
3752 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3754 # AC_CHECK_HEADERS(sensors/sensors.h,
3756 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3758 # [with_libsensors="no (sensors/sensors.h not found)"])
3759 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3761 CPPFLAGS="$SAVE_CPPFLAGS"
3763 if test "x$with_libsensors" = "xyes"
3765 SAVE_CPPFLAGS="$CPPFLAGS"
3766 SAVE_LDFLAGS="$LDFLAGS"
3767 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3768 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3770 AC_CHECK_LIB(sensors, sensors_init,
3772 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3774 [with_libsensors="no (libsensors not found)"])
3776 CPPFLAGS="$SAVE_CPPFLAGS"
3777 LDFLAGS="$SAVE_LDFLAGS"
3779 if test "x$with_libsensors" = "xyes"
3781 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3782 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3783 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3784 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3786 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3789 # --with-libstatgrab {{{
3790 with_libstatgrab_cflags=""
3791 with_libstatgrab_ldflags=""
3792 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3794 if test "x$withval" != "xno" \
3795 && test "x$withval" != "xyes"
3797 with_libstatgrab_cflags="-I$withval/include"
3798 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3799 with_libstatgrab="yes"
3800 with_libstatgrab_pkg_config="no"
3802 with_libstatgrab="$withval"
3803 with_libstatgrab_pkg_config="yes"
3807 with_libstatgrab="yes"
3808 with_libstatgrab_pkg_config="yes"
3811 if test "x$with_libstatgrab" = "xyes" \
3812 && test "x$with_libstatgrab_pkg_config" = "xyes"
3814 if test "x$PKG_CONFIG" != "x"
3816 AC_MSG_CHECKING([pkg-config for libstatgrab])
3818 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3821 with_libstatgrab_pkg_config="no"
3822 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3823 temp_result="not found"
3825 AC_MSG_RESULT([$temp_result])
3827 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3828 with_libstatgrab_pkg_config="no"
3829 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3833 if test "x$with_libstatgrab" = "xyes" \
3834 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3835 && test "x$with_libstatgrab_cflags" = "x"
3837 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3838 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3841 with_libstatgrab_cflags="$temp_result"
3843 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3844 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3846 AC_MSG_RESULT([$temp_result])
3849 if test "x$with_libstatgrab" = "xyes" \
3850 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3851 && test "x$with_libstatgrab_ldflags" = "x"
3853 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3854 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3857 with_libstatgrab_ldflags="$temp_result"
3859 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3860 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3862 AC_MSG_RESULT([$temp_result])
3865 if test "x$with_libstatgrab" = "xyes"
3867 SAVE_CPPFLAGS="$CPPFLAGS"
3868 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3870 AC_CHECK_HEADERS(statgrab.h,
3871 [with_libstatgrab="yes"],
3872 [with_libstatgrab="no (statgrab.h not found)"])
3874 CPPFLAGS="$SAVE_CPPFLAGS"
3877 if test "x$with_libstatgrab" = "xyes"
3879 SAVE_CFLAGS="$CFLAGS"
3880 SAVE_LDFLAGS="$LDFLAGS"
3882 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3883 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3885 AC_CHECK_LIB(statgrab, sg_init,
3886 [with_libstatgrab="yes"],
3887 [with_libstatgrab="no (symbol sg_init not found)"])
3889 CFLAGS="$SAVE_CFLAGS"
3890 LDFLAGS="$SAVE_LDFLAGS"
3893 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3894 if test "x$with_libstatgrab" = "xyes"
3896 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3897 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3898 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3899 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3900 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3904 # --with-libtokyotyrant {{{
3905 with_libtokyotyrant_cppflags=""
3906 with_libtokyotyrant_ldflags=""
3907 with_libtokyotyrant_libs=""
3908 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3910 if test "x$withval" = "xno"
3912 with_libtokyotyrant="no"
3913 else if test "x$withval" = "xyes"
3915 with_libtokyotyrant="yes"
3917 with_libtokyotyrant_cppflags="-I$withval/include"
3918 with_libtokyotyrant_ldflags="-L$withval/include"
3919 with_libtokyotyrant_libs="-ltokyotyrant"
3920 with_libtokyotyrant="yes"
3924 with_libtokyotyrant="yes"
3927 if test "x$with_libtokyotyrant" = "xyes"
3929 if $PKG_CONFIG --exists tokyotyrant
3931 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3932 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`"
3933 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`"
3937 SAVE_CPPFLAGS="$CPPFLAGS"
3938 SAVE_LDFLAGS="$LDFLAGS"
3939 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3940 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3942 if test "x$with_libtokyotyrant" = "xyes"
3944 AC_CHECK_HEADERS(tcrdb.h,
3946 AC_DEFINE(HAVE_TCRDB_H, 1,
3947 [Define to 1 if you have the <tcrdb.h> header file.])
3948 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3951 if test "x$with_libtokyotyrant" = "xyes"
3953 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3955 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3956 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3958 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3959 [$with_libtokyotyrant_libs])
3962 CPPFLAGS="$SAVE_CPPFLAGS"
3963 LDFLAGS="$SAVE_LDFLAGS"
3965 if test "x$with_libtokyotyrant" = "xyes"
3967 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3968 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3969 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3970 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3971 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3972 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3974 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3977 # --with-libupsclient {{{
3978 with_libupsclient_config=""
3979 with_libupsclient_cflags=""
3980 with_libupsclient_libs=""
3981 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3983 if test "x$withval" = "xno"
3985 with_libupsclient="no"
3986 else if test "x$withval" = "xyes"
3988 with_libupsclient="use_pkgconfig"
3990 if test -x "$withval"
3992 with_libupsclient_config="$withval"
3993 with_libupsclient="use_libupsclient_config"
3994 else if test -x "$withval/bin/libupsclient-config"
3996 with_libupsclient_config="$withval/bin/libupsclient-config"
3997 with_libupsclient="use_libupsclient_config"
3999 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
4000 with_libupsclient_cflags="-I$withval/include"
4001 with_libupsclient_libs="-L$withval/lib -lupsclient"
4002 with_libupsclient="yes"
4006 [with_libupsclient="use_pkgconfig"])
4008 # configure using libupsclient-config
4009 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4011 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
4012 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
4015 with_libupsclient="no ($with_libupsclient_config failed)"
4017 with_libupsclient_libs="`$with_libupsclient_config --libs`"
4020 with_libupsclient="no ($with_libupsclient_config failed)"
4023 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4025 with_libupsclient="yes"
4028 # configure using pkg-config
4029 if test "x$with_libupsclient" = "xuse_pkgconfig"
4031 if test "x$PKG_CONFIG" = "x"
4033 with_libupsclient="no (Don't have pkg-config)"
4036 if test "x$with_libupsclient" = "xuse_pkgconfig"
4038 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
4039 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
4042 with_libupsclient="no (pkg-config doesn't know libupsclient)"
4045 if test "x$with_libupsclient" = "xuse_pkgconfig"
4047 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
4050 with_libupsclient="no ($PKG_CONFIG failed)"
4052 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
4055 with_libupsclient="no ($PKG_CONFIG failed)"
4058 if test "x$with_libupsclient" = "xuse_pkgconfig"
4060 with_libupsclient="yes"
4063 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
4064 # the actual checks.
4065 if test "x$with_libupsclient" = "xyes"
4067 SAVE_CPPFLAGS="$CPPFLAGS"
4068 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4070 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
4072 CPPFLAGS="$SAVE_CPPFLAGS"
4074 if test "x$with_libupsclient" = "xyes"
4076 SAVE_CPPFLAGS="$CPPFLAGS"
4077 SAVE_LDFLAGS="$LDFLAGS"
4079 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4080 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
4082 AC_CHECK_LIB(upsclient, upscli_connect,
4083 [with_libupsclient="yes"],
4084 [with_libupsclient="no (symbol upscli_connect not found)"])
4086 CPPFLAGS="$SAVE_CPPFLAGS"
4087 LDFLAGS="$SAVE_LDFLAGS"
4089 if test "x$with_libupsclient" = "xyes"
4091 SAVE_CPPFLAGS="$CPPFLAGS"
4092 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4094 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4095 [#include <stdlib.h>
4097 #include <upsclient.h>])
4099 CPPFLAGS="$SAVE_CPPFLAGS"
4101 if test "x$with_libupsclient" = "xyes"
4103 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4104 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4105 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4106 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4110 # --with-libxmms {{{
4111 with_xmms_config="xmms-config"
4114 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4116 if test "x$withval" != "xno" \
4117 && test "x$withval" != "xyes"
4119 if test -f "$withval" && test -x "$withval";
4121 with_xmms_config="$withval"
4122 else if test -x "$withval/bin/xmms-config"
4124 with_xmms_config="$withval/bin/xmms-config"
4127 else if test "x$withval" = "xno"
4137 if test "x$with_libxmms" = "xyes"
4139 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4140 xmms_config_status=$?
4142 if test $xmms_config_status -ne 0
4147 if test "x$with_libxmms" = "xyes"
4149 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4150 xmms_config_status=$?
4152 if test $xmms_config_status -ne 0
4157 if test "x$with_libxmms" = "xyes"
4159 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4161 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4162 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4163 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4164 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4171 with_libxmms_numeric=0
4172 if test "x$with_libxmms" = "xyes"
4174 with_libxmms_numeric=1
4176 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4177 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4180 # --with-libyajl {{{
4181 with_libyajl_cppflags=""
4182 with_libyajl_ldflags=""
4183 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4185 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4187 with_libyajl_cppflags="-I$withval/include"
4188 with_libyajl_ldflags="-L$withval/lib"
4191 with_libyajl="$withval"
4197 if test "x$with_libyajl" = "xyes"
4199 SAVE_CPPFLAGS="$CPPFLAGS"
4200 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4202 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4203 AC_CHECK_HEADERS(yajl/yajl_version.h)
4205 CPPFLAGS="$SAVE_CPPFLAGS"
4207 if test "x$with_libyajl" = "xyes"
4209 SAVE_CPPFLAGS="$CPPFLAGS"
4210 SAVE_LDFLAGS="$LDFLAGS"
4211 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4212 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4214 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4216 CPPFLAGS="$SAVE_CPPFLAGS"
4217 LDFLAGS="$SAVE_LDFLAGS"
4219 if test "x$with_libyajl" = "xyes"
4221 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4222 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4223 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4224 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4225 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4226 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4227 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4229 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4232 # --with-libvarnish {{{
4233 with_libvarnish_cppflags=""
4234 with_libvarnish_cflags=""
4235 with_libvarnish_libs=""
4236 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4238 if test "x$withval" = "xno"
4240 with_libvarnish="no"
4241 else if test "x$withval" = "xyes"
4243 with_libvarnish="use_pkgconfig"
4244 else if test -d "$with_libvarnish/lib"
4246 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4247 with_libvarnish_cflags="-I$withval/include"
4248 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4249 with_libvarnish="yes"
4252 [with_libvarnish="use_pkgconfig"])
4254 # configure using pkg-config
4255 if test "x$with_libvarnish" = "xuse_pkgconfig"
4257 if test "x$PKG_CONFIG" = "x"
4259 with_libvarnish="no (Don't have pkg-config)"
4262 if test "x$with_libvarnish" = "xuse_pkgconfig"
4264 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4265 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4268 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4271 if test "x$with_libvarnish" = "xuse_pkgconfig"
4273 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4276 with_libvarnish="no ($PKG_CONFIG failed)"
4278 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4281 with_libvarnish="no ($PKG_CONFIG failed)"
4284 if test "x$with_libvarnish" = "xuse_pkgconfig"
4286 with_libvarnish="yes"
4289 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4290 # the actual checks.
4291 if test "x$with_libvarnish" = "xyes"
4293 SAVE_CPPFLAGS="$CPPFLAGS"
4294 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4295 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4297 CPPFLAGS="$SAVE_CPPFLAGS"
4299 if test "x$with_libvarnish" = "xyes"
4301 SAVE_CPPFLAGS="$CPPFLAGS"
4302 #SAVE_LDFLAGS="$LDFLAGS"
4304 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4305 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4307 AC_CHECK_HEADERS(varnish/vsc.h,
4308 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4309 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4311 CPPFLAGS="$SAVE_CPPFLAGS"
4312 #LDFLAGS="$SAVE_LDFLAGS"
4314 if test "x$with_libvarnish" = "xyes"
4316 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4317 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4318 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4319 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4323 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4324 with_libxml2="no (pkg-config isn't available)"
4325 with_libxml2_cflags=""
4326 with_libxml2_ldflags=""
4327 with_libvirt="no (pkg-config isn't available)"
4328 with_libvirt_cflags=""
4329 with_libvirt_ldflags=""
4330 if test "x$PKG_CONFIG" != "x"
4332 $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
4337 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4340 $PKG_CONFIG --exists libvirt 2>/dev/null
4345 with_libvirt="no (pkg-config doesn't know libvirt)"
4348 if test "x$with_libxml2" = "xyes"
4350 with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
4355 with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
4361 if test "x$with_libxml2" = "xyes"
4363 SAVE_CPPFLAGS="$CPPFLAGS"
4364 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4366 AC_CHECK_HEADERS(libxml/parser.h, [],
4367 [with_libxml2="no (libxml/parser.h not found)"])
4369 CPPFLAGS="$SAVE_CPPFLAGS"
4371 if test "x$with_libxml2" = "xyes"
4373 SAVE_CFLAGS="$CFLAGS"
4374 SAVE_LDFLAGS="$LDFLAGS"
4376 CFLAGS="$CFLAGS $with_libxml2_cflags"
4377 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4379 AC_CHECK_LIB(xml2, xmlXPathEval,
4380 [with_libxml2="yes"],
4381 [with_libxml2="no (symbol xmlXPathEval not found)"])
4383 CFLAGS="$SAVE_CFLAGS"
4384 LDFLAGS="$SAVE_LDFLAGS"
4386 dnl Add the right compiler flags and libraries.
4387 if test "x$with_libxml2" = "xyes"; then
4388 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4389 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4390 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4391 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4393 if test "x$with_libvirt" = "xyes"
4395 with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`"
4400 with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`"
4406 if test "x$with_libvirt" = "xyes"
4408 SAVE_CPPFLAGS="$CPPFLAGS"
4409 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4411 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4412 [with_libvirt="no (libvirt/libvirt.h not found)"])
4414 CPPFLAGS="$SAVE_CPPFLAGS"
4416 if test "x$with_libvirt" = "xyes"
4418 SAVE_CFLAGS="$CFLAGS"
4419 SAVE_LDFLAGS="$LDFLAGS"
4421 CFLAGS="$CFLAGS $with_libvirt_cflags"
4422 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4424 AC_CHECK_LIB(virt, virDomainBlockStats,
4425 [with_libvirt="yes"],
4426 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4428 CFLAGS="$SAVE_CFLAGS"
4429 LDFLAGS="$SAVE_LDFLAGS"
4431 dnl Add the right compiler flags and libraries.
4432 if test "x$with_libvirt" = "xyes"; then
4433 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4434 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4435 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4436 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4440 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4441 with_libopenipmipthread="yes"
4442 with_libopenipmipthread_cflags=""
4443 with_libopenipmipthread_libs=""
4445 AC_MSG_CHECKING([for pkg-config])
4447 if test "x$PKG_CONFIG" = "x"
4449 with_libopenipmipthread="no"
4452 temp_result="$PKG_CONFIG"
4454 AC_MSG_RESULT([$temp_result])
4456 if test "x$with_libopenipmipthread" = "xyes"
4458 AC_MSG_CHECKING([for libOpenIPMIpthread])
4459 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4462 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4464 AC_MSG_RESULT([$with_libopenipmipthread])
4467 if test "x$with_libopenipmipthread" = "xyes"
4469 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4470 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4473 with_libopenipmipthread_cflags="$temp_result"
4475 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4476 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4478 AC_MSG_RESULT([$temp_result])
4481 if test "x$with_libopenipmipthread" = "xyes"
4483 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4484 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4487 with_libopenipmipthread_ldflags="$temp_result"
4489 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4490 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4492 AC_MSG_RESULT([$temp_result])
4495 if test "x$with_libopenipmipthread" = "xyes"
4497 SAVE_CPPFLAGS="$CPPFLAGS"
4498 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4500 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4501 [with_libopenipmipthread="yes"],
4502 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4503 [#include <OpenIPMI/ipmiif.h>
4504 #include <OpenIPMI/ipmi_err.h>
4505 #include <OpenIPMI/ipmi_posix.h>
4506 #include <OpenIPMI/ipmi_conn.h>
4509 CPPFLAGS="$SAVE_CPPFLAGS"
4512 if test "x$with_libopenipmipthread" = "xyes"
4514 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4515 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4516 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4517 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4521 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4522 [with_libnotify="yes"],
4523 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4526 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4529 # Check for enabled/disabled features
4532 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4533 # ------------------------------------------------------------
4535 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4540 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4545 m4_define([EnDis],[disabled])dnl
4546 m4_define([YesNo],[no])dnl
4552 m4_define([EnDis],[enabled])dnl
4553 m4_define([YesNo],[yes])dnl
4556 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4560 m4_if([$3], [feature], [],
4564 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4570 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4572 enable_$1='[YesNo]'dnl
4574 if test "x$enable_$1" = "xno"
4578 if test "x$enable_$1" = "xyes"
4582 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4587 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4588 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4590 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4592 # AC_PLUGIN(name, default, info)
4593 # ------------------------------------------------------------
4600 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4602 if test "x$enableval" = "xyes"
4605 else if test "x$enableval" = "xforce"
4610 enable_plugin="no (disabled on command line)"
4614 if test "x$enable_all_plugins" = "xauto"
4616 if test "x$2" = "xyes"
4623 enable_plugin="$enable_all_plugins"
4626 if test "x$enable_plugin" = "xyes"
4628 if test "x$2" = "xyes" || test "x$force" = "xyes"
4630 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4631 if test "x$2" != "xyes"
4633 dependency_warning="yes"
4635 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4636 dependency_error="yes"
4637 enable_plugin="no (dependency error)"
4640 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4641 enable_$1="$enable_plugin"
4643 )# AC_PLUGIN(name, default, info)
4645 m4_divert_once([HELP_ENABLE], [
4646 collectd features:])
4647 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4648 AC_COLLECTD([debug], [enable], [feature], [debugging])
4649 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4650 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4652 dependency_warning="no"
4653 dependency_error="no"
4658 plugin_conntrack="no"
4659 plugin_contextswitch="no"
4662 plugin_curl_json="no"
4663 plugin_curl_xml="no"
4669 plugin_interface="no"
4676 plugin_multimeter="no"
4680 plugin_processes="no"
4681 plugin_protocols="no"
4685 plugin_tcpconns="no"
4692 plugin_wireless="no"
4696 if test "x$ac_system" = "xLinux"
4698 plugin_battery="yes"
4699 plugin_conntrack="yes"
4700 plugin_contextswitch="yes"
4702 plugin_cpufreq="yes"
4704 plugin_entropy="yes"
4705 plugin_fscache="yes"
4706 plugin_interface="yes"
4712 plugin_processes="yes"
4713 plugin_protocols="yes"
4716 plugin_tcpconns="yes"
4717 plugin_thermal="yes"
4720 plugin_vserver="yes"
4721 plugin_wireless="yes"
4723 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4729 if test "x$ac_system" = "xOpenBSD"
4731 plugin_tcpconns="yes"
4735 if test "x$with_libiokit" = "xyes"
4737 plugin_battery="yes"
4743 if test "x$ac_system" = "xAIX"
4745 plugin_tcpconns="yes"
4748 if test "x$with_perfstat" = "xyes"
4751 plugin_contextswitch="yes"
4755 plugin_interface="yes"
4760 if test "x$with_procinfo" = "xyes"
4762 plugin_processes="yes"
4766 if test "x$with_kstat" = "xyes"
4770 plugin_zfs_arc="yes"
4773 if test "x$with_devinfo$with_kstat" = "xyesyes"
4777 plugin_interface="yes"
4783 if test "x$with_libstatgrab" = "xyes"
4787 plugin_interface="yes"
4794 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4797 if test "x$have_strptime" = "xyes"
4803 if test "x$with_libopenipmipthread" = "xyes"
4808 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4810 plugin_curl_json="yes"
4813 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4815 plugin_curl_xml="yes"
4818 if test "x$have_processor_info" = "xyes"
4822 if test "x$have_sysctl" = "xyes"
4827 if test "x$ac_system" = "xDarwin"
4832 if test "x$have_sysctlbyname" = "xyes"
4834 plugin_contextswitch="yes"
4837 plugin_tcpconns="yes"
4840 # Df plugin: Check if we know how to determine mount points first.
4841 #if test "x$have_listmntent" = "xyes"; then
4844 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4848 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4852 #if test "x$have_getmntent" = "xseq"
4856 if test "x$c_cv_have_one_getmntent" = "xyes"
4861 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4862 if test "x$plugin_df" = "xyes"
4865 if test "x$have_statfs" = "xyes"
4869 if test "x$have_statvfs" = "xyes"
4875 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
4877 plugin_ethstat="yes"
4880 if test "x$have_getifaddrs" = "xyes"
4882 plugin_interface="yes"
4885 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4887 plugin_libvirt="yes"
4890 if test "x$have_getloadavg" = "xyes"
4895 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4900 # Mac OS X memory interface
4901 if test "x$have_host_statistics" = "xyes"
4906 if test "x$have_termios_h" = "xyes"
4908 plugin_multimeter="yes"
4912 if test "x$have_thread_info" = "xyes"
4914 plugin_processes="yes"
4917 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4919 plugin_processes="yes"
4922 if test "x$with_kvm_getswapinfo" = "xyes"
4927 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4932 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4934 plugin_tcpconns="yes"
4937 if test "x$have_getutent" = "xyes"
4941 if test "x$have_getutxent" = "xyes"
4946 m4_divert_once([HELP_ENABLE], [
4949 AC_ARG_ENABLE([all-plugins],
4950 AC_HELP_STRING([--enable-all-plugins],
4951 [enable all plugins (auto by def)]),
4953 if test "x$enableval" = "xyes"
4955 enable_all_plugins="yes"
4956 else if test "x$enableval" = "xauto"
4958 enable_all_plugins="auto"
4960 enable_all_plugins="no"
4963 [enable_all_plugins="auto"])
4965 m4_divert_once([HELP_ENABLE], [])
4967 AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
4968 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4969 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4970 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4971 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4972 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4973 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4974 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4975 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4976 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4977 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4978 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4979 AC_PLUGIN([csv], [yes], [CSV output plugin])
4980 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4981 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4982 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4983 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4984 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4985 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4986 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4987 AC_PLUGIN([email], [yes], [EMail statistics])
4988 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4989 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
4990 AC_PLUGIN([exec], [yes], [Execution of external programs])
4991 AC_PLUGIN([filecount], [yes], [Count files in directories])
4992 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4993 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4994 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4995 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4996 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4997 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4998 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4999 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
5000 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
5001 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
5002 AC_PLUGIN([load], [$plugin_load], [System load])
5003 AC_PLUGIN([logfile], [yes], [File logging plugin])
5004 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
5005 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
5006 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
5007 AC_PLUGIN([match_hashed], [yes], [The hashed match])
5008 AC_PLUGIN([match_regex], [yes], [The regex match])
5009 AC_PLUGIN([match_timediff], [yes], [The timediff match])
5010 AC_PLUGIN([match_value], [yes], [The value match])
5011 AC_PLUGIN([mbmon], [yes], [Query mbmond])
5012 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
5013 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
5014 AC_PLUGIN([memcached], [yes], [memcached statistics])
5015 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
5016 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
5017 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
5018 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
5019 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
5020 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
5021 AC_PLUGIN([network], [yes], [Network communication plugin])
5022 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
5023 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
5024 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
5025 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
5026 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
5027 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
5028 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
5029 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
5030 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
5031 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
5032 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
5033 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
5034 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
5035 # FIXME: Check for libevent, too.
5036 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
5037 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
5038 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
5039 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
5040 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
5041 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
5042 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
5043 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
5044 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
5045 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
5046 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
5047 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
5048 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
5049 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
5050 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
5051 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
5052 AC_PLUGIN([table], [yes], [Parsing of tabular data])
5053 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
5054 AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files])
5055 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
5056 AC_PLUGIN([target_notification], [yes], [The notification target])
5057 AC_PLUGIN([target_replace], [yes], [The replace target])
5058 AC_PLUGIN([target_scale],[yes], [The scale target])
5059 AC_PLUGIN([target_set], [yes], [The set target])
5060 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
5061 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
5062 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
5063 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
5064 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
5065 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
5066 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
5067 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
5068 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
5069 AC_PLUGIN([users], [$plugin_users], [User statistics])
5070 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
5071 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
5072 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
5073 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
5074 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
5075 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
5076 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
5077 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
5078 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
5079 AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin])
5080 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
5081 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
5083 dnl Default configuration file
5084 # Load either syslog or logfile
5085 LOAD_PLUGIN_SYSLOG=""
5086 LOAD_PLUGIN_LOGFILE=""
5088 AC_MSG_CHECKING([which default log plugin to load])
5089 default_log_plugin="none"
5090 if test "x$enable_syslog" = "xyes"
5092 default_log_plugin="syslog"
5094 LOAD_PLUGIN_SYSLOG="##"
5097 if test "x$enable_logfile" = "xyes"
5099 if test "x$default_log_plugin" = "xnone"
5101 default_log_plugin="logfile"
5103 LOAD_PLUGIN_LOGFILE="#"
5106 LOAD_PLUGIN_LOGFILE="##"
5108 AC_MSG_RESULT([$default_log_plugin])
5110 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5111 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5113 DEFAULT_LOG_LEVEL="info"
5114 if test "x$enable_debug" = "xyes"
5116 DEFAULT_LOG_LEVEL="debug"
5118 AC_SUBST(DEFAULT_LOG_LEVEL)
5120 # Load only one of rrdtool, network, csv in the default config.
5121 LOAD_PLUGIN_RRDTOOL=""
5122 LOAD_PLUGIN_NETWORK=""
5125 AC_MSG_CHECKING([which default write plugin to load])
5126 default_write_plugin="none"
5127 if test "x$enable_rrdtool" = "xyes"
5129 default_write_plugin="rrdtool"
5131 LOAD_PLUGIN_RRDTOOL="##"
5134 if test "x$enable_network" = "xyes"
5136 if test "x$default_write_plugin" = "xnone"
5138 default_write_plugin="network"
5140 LOAD_PLUGIN_NETWORK="#"
5143 LOAD_PLUGIN_NETWORK="##"
5146 if test "x$enable_csv" = "xyes"
5148 if test "x$default_write_plugin" = "xnone"
5150 default_write_plugin="csv"
5155 LOAD_PLUGIN_CSV="##"
5157 AC_MSG_RESULT([$default_write_plugin])
5159 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5160 AC_SUBST(LOAD_PLUGIN_NETWORK)
5161 AC_SUBST(LOAD_PLUGIN_CSV)
5164 if test "x$ac_system" = "xLinux" \
5165 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5167 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5170 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5172 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5176 PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
5177 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5179 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5181 PERL_BINDINGS_OPTIONS="$withval"
5182 with_perl_bindings="yes"
5184 with_perl_bindings="$withval"
5188 if test -n "$perl_interpreter"
5190 with_perl_bindings="yes"
5192 with_perl_bindings="no (no perl interpreter found)"
5195 if test "x$with_perl_bindings" = "xyes"
5197 PERL_BINDINGS="perl"
5201 AC_SUBST(PERL_BINDINGS)
5202 AC_SUBST(PERL_BINDINGS_OPTIONS)
5204 dnl libcollectdclient
5205 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5206 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5207 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5209 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5211 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5213 AC_SUBST(LCC_VERSION_MAJOR)
5214 AC_SUBST(LCC_VERSION_MINOR)
5215 AC_SUBST(LCC_VERSION_PATCH)
5216 AC_SUBST(LCC_VERSION_EXTRA)
5217 AC_SUBST(LCC_VERSION_STRING)
5219 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5221 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
5223 if test "x$with_librrd" = "xyes" \
5224 && test "x$librrd_threadsafe" != "xyes"
5226 with_librrd="yes (warning: librrd is not thread-safe)"
5229 if test "x$with_libperl" = "xyes"
5231 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5233 enable_perl="no (needs libperl)"
5236 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5238 enable_perl="no (libperl doesn't support ithreads)"
5241 if test "x$with_perl_bindings" = "xyes" \
5242 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5244 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5251 libcredis . . . . . . $with_libcredis
5252 libcurl . . . . . . . $with_libcurl
5253 libdbi . . . . . . . $with_libdbi
5254 libesmtp . . . . . . $with_libesmtp
5255 libganglia . . . . . $with_libganglia
5256 libgcrypt . . . . . . $with_libgcrypt
5257 libhal . . . . . . . $with_libhal
5258 libiokit . . . . . . $with_libiokit
5259 libiptc . . . . . . . $with_libiptc
5260 libjvm . . . . . . . $with_java
5261 libkstat . . . . . . $with_kstat
5262 libkvm . . . . . . . $with_libkvm
5263 libmemcached . . . . $with_libmemcached
5264 libmodbus . . . . . . $with_libmodbus
5265 libmongoc . . . . . . $with_libmongoc
5266 libmysql . . . . . . $with_libmysql
5267 libnetapp . . . . . . $with_libnetapp
5268 libnetlink . . . . . $with_libnetlink
5269 libnetsnmp . . . . . $with_libnetsnmp
5270 libnotify . . . . . . $with_libnotify
5271 liboconfig . . . . . $with_liboconfig
5272 libopenipmi . . . . . $with_libopenipmipthread
5273 liboping . . . . . . $with_liboping
5274 libowcapi . . . . . . $with_libowcapi
5275 libpcap . . . . . . . $with_libpcap
5276 libperfstat . . . . . $with_perfstat
5277 libperl . . . . . . . $with_libperl
5278 libpq . . . . . . . . $with_libpq
5279 libpthread . . . . . $with_libpthread
5280 librabbitmq . . . . . $with_librabbitmq
5281 librouteros . . . . . $with_librouteros
5282 librrd . . . . . . . $with_librrd
5283 libsensors . . . . . $with_libsensors
5284 libstatgrab . . . . . $with_libstatgrab
5285 libtokyotyrant . . . $with_libtokyotyrant
5286 libupsclient . . . . $with_libupsclient
5287 libvarnish . . . . . $with_libvarnish
5288 libvirt . . . . . . . $with_libvirt
5289 libxml2 . . . . . . . $with_libxml2
5290 libxmms . . . . . . . $with_libxmms
5291 libyajl . . . . . . . $with_libyajl
5292 oracle . . . . . . . $with_oracle
5293 protobuf-c . . . . . $have_protoc_c
5294 python . . . . . . . $with_python
5297 daemon mode . . . . . $enable_daemon
5298 debug . . . . . . . . $enable_debug
5301 perl . . . . . . . . $with_perl_bindings
5304 aggregation . . . . . $enable_aggregation
5305 amqp . . . . . . . $enable_amqp
5306 apache . . . . . . . $enable_apache
5307 apcups . . . . . . . $enable_apcups
5308 apple_sensors . . . . $enable_apple_sensors
5309 ascent . . . . . . . $enable_ascent
5310 battery . . . . . . . $enable_battery
5311 bind . . . . . . . . $enable_bind
5312 conntrack . . . . . . $enable_conntrack
5313 contextswitch . . . . $enable_contextswitch
5314 cpu . . . . . . . . . $enable_cpu
5315 cpufreq . . . . . . . $enable_cpufreq
5316 csv . . . . . . . . . $enable_csv
5317 curl . . . . . . . . $enable_curl
5318 curl_json . . . . . . $enable_curl_json
5319 curl_xml . . . . . . $enable_curl_xml
5320 dbi . . . . . . . . . $enable_dbi
5321 df . . . . . . . . . $enable_df
5322 disk . . . . . . . . $enable_disk
5323 dns . . . . . . . . . $enable_dns
5324 email . . . . . . . . $enable_email
5325 entropy . . . . . . . $enable_entropy
5326 ethstat . . . . . . . $enable_ethstat
5327 exec . . . . . . . . $enable_exec
5328 filecount . . . . . . $enable_filecount
5329 fscache . . . . . . . $enable_fscache
5330 gmond . . . . . . . . $enable_gmond
5331 hddtemp . . . . . . . $enable_hddtemp
5332 interface . . . . . . $enable_interface
5333 ipmi . . . . . . . . $enable_ipmi
5334 iptables . . . . . . $enable_iptables
5335 ipvs . . . . . . . . $enable_ipvs
5336 irq . . . . . . . . . $enable_irq
5337 java . . . . . . . . $enable_java
5338 libvirt . . . . . . . $enable_libvirt
5339 load . . . . . . . . $enable_load
5340 logfile . . . . . . . $enable_logfile
5341 lpar . . . . . . . . $enable_lpar
5342 madwifi . . . . . . . $enable_madwifi
5343 match_empty_counter . $enable_match_empty_counter
5344 match_hashed . . . . $enable_match_hashed
5345 match_regex . . . . . $enable_match_regex
5346 match_timediff . . . $enable_match_timediff
5347 match_value . . . . . $enable_match_value
5348 mbmon . . . . . . . . $enable_mbmon
5349 md . . . . . . . . . $enable_md
5350 memcachec . . . . . . $enable_memcachec
5351 memcached . . . . . . $enable_memcached
5352 memory . . . . . . . $enable_memory
5353 modbus . . . . . . . $enable_modbus
5354 multimeter . . . . . $enable_multimeter
5355 mysql . . . . . . . . $enable_mysql
5356 netapp . . . . . . . $enable_netapp
5357 netlink . . . . . . . $enable_netlink
5358 network . . . . . . . $enable_network
5359 nfs . . . . . . . . . $enable_nfs
5360 nginx . . . . . . . . $enable_nginx
5361 notify_desktop . . . $enable_notify_desktop
5362 notify_email . . . . $enable_notify_email
5363 ntpd . . . . . . . . $enable_ntpd
5364 numa . . . . . . . . $enable_numa
5365 nut . . . . . . . . . $enable_nut
5366 olsrd . . . . . . . . $enable_olsrd
5367 onewire . . . . . . . $enable_onewire
5368 openvpn . . . . . . . $enable_openvpn
5369 oracle . . . . . . . $enable_oracle
5370 perl . . . . . . . . $enable_perl
5371 pf . . . . . . . . . $enable_pf
5372 pinba . . . . . . . . $enable_pinba
5373 ping . . . . . . . . $enable_ping
5374 postgresql . . . . . $enable_postgresql
5375 powerdns . . . . . . $enable_powerdns
5376 processes . . . . . . $enable_processes
5377 protocols . . . . . . $enable_protocols
5378 python . . . . . . . $enable_python
5379 redis . . . . . . . . $enable_redis
5380 routeros . . . . . . $enable_routeros
5381 rrdcached . . . . . . $enable_rrdcached
5382 rrdtool . . . . . . . $enable_rrdtool
5383 sensors . . . . . . . $enable_sensors
5384 serial . . . . . . . $enable_serial
5385 snmp . . . . . . . . $enable_snmp
5386 swap . . . . . . . . $enable_swap
5387 syslog . . . . . . . $enable_syslog
5388 table . . . . . . . . $enable_table
5389 tail . . . . . . . . $enable_tail
5390 tail_csv . . . . . . $enable_tail_csv
5391 tape . . . . . . . . $enable_tape
5392 target_notification . $enable_target_notification
5393 target_replace . . . $enable_target_replace
5394 target_scale . . . . $enable_target_scale
5395 target_set . . . . . $enable_target_set
5396 target_v5upgrade . . $enable_target_v5upgrade
5397 tcpconns . . . . . . $enable_tcpconns
5398 teamspeak2 . . . . . $enable_teamspeak2
5399 ted . . . . . . . . . $enable_ted
5400 thermal . . . . . . . $enable_thermal
5401 threshold . . . . . . $enable_threshold
5402 tokyotyrant . . . . . $enable_tokyotyrant
5403 unixsock . . . . . . $enable_unixsock
5404 uptime . . . . . . . $enable_uptime
5405 users . . . . . . . . $enable_users
5406 uuid . . . . . . . . $enable_uuid
5407 varnish . . . . . . . $enable_varnish
5408 vmem . . . . . . . . $enable_vmem
5409 vserver . . . . . . . $enable_vserver
5410 wireless . . . . . . $enable_wireless
5411 write_graphite . . . $enable_write_graphite
5412 write_http . . . . . $enable_write_http
5413 write_mongodb . . . . $enable_write_mongodb
5414 write_redis . . . . . $enable_write_redis
5415 write_riemann . . . . $enable_write_riemann
5416 xmms . . . . . . . . $enable_xmms
5417 zfs_arc . . . . . . . $enable_zfs_arc
5421 if test "x$dependency_error" = "xyes"; then
5422 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5425 if test "x$dependency_warning" = "xyes"; then
5426 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5429 # vim: set fdm=marker :