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 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
54 AC_MSG_CHECKING([for kernel type ($host_os)])
57 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
61 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
71 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
77 AC_MSG_RESULT([$ac_system])
79 if test "x$ac_system" = "xLinux"
81 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
82 if test -z "$KERNEL_DIR"
84 KERNEL_DIR="/lib/modules/`uname -r`/source"
87 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
88 AC_SUBST(KERNEL_CFLAGS)
91 if test "x$ac_system" = "xSolaris"
93 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
94 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
96 if test "x$ac_system" = "xAIX"
98 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
101 # Where to install .pc files.
102 pkgconfigdir="${libdir}/pkgconfig"
103 AC_SUBST(pkgconfigdir)
105 # Check for standards compliance mode
106 AC_ARG_ENABLE(standards,
107 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
108 [enable_standards="$enableval"],
109 [enable_standards="no"])
110 if test "x$enable_standards" = "xyes"
112 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
113 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
114 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
115 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
116 if test "x$GCC" = "xyes"
118 CFLAGS="$CFLAGS -std=c99"
121 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
124 # Checks for header files.
131 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)
134 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
139 # include <sys/types.h>
142 AC_CHECK_HEADERS(netinet/in.h, [], [],
147 # include <sys/types.h>
149 #if HAVE_NETINET_IN_SYSTM_H
150 # include <netinet/in_systm.h>
153 AC_CHECK_HEADERS(netinet/ip.h, [], [],
158 # include <sys/types.h>
160 #if HAVE_NETINET_IN_SYSTM_H
161 # include <netinet/in_systm.h>
163 #if HAVE_NETINET_IN_H
164 # include <netinet/in.h>
167 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
172 # include <sys/types.h>
174 #if HAVE_NETINET_IN_SYSTM_H
175 # include <netinet/in_systm.h>
177 #if HAVE_NETINET_IN_H
178 # include <netinet/in.h>
180 #if HAVE_NETINET_IP_H
181 # include <netinet/ip.h>
184 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
189 # include <sys/types.h>
191 #if HAVE_NETINET_IN_SYSTM_H
192 # include <netinet/in_systm.h>
194 #if HAVE_NETINET_IN_H
195 # include <netinet/in.h>
197 #if HAVE_NETINET_IP_H
198 # include <netinet/ip.h>
201 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
206 # include <sys/types.h>
208 #if HAVE_NETINET_IN_SYSTM_H
209 # include <netinet/in_systm.h>
211 #if HAVE_NETINET_IN_H
212 # include <netinet/in.h>
215 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
220 # include <sys/types.h>
222 #if HAVE_NETINET_IN_SYSTM_H
223 # include <netinet/in_systm.h>
225 #if HAVE_NETINET_IN_H
226 # include <netinet/in.h>
228 #if HAVE_NETINET_IP6_H
229 # include <netinet/ip6.h>
232 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
237 # include <sys/types.h>
239 #if HAVE_NETINET_IN_SYSTM_H
240 # include <netinet/in_systm.h>
242 #if HAVE_NETINET_IN_H
243 # include <netinet/in.h>
245 #if HAVE_NETINET_IP_H
246 # include <netinet/ip.h>
249 AC_CHECK_HEADERS(netinet/udp.h, [], [],
254 # include <sys/types.h>
256 #if HAVE_NETINET_IN_SYSTM_H
257 # include <netinet/in_systm.h>
259 #if HAVE_NETINET_IN_H
260 # include <netinet/in.h>
262 #if HAVE_NETINET_IP_H
263 # include <netinet/ip.h>
268 AC_CHECK_HEADERS(sys/dkstat.h)
269 if test "x$ac_system" = "xDarwin"
271 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)
272 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
274 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
277 # include <sys/types.h>
280 # include <sys/param.h>
284 AC_MSG_CHECKING([for sysctl kern.cp_times])
285 if test -x /sbin/sysctl
287 /sbin/sysctl kern.cp_times 2>/dev/null
291 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
292 [Define if sysctl supports kern.cp_times])
301 AC_CHECK_HEADERS(linux/major.h libgen.h)
303 # For md module (Linux only)
304 if test "x$ac_system" = "xLinux"
306 AC_CHECK_HEADERS(linux/raid/md_u.h,
307 [have_linux_raid_md_u_h="yes"],
308 [have_linux_raid_md_u_h="no"],
310 #include <sys/ioctl.h>
311 #include <linux/major.h>
312 #include <linux/types.h>
315 have_linux_raid_md_u_h="no"
318 # For the battery plugin
319 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
321 #if HAVE_IOKIT_IOKITLIB_H
322 # include <IOKit/IOKitLib.h>
324 #if HAVE_IOKIT_IOTYPES_H
325 # include <IOKit/IOTypes.h>
329 # For the swap module
330 have_linux_wireless_h="no"
331 if test "x$ac_system" = "xLinux"
333 AC_CHECK_HEADERS(linux/wireless.h,
334 [have_linux_wireless_h="yes"],
335 [have_linux_wireless_h="no"],
338 #include <sys/ioctl.h>
339 #include <sys/socket.h>
343 # For the swap module
344 have_sys_swap_h="yes"
345 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
347 #undef _FILE_OFFSET_BITS
348 #undef _LARGEFILE64_SOURCE
350 # include <sys/types.h>
353 # include <sys/param.h>
357 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
360 if test "x$GCC" = "xyes"
362 hint_64="CFLAGS='-m64'"
364 hint_64="CFLAGS='-xarch=v9'"
366 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
370 # For the processes plugin
372 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
374 # For interface plugin
375 AC_CHECK_HEADERS(ifaddrs.h)
376 AC_CHECK_HEADERS(net/if.h, [], [],
379 # include <sys/types.h>
381 #if HAVE_SYS_SOCKET_H
382 # include <sys/socket.h>
385 AC_CHECK_HEADERS(linux/if.h, [], [],
388 # include <sys/types.h>
390 #if HAVE_SYS_SOCKET_H
391 # include <sys/socket.h>
394 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
397 # include <sys/types.h>
399 #if HAVE_SYS_SOCKET_H
400 # include <sys/socket.h>
403 # include <linux/if.h>
408 AC_CHECK_HEADERS(linux/sockios.h,
409 [have_linux_sockios_h="yes"],
410 [have_linux_sockios_h="no"],
413 # include <sys/ioctl.h>
419 AC_CHECK_HEADERS(linux/ethtool.h,
420 [have_linux_ethtool_h="yes"],
421 [have_linux_ethtool_h="no"],
424 # include <sys/ioctl.h>
429 #if HAVE_LINUX_SOCKIOS_H
430 # include <linux/sockios.h>
435 have_linux_ip_vs_h="no"
436 have_net_ip_vs_h="no"
438 ip_vs_h_needs_kernel_cflags="no"
439 if test "x$ac_system" = "xLinux"
441 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
442 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
443 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
445 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
447 SAVE_CFLAGS="$CFLAGS"
448 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
450 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
452 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
453 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
454 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
456 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
458 ip_vs_h_needs_kernel_cflags="yes"
461 CFLAGS="$SAVE_CFLAGS"
464 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
467 AC_CHECK_HEADERS(sys/ucred.h, [], [],
470 # include <sys/types.h>
473 # include <sys/param.h>
477 # For mount interface
478 AC_CHECK_HEADERS(sys/mount.h, [], [],
481 # include <sys/types.h>
484 # include <sys/param.h>
488 # For the email plugin
489 AC_CHECK_HEADERS(linux/un.h, [], [],
491 #if HAVE_SYS_SOCKET_H
492 # include <sys/socket.h>
496 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)
499 AC_CHECK_HEADERS(arpa/nameser.h)
500 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
502 #if HAVE_ARPA_NAMESER_H
503 # include <arpa/nameser.h>
507 AC_CHECK_HEADERS(net/if_arp.h, [], [],
508 [#if HAVE_SYS_SOCKET_H
509 # include <sys/socket.h>
512 AC_CHECK_HEADERS(net/ppp_defs.h)
513 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
514 [#if HAVE_NET_PPP_DEFS_H
515 # include <net/ppp_defs.h>
518 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
523 # include <sys/types.h>
525 #if HAVE_SYS_SOCKET_H
526 # include <sys/socket.h>
531 #if HAVE_NETINET_IN_H
532 # include <netinet/in.h>
536 AC_CHECK_HEADERS(netinet/ip_compat.h)
538 # For the multimeter plugin
540 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
543 # Checks for typedefs, structures, and compiler characteristics.
552 # Checks for library functions.
554 AC_PROG_GCC_TRADITIONAL
555 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
559 SAVE_CFLAGS="$CFLAGS"
560 # Emulate behavior of src/Makefile.am
561 if test "x$GCC" = "xyes"
563 CFLAGS="$CFLAGS -Wall -Werror"
566 AC_CACHE_CHECK([for strtok_r],
567 [c_cv_have_strtok_r_default],
576 char buffer[] = "foo,bar,baz";
583 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
586 printf ("token = %s;\n", token);
589 [c_cv_have_strtok_r_default="yes"],
590 [c_cv_have_strtok_r_default="no"]
594 if test "x$c_cv_have_strtok_r_default" = "xno"
596 CFLAGS="$CFLAGS -D_REENTRANT=1"
598 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
599 [c_cv_have_strtok_r_reentrant],
608 char buffer[] = "foo,bar,baz";
615 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
618 printf ("token = %s;\n", token);
621 [c_cv_have_strtok_r_reentrant="yes"],
622 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
627 CFLAGS="$SAVE_CFLAGS"
628 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
630 CFLAGS="$CFLAGS -D_REENTRANT=1"
633 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
635 socket_needs_socket="no"
636 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
637 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
639 clock_gettime_needs_rt="no"
640 clock_gettime_needs_posix4="no"
641 have_clock_gettime="no"
642 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
643 if test "x$have_clock_gettime" = "xno"
645 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
646 have_clock_gettime="yes"])
648 if test "x$have_clock_gettime" = "xno"
650 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
651 have_clock_gettime="yes"])
653 if test "x$have_clock_gettime" = "xyes"
655 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
657 AC_MSG_WARN(cannot find clock_gettime)
660 nanosleep_needs_rt="no"
661 nanosleep_needs_posix4="no"
662 AC_CHECK_FUNCS(nanosleep,
664 AC_CHECK_LIB(rt, nanosleep,
665 [nanosleep_needs_rt="yes"],
666 AC_CHECK_LIB(posix4, nanosleep,
667 [nanosleep_needs_posix4="yes"],
668 AC_MSG_ERROR(cannot find nanosleep))))
670 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
671 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
673 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
674 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
675 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
676 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
677 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
678 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
679 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
680 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
681 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
682 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
683 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
684 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
686 # Check for strptime {{{
687 if test "x$GCC" = "xyes"
689 SAVE_CFLAGS="$CFLAGS"
690 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
693 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
694 if test "x$have_strptime" = "xyes"
696 AC_CACHE_CHECK([whether strptime is exported by default],
697 [c_cv_have_strptime_default],
706 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
708 [c_cv_have_strptime_default="yes"],
709 [c_cv_have_strptime_default="no"]))
711 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
713 AC_CACHE_CHECK([whether strptime needs standards mode],
714 [c_cv_have_strptime_standards],
718 #ifndef _ISOC99_SOURCE
719 # define _ISOC99_SOURCE 1
721 #ifndef _POSIX_C_SOURCE
722 # define _POSIX_C_SOURCE 200112L
724 #ifndef _XOPEN_SOURCE
725 # define _XOPEN_SOURCE 500
732 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
734 [c_cv_have_strptime_standards="yes"],
735 [c_cv_have_strptime_standards="no"]))
737 if test "x$c_cv_have_strptime_standards" = "xyes"
739 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
745 if test "x$GCC" = "xyes"
747 CFLAGS="$SAVE_CFLAGS"
750 # }}} Check for strptime
752 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
753 if test "x$have_swapctl" = "xyes"; then
754 AC_CACHE_CHECK([whether swapctl takes two arguments],
755 [c_cv_have_swapctl_two_args],
756 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
758 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
759 # undef _FILE_OFFSET_BITS
760 # undef _LARGEFILE64_SOURCE
762 #include <sys/stat.h>
763 #include <sys/swap.h>
766 int num = swapctl(0, NULL);
769 [c_cv_have_swapctl_two_args="yes"],
770 [c_cv_have_swapctl_two_args="no"]
773 AC_CACHE_CHECK([whether swapctl takes three arguments],
774 [c_cv_have_swapctl_three_args],
778 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
779 # undef _FILE_OFFSET_BITS
780 # undef _LARGEFILE64_SOURCE
782 #include <sys/stat.h>
783 #include <sys/swap.h>
786 int num = swapctl(0, NULL, 0);
789 [c_cv_have_swapctl_three_args="yes"],
790 [c_cv_have_swapctl_three_args="no"]
794 # Check for different versions of `swapctl' here..
795 if test "x$have_swapctl" = "xyes"; then
796 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
797 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
798 [Define if the function swapctl exists and takes two arguments.])
800 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
801 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
802 [Define if the function swapctl exists and takes three arguments.])
807 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
809 if test "x$withval" = "xno"; then
811 else if test "x$withval" = "xyes"; then
818 if test "x$nan_type" = "xnone"; then
819 AC_CACHE_CHECK([whether NAN is defined by default],
820 [c_cv_have_nan_default],
826 static double foo = NAN;
834 [c_cv_have_nan_default="yes"],
835 [c_cv_have_nan_default="no"]
838 if test "x$c_cv_have_nan_default" = "xyes"
843 if test "x$nan_type" = "xnone"; then
844 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
845 [c_cv_have_nan_isoc],
850 #define __USE_ISOC99 1
852 static double foo = NAN;
860 [c_cv_have_nan_isoc="yes"],
861 [c_cv_have_nan_isoc="no"]
864 if test "x$c_cv_have_nan_isoc" = "xyes"
869 if test "x$nan_type" = "xnone"; then
870 SAVE_LDFLAGS=$LDFLAGS
871 LDFLAGS="$LDFLAGS -lm"
872 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
873 [c_cv_have_nan_zero],
882 #define NAN (0.0 / 0.0)
884 # define isnan(f) ((f) != (f))
886 static double foo = NAN;
894 [c_cv_have_nan_zero="yes"],
895 [c_cv_have_nan_zero="no"]
898 LDFLAGS=$SAVE_LDFLAGS
899 if test "x$c_cv_have_nan_zero" = "xyes"
905 if test "x$nan_type" = "xdefault"; then
906 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
907 [Define if NAN is defined by default and can initialize static variables.])
908 else if test "x$nan_type" = "xisoc99"; then
909 AC_DEFINE(NAN_STATIC_ISOC, 1,
910 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
911 else if test "x$nan_type" = "xzero"; then
912 AC_DEFINE(NAN_ZERO_ZERO, 1,
913 [Define if NAN can be defined as (0.0 / 0.0)])
915 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
918 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
920 if test "x$withval" = "xnothing"; then
921 fp_layout_type="nothing"
922 else if test "x$withval" = "xendianflip"; then
923 fp_layout_type="endianflip"
924 else if test "x$withval" = "xintswap"; then
925 fp_layout_type="intswap"
927 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
930 [fp_layout_type="unknown"])
932 if test "x$fp_layout_type" = "xunknown"; then
933 AC_CACHE_CHECK([if doubles are stored in x86 representation],
934 [c_cv_fp_layout_need_nothing],
945 # include <inttypes.h>
948 # include <stdbool.h>
958 memcpy ((void *) &i0, (void *) &d, 8);
961 memcpy ((void *) c, (void *) &i1, 8);
963 if ((c[0] == 0x2f) && (c[1] == 0x25)
964 && (c[2] == 0xc0) && (c[3] == 0xc7)
965 && (c[4] == 0x43) && (c[5] == 0x2b)
966 && (c[6] == 0x1f) && (c[7] == 0x5b))
971 [c_cv_fp_layout_need_nothing="yes"],
972 [c_cv_fp_layout_need_nothing="no"]
975 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
976 fp_layout_type="nothing"
979 if test "x$fp_layout_type" = "xunknown"; then
980 AC_CACHE_CHECK([if endianflip converts to x86 representation],
981 [c_cv_fp_layout_need_endianflip],
992 # include <inttypes.h>
995 # include <stdbool.h>
997 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
998 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
999 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1000 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
1001 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
1002 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1003 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1004 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1013 memcpy ((void *) &i0, (void *) &d, 8);
1015 i1 = endianflip (i0);
1016 memcpy ((void *) c, (void *) &i1, 8);
1018 if ((c[0] == 0x2f) && (c[1] == 0x25)
1019 && (c[2] == 0xc0) && (c[3] == 0xc7)
1020 && (c[4] == 0x43) && (c[5] == 0x2b)
1021 && (c[6] == 0x1f) && (c[7] == 0x5b))
1026 [c_cv_fp_layout_need_endianflip="yes"],
1027 [c_cv_fp_layout_need_endianflip="no"]
1030 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1031 fp_layout_type="endianflip"
1034 if test "x$fp_layout_type" = "xunknown"; then
1035 AC_CACHE_CHECK([if intswap converts to x86 representation],
1036 [c_cv_fp_layout_need_intswap],
1044 # include <stdint.h>
1047 # include <inttypes.h>
1050 # include <stdbool.h>
1052 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1053 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1062 memcpy ((void *) &i0, (void *) &d, 8);
1065 memcpy ((void *) c, (void *) &i1, 8);
1067 if ((c[0] == 0x2f) && (c[1] == 0x25)
1068 && (c[2] == 0xc0) && (c[3] == 0xc7)
1069 && (c[4] == 0x43) && (c[5] == 0x2b)
1070 && (c[6] == 0x1f) && (c[7] == 0x5b))
1075 [c_cv_fp_layout_need_intswap="yes"],
1076 [c_cv_fp_layout_need_intswap="no"]
1079 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1080 fp_layout_type="intswap"
1084 if test "x$fp_layout_type" = "xnothing"; then
1085 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1086 [Define if doubles are stored in x86 representation.])
1087 else if test "x$fp_layout_type" = "xendianflip"; then
1088 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1089 [Define if endianflip is needed to convert to x86 representation.])
1090 else if test "x$fp_layout_type" = "xintswap"; then
1091 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1092 [Define if intswap is needed to convert to x86 representation.])
1094 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1098 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1099 have_getvfsstat="no"
1100 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1101 have_listmntent="no"
1102 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1105 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1106 if test "x$have_getmntent" = "xno"; then
1107 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1109 if test "x$have_getmntent" = "xno"; then
1110 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1112 if test "x$have_getmntent" = "xno"; then
1113 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1116 if test "x$have_getmntent" = "xc"; then
1117 AC_CACHE_CHECK([whether getmntent takes one argument],
1118 [c_cv_have_one_getmntent],
1122 #include "$srcdir/src/utils_mount.h"
1127 fh = setmntent ("/etc/mtab", "r");
1128 me = getmntent (fh);
1131 [c_cv_have_one_getmntent="yes"],
1132 [c_cv_have_one_getmntent="no"]
1135 AC_CACHE_CHECK([whether getmntent takes two arguments],
1136 [c_cv_have_two_getmntent],
1140 #include "$srcdir/src/utils_mount.h"
1146 fh = fopen ("/etc/mnttab", "r");
1147 status = getmntent (fh, &mt);
1150 [c_cv_have_two_getmntent="yes"],
1151 [c_cv_have_two_getmntent="no"]
1156 # Check for different versions of `getmntent' here..
1158 if test "x$have_getmntent" = "xc"; then
1159 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1160 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1161 [Define if the function getmntent exists and takes one argument.])
1163 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1164 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1165 [Define if the function getmntent exists and takes two arguments.])
1168 if test "x$have_getmntent" = "xsun"; then
1169 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1170 [Define if the function getmntent exists. It's the version from libsun.])
1172 if test "x$have_getmntent" = "xseq"; then
1173 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1174 [Define if the function getmntent exists. It's the version from libseq.])
1176 if test "x$have_getmntent" = "xgen"; then
1177 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1178 [Define if the function getmntent exists. It's the version from libgen.])
1182 AC_MSG_CHECKING([if have htonll defined])
1187 #include <sys/types.h>
1188 #include <netinet/in.h>
1190 # include <inttypes.h>
1197 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1200 AC_MSG_RESULT([$have_htonll])
1202 # Check for structures
1203 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1204 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1207 #include <sys/types.h>
1208 #include <sys/socket.h>
1211 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1212 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1215 #include <sys/types.h>
1216 #include <sys/socket.h>
1217 #include <linux/if.h>
1218 #include <linux/netdevice.h>
1221 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1224 #include <netinet/in.h>
1228 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1230 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1231 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1232 have_struct_kinfo_proc_freebsd="yes"
1235 have_struct_kinfo_proc_freebsd="no"
1239 #include <sys/param.h>
1240 #include <sys/sysctl.h>
1241 #include <sys/user.h>
1244 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1246 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1247 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1248 have_struct_kinfo_proc_openbsd="yes"
1251 have_struct_kinfo_proc_openbsd="no"
1254 #include <sys/param.h>
1255 #include <sys/sysctl.h>
1259 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1260 [#define _BSD_SOURCE
1262 # include <stdint.h>
1264 #if HAVE_SYS_TYPES_H
1265 # include <sys/types.h>
1267 #if HAVE_NETINET_IN_SYSTM_H
1268 # include <netinet/in_systm.h>
1270 #if HAVE_NETINET_IN_H
1271 # include <netinet/in.h>
1273 #if HAVE_NETINET_IP_H
1274 # include <netinet/ip.h>
1276 #if HAVE_NETINET_UDP_H
1277 # include <netinet/udp.h>
1280 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1281 [#define _BSD_SOURCE
1283 # include <stdint.h>
1285 #if HAVE_SYS_TYPES_H
1286 # include <sys/types.h>
1288 #if HAVE_NETINET_IN_SYSTM_H
1289 # include <netinet/in_systm.h>
1291 #if HAVE_NETINET_IN_H
1292 # include <netinet/in.h>
1294 #if HAVE_NETINET_IP_H
1295 # include <netinet/ip.h>
1297 #if HAVE_NETINET_UDP_H
1298 # include <netinet/udp.h>
1302 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1312 # Checks for libraries begin here
1315 with_libresolv="yes"
1316 AC_CHECK_LIB(resolv, res_search,
1318 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1320 [with_libresolv="no"])
1321 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1323 dnl Check for HAL (hardware abstraction library)
1325 AC_CHECK_LIB(hal,libhal_device_property_exists,
1326 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1328 if test "x$with_libhal" = "xyes"; then
1329 if test "x$PKG_CONFIG" != "x"; then
1330 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1331 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1332 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1333 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1337 m4_divert_once([HELP_WITH], [
1338 collectd additional packages:])
1340 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1342 if test "x$ac_system" = "xAIX"
1347 with_perfstat="no (AIX only)"
1348 with_procinfo="no (AIX only)"
1351 if test "x$with_perfstat" = "xyes"
1353 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1354 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1356 if test "x$with_perfstat" = "xyes"
1358 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1359 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1360 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1361 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1363 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1366 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1368 # Processes plugin under AIX.
1369 if test "x$with_procinfo" = "xyes"
1371 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1373 if test "x$with_procinfo" = "xyes"
1375 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1378 if test "x$ac_system" = "xSolaris"
1383 with_kstat="no (Solaris only)"
1384 with_devinfo="no (Solaris only)"
1387 if test "x$with_kstat" = "xyes"
1389 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1391 if test "x$with_kstat" = "xyes"
1393 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1394 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1396 if test "x$with_kstat" = "xyes"
1398 AC_DEFINE(HAVE_LIBKSTAT, 1,
1399 [Define to 1 if you have the 'kstat' library (-lkstat)])
1401 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1402 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1405 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1412 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1415 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1416 if test "x$with_kvm_getprocs" = "xyes"
1418 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1419 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1422 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1424 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1425 if test "x$with_kvm_getswapinfo" = "xyes"
1427 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1428 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1431 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1433 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1434 if test "x$with_kvm_nlist" = "xyes"
1436 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1437 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1438 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1441 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1443 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1444 if test "x$with_kvm_openfiles" = "xyes"
1446 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1447 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1450 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1452 # --with-libcredis {{{
1453 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1455 if test "x$withval" = "xyes"
1457 with_libcredis="yes"
1458 else if test "x$withval" = "xno"
1462 with_libcredis="yes"
1463 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1464 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1467 [with_libcredis="yes"])
1469 SAVE_CPPFLAGS="$CPPFLAGS"
1470 SAVE_LDFLAGS="$LDFLAGS"
1472 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1473 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1475 if test "x$with_libcredis" = "xyes"
1477 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1479 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1481 AC_CHECK_HEADERS(credis.h,
1482 [with_libcredis="yes"],
1483 [with_libcredis="no (credis.h not found)"])
1485 if test "x$with_libcredis" = "xyes"
1487 if test "x$LIBCREDIS_LDFLAGS" != "x"
1489 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1491 AC_CHECK_LIB(credis, credis_info,
1492 [with_libcredis="yes"],
1493 [with_libcredis="no (symbol 'credis_info' not found)"])
1497 CPPFLAGS="$SAVE_CPPFLAGS"
1498 LDFLAGS="$SAVE_LDFLAGS"
1500 if test "x$with_libcredis" = "xyes"
1502 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1503 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1504 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1505 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1507 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1510 # --with-libcurl {{{
1511 with_curl_config="curl-config"
1514 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1516 if test "x$withval" = "xno"
1519 else if test "x$withval" = "xyes"
1523 if test -f "$withval" && test -x "$withval"
1525 with_curl_config="$withval"
1527 else if test -x "$withval/bin/curl-config"
1529 with_curl_config="$withval/bin/curl-config"
1538 if test "x$with_libcurl" = "xyes"
1540 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1541 curl_config_status=$?
1543 if test $curl_config_status -ne 0
1545 with_libcurl="no ($with_curl_config failed)"
1547 SAVE_CPPFLAGS="$CPPFLAGS"
1548 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1550 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1552 CPPFLAGS="$SAVE_CPPFLAGS"
1555 if test "x$with_libcurl" = "xyes"
1557 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1558 curl_config_status=$?
1560 if test $curl_config_status -ne 0
1562 with_libcurl="no ($with_curl_config failed)"
1564 AC_CHECK_LIB(curl, curl_easy_init,
1565 [with_libcurl="yes"],
1566 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1570 if test "x$with_libcurl" = "xyes"
1572 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1573 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1574 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1575 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1577 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1581 with_libdbi_cppflags=""
1582 with_libdbi_ldflags=""
1583 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1585 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1587 with_libdbi_cppflags="-I$withval/include"
1588 with_libdbi_ldflags="-L$withval/lib"
1591 with_libdbi="$withval"
1597 if test "x$with_libdbi" = "xyes"
1599 SAVE_CPPFLAGS="$CPPFLAGS"
1600 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1602 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1604 CPPFLAGS="$SAVE_CPPFLAGS"
1606 if test "x$with_libdbi" = "xyes"
1608 SAVE_CPPFLAGS="$CPPFLAGS"
1609 SAVE_LDFLAGS="$LDFLAGS"
1610 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1611 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1613 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1615 CPPFLAGS="$SAVE_CPPFLAGS"
1616 LDFLAGS="$SAVE_LDFLAGS"
1618 if test "x$with_libdbi" = "xyes"
1620 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1621 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1622 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1623 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1624 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1625 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1627 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1630 # --with-libesmtp {{{
1631 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1633 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1635 LDFLAGS="$LDFLAGS -L$withval/lib"
1636 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1639 with_libesmtp="$withval"
1645 if test "x$with_libesmtp" = "xyes"
1647 AC_CHECK_LIB(esmtp, smtp_create_session,
1649 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1650 ], [with_libesmtp="no (libesmtp not found)"])
1652 if test "x$with_libesmtp" = "xyes"
1654 AC_CHECK_HEADERS(libesmtp.h,
1656 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1657 ], [with_libesmtp="no (libesmtp.h not found)"])
1659 if test "x$with_libesmtp" = "xyes"
1665 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1666 [Wether or not to use the esmtp library])
1667 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1670 # --with-libganglia {{{
1671 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1673 if test -f "$withval" && test -x "$withval"
1675 with_libganglia_config="$withval"
1676 with_libganglia="yes"
1677 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1679 with_libganglia_config="$withval/bin/ganglia-config"
1680 with_libganglia="yes"
1681 else if test -d "$withval"
1683 GANGLIA_CPPFLAGS="-I$withval/include"
1684 GANGLIA_LDFLAGS="-L$withval/lib"
1685 with_libganglia="yes"
1687 with_libganglia_config="ganglia-config"
1688 with_libganglia="$withval"
1692 with_libganglia_config="ganglia-config"
1693 with_libganglia="yes"
1696 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1698 if test "x$GANGLIA_CPPFLAGS" = "x"
1700 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1703 if test "x$GANGLIA_LDFLAGS" = "x"
1705 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1708 if test "x$GANGLIA_LIBS" = "x"
1710 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1714 SAVE_CPPFLAGS="$CPPFLAGS"
1715 SAVE_LDFLAGS="$LDFLAGS"
1716 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1717 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1719 if test "x$with_libganglia" = "xyes"
1721 AC_CHECK_HEADERS(gm_protocol.h,
1723 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1724 [Define to 1 if you have the <gm_protocol.h> header file.])
1725 ], [with_libganglia="no (gm_protocol.h not found)"])
1728 if test "x$with_libganglia" = "xyes"
1730 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1732 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1733 [Define to 1 if you have the ganglia library (-lganglia).])
1734 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1737 CPPFLAGS="$SAVE_CPPFLAGS"
1738 LDFLAGS="$SAVE_LDFLAGS"
1740 AC_SUBST(GANGLIA_CPPFLAGS)
1741 AC_SUBST(GANGLIA_LDFLAGS)
1742 AC_SUBST(GANGLIA_LIBS)
1743 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1746 # --with-libgcrypt {{{
1747 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1748 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1749 GCRYPT_LIBS="$GCRYPT_LIBS"
1750 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1752 if test -f "$withval" && test -x "$withval"
1754 with_libgcrypt_config="$withval"
1755 with_libgcrypt="yes"
1756 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1758 with_libgcrypt_config="$withval/bin/gcrypt-config"
1759 with_libgcrypt="yes"
1760 else if test -d "$withval"
1762 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1763 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1764 with_libgcrypt="yes"
1766 with_libgcrypt_config="gcrypt-config"
1767 with_libgcrypt="$withval"
1771 with_libgcrypt_config="libgcrypt-config"
1772 with_libgcrypt="yes"
1775 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1777 if test "x$GCRYPT_CPPFLAGS" = "x"
1779 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1782 if test "x$GCRYPT_LDFLAGS" = "x"
1784 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1785 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1788 if test "x$GCRYPT_LIBS" = "x"
1790 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1794 SAVE_CPPFLAGS="$CPPFLAGS"
1795 SAVE_LDFLAGS="$LDFLAGS"
1796 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1797 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1799 if test "x$with_libgcrypt" = "xyes"
1801 if test "x$GCRYPT_CPPFLAGS" != "x"
1803 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1805 AC_CHECK_HEADERS(gcrypt.h,
1806 [with_libgcrypt="yes"],
1807 [with_libgcrypt="no (gcrypt.h not found)"])
1810 if test "x$with_libgcrypt" = "xyes"
1812 if test "x$GCRYPT_LDFLAGS" != "x"
1814 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1816 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1817 [with_libgcrypt="yes"],
1818 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1820 if test "$with_libgcrypt" != "no"; then
1821 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1825 CPPFLAGS="$SAVE_CPPFLAGS"
1826 LDFLAGS="$SAVE_LDFLAGS"
1828 if test "x$with_libgcrypt" = "xyes"
1830 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1833 AC_SUBST(GCRYPT_CPPFLAGS)
1834 AC_SUBST(GCRYPT_LDFLAGS)
1835 AC_SUBST(GCRYPT_LIBS)
1836 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1839 # --with-libiptc {{{
1840 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1842 if test "x$withval" = "xshipped"
1845 else if test "x$withval" = "xyes"
1847 with_libiptc="pkgconfig"
1848 else if test "x$withval" = "xno"
1853 with_libiptc_cflags="-I$withval/include"
1854 with_libiptc_libs="-L$withval/lib"
1858 if test "x$ac_system" = "xLinux"
1860 with_libiptc="pkgconfig"
1862 with_libiptc="no (Linux only)"
1866 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1868 with_libiptc="no (Don't have pkg-config)"
1871 if test "x$with_libiptc" = "xpkgconfig"
1873 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1876 with_libiptc="no (pkg-config doesn't know libiptc)"
1879 if test "x$with_libiptc" = "xpkgconfig"
1881 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1884 with_libiptc="no ($PKG_CONFIG failed)"
1886 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1889 with_libiptc="no ($PKG_CONFIG failed)"
1893 SAVE_CPPFLAGS="$CPPFLAGS"
1894 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1896 # check whether the header file for libiptc is available.
1897 if test "x$with_libiptc" = "xpkgconfig"
1899 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1900 [with_libiptc="no (header file missing)"])
1902 # If the header file is available, check for the required type declaractions.
1903 # They may be missing in old versions of libiptc. In that case, they will be
1904 # declared in the iptables plugin.
1905 if test "x$with_libiptc" = "xpkgconfig"
1907 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1909 # Check for the iptc_init symbol in the library.
1910 # This could be in iptc or ip4tc
1911 if test "x$with_libiptc" = "xpkgconfig"
1914 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1915 [with_libiptc="pkgconfig"],
1916 [with_libiptc="no"],
1917 [$with_libiptc_libs])
1920 if test "x$with_libiptc" = "xpkgconfig"
1925 CPPFLAGS="$SAVE_CPPFLAGS"
1927 if test "x$with_libiptc" = "xown"
1929 with_libiptc_cflags=""
1930 with_libiptc_libs=""
1932 if test "x$with_libiptc" = "xown"
1934 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1936 with_libiptc="no (Linux iptables headers not found)"
1939 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1942 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1943 if test "x$with_libiptc" = "xown"
1945 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1949 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1950 if test "x$with_libiptc" = "xyes"
1952 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1953 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1954 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1955 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1960 with_java_home="$JAVA_HOME"
1961 with_java_vmtype="client"
1966 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1968 if test "x$withval" = "xno"
1971 else if test "x$withval" = "xyes"
1975 with_java_home="$withval"
1980 if test "x$with_java" = "xyes"
1982 if test -d "$with_java_home"
1984 AC_MSG_CHECKING([for jni.h])
1985 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1986 if test "x$TMPDIR" != "x"
1988 AC_MSG_RESULT([found in $TMPDIR])
1989 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1991 AC_MSG_RESULT([not found])
1994 AC_MSG_CHECKING([for jni_md.h])
1995 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1996 if test "x$TMPDIR" != "x"
1998 AC_MSG_RESULT([found in $TMPDIR])
1999 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
2001 AC_MSG_RESULT([not found])
2004 AC_MSG_CHECKING([for libjvm.so])
2005 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
2006 if test "x$TMPDIR" != "x"
2008 AC_MSG_RESULT([found in $TMPDIR])
2009 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
2011 AC_MSG_RESULT([not found])
2014 if test "x$JAVAC" = "x"
2016 AC_MSG_CHECKING([for javac])
2017 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
2018 if test "x$TMPDIR" != "x"
2021 AC_MSG_RESULT([$JAVAC])
2023 AC_MSG_RESULT([not found])
2026 if test "x$JAR" = "x"
2028 AC_MSG_CHECKING([for jar])
2029 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
2030 if test "x$TMPDIR" != "x"
2033 AC_MSG_RESULT([$JAR])
2035 AC_MSG_RESULT([not found])
2038 else if test "x$with_java_home" != "x"
2040 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2044 if test "x$JAVA_CPPFLAGS" != "x"
2046 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2048 if test "x$JAVA_CFLAGS" != "x"
2050 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2052 if test "x$JAVA_LDFLAGS" != "x"
2054 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2056 if test "x$JAVAC" = "x"
2058 with_javac_path="$PATH"
2059 if test "x$with_java_home" != "x"
2061 with_javac_path="$with_java_home:with_javac_path"
2062 if test -d "$with_java_home/bin"
2064 with_javac_path="$with_java_home/bin:with_javac_path"
2068 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2070 if test "x$JAVAC" = "x"
2072 with_java="no (javac not found)"
2074 if test "x$JAR" = "x"
2076 with_jar_path="$PATH"
2077 if test "x$with_java_home" != "x"
2079 with_jar_path="$with_java_home:$with_jar_path"
2080 if test -d "$with_java_home/bin"
2082 with_jar_path="$with_java_home/bin:$with_jar_path"
2086 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2088 if test "x$JAR" = "x"
2090 with_java="no (jar not found)"
2093 SAVE_CPPFLAGS="$CPPFLAGS"
2094 SAVE_CFLAGS="$CFLAGS"
2095 SAVE_LDFLAGS="$LDFLAGS"
2096 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2097 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2098 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2100 if test "x$with_java" = "xyes"
2102 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2104 if test "x$with_java" = "xyes"
2106 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2108 [with_java="no (libjvm not found)"],
2111 if test "x$with_java" = "xyes"
2113 JAVA_LIBS="$JAVA_LIBS -ljvm"
2114 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2117 CPPFLAGS="$SAVE_CPPFLAGS"
2118 CFLAGS="$SAVE_CFLAGS"
2119 LDFLAGS="$SAVE_LDFLAGS"
2121 AC_SUBST(JAVA_CPPFLAGS)
2122 AC_SUBST(JAVA_CFLAGS)
2123 AC_SUBST(JAVA_LDFLAGS)
2125 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2128 # --with-libmemcached {{{
2129 with_libmemcached_cppflags=""
2130 with_libmemcached_ldflags=""
2131 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2133 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2135 with_libmemcached_cppflags="-I$withval/include"
2136 with_libmemcached_ldflags="-L$withval/lib"
2137 with_libmemcached="yes"
2139 with_libmemcached="$withval"
2143 with_libmemcached="yes"
2145 if test "x$with_libmemcached" = "xyes"
2147 SAVE_CPPFLAGS="$CPPFLAGS"
2148 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2150 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2152 CPPFLAGS="$SAVE_CPPFLAGS"
2154 if test "x$with_libmemcached" = "xyes"
2156 SAVE_CPPFLAGS="$CPPFLAGS"
2157 SAVE_LDFLAGS="$LDFLAGS"
2158 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2159 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2161 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2163 CPPFLAGS="$SAVE_CPPFLAGS"
2164 LDFLAGS="$SAVE_LDFLAGS"
2166 if test "x$with_libmemcached" = "xyes"
2168 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2169 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2170 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2171 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2172 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2173 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2174 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2176 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2179 # --with-libmodbus {{{
2180 with_libmodbus_config=""
2181 with_libmodbus_cflags=""
2182 with_libmodbus_libs=""
2183 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2185 if test "x$withval" = "xno"
2188 else if test "x$withval" = "xyes"
2190 with_libmodbus="use_pkgconfig"
2191 else if test -d "$with_libmodbus/lib"
2193 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2194 with_libmodbus_cflags="-I$withval/include"
2195 with_libmodbus_libs="-L$withval/lib -lmodbus"
2196 with_libmodbus="yes"
2199 [with_libmodbus="use_pkgconfig"])
2201 # configure using pkg-config
2202 if test "x$with_libmodbus" = "xuse_pkgconfig"
2204 if test "x$PKG_CONFIG" = "x"
2206 with_libmodbus="no (Don't have pkg-config)"
2209 if test "x$with_libmodbus" = "xuse_pkgconfig"
2211 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2212 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2215 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2218 if test "x$with_libmodbus" = "xuse_pkgconfig"
2220 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2223 with_libmodbus="no ($PKG_CONFIG failed)"
2225 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2228 with_libmodbus="no ($PKG_CONFIG failed)"
2231 if test "x$with_libmodbus" = "xuse_pkgconfig"
2233 with_libmodbus="yes"
2236 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2237 # the actual checks.
2238 if test "x$with_libmodbus" = "xyes"
2240 SAVE_CPPFLAGS="$CPPFLAGS"
2241 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2243 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2245 CPPFLAGS="$SAVE_CPPFLAGS"
2247 if test "x$with_libmodbus" = "xyes"
2249 SAVE_CPPFLAGS="$CPPFLAGS"
2250 SAVE_LDFLAGS="$LDFLAGS"
2252 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2253 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2255 AC_CHECK_LIB(modbus, modbus_connect,
2256 [with_libmodbus="yes"],
2257 [with_libmodbus="no (symbol modbus_connect not found)"])
2259 CPPFLAGS="$SAVE_CPPFLAGS"
2260 LDFLAGS="$SAVE_LDFLAGS"
2262 if test "x$with_libmodbus" = "xyes"
2264 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2265 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2266 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2267 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2271 # --with-libmongoc {{{
2272 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2274 if test "x$withval" = "xyes"
2276 with_libmongoc="yes"
2277 else if test "x$withval" = "xno"
2281 with_libmongoc="yes"
2282 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2283 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2286 [with_libmongoc="yes"])
2288 SAVE_CPPFLAGS="$CPPFLAGS"
2289 SAVE_LDFLAGS="$LDFLAGS"
2291 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2292 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2294 if test "x$with_libmongoc" = "xyes"
2296 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2298 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2300 AC_CHECK_HEADERS(mongo.h,
2301 [with_libmongoc="yes"],
2302 [with_libmongoc="no ('mongo.h' not found)"],
2304 # define MONGO_HAVE_STDINT 1
2306 # define MONGO_USE_LONG_LONG_INT 1
2310 if test "x$with_libmongoc" = "xyes"
2312 if test "x$LIBMONGOC_LDFLAGS" != "x"
2314 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2316 AC_CHECK_LIB(mongoc, mongo_run_command,
2317 [with_libmongoc="yes"],
2318 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2321 CPPFLAGS="$SAVE_CPPFLAGS"
2322 LDFLAGS="$SAVE_LDFLAGS"
2324 if test "x$with_libmongoc" = "xyes"
2326 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2327 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2328 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2329 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2331 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2334 # --with-libmysql {{{
2335 with_mysql_config="mysql_config"
2336 with_mysql_cflags=""
2338 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2340 if test "x$withval" = "xno"
2343 else if test "x$withval" = "xyes"
2347 if test -f "$withval" && test -x "$withval";
2349 with_mysql_config="$withval"
2350 else if test -x "$withval/bin/mysql_config"
2352 with_mysql_config="$withval/bin/mysql_config"
2360 if test "x$with_libmysql" = "xyes"
2362 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2363 mysql_config_status=$?
2365 if test $mysql_config_status -ne 0
2367 with_libmysql="no ($with_mysql_config failed)"
2369 SAVE_CPPFLAGS="$CPPFLAGS"
2370 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2373 have_mysql_mysql_h="no"
2374 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2376 if test "x$have_mysql_h" = "xno"
2378 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2381 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2383 with_libmysql="no (mysql.h not found)"
2386 CPPFLAGS="$SAVE_CPPFLAGS"
2389 if test "x$with_libmysql" = "xyes"
2391 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2392 mysql_config_status=$?
2394 if test $mysql_config_status -ne 0
2396 with_libmysql="no ($with_mysql_config failed)"
2398 AC_CHECK_LIB(mysqlclient, mysql_init,
2399 [with_libmysql="yes"],
2400 [with_libmysql="no (symbol 'mysql_init' not found)"],
2403 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2404 [with_libmysql="yes"],
2405 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2409 if test "x$with_libmysql" = "xyes"
2411 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2412 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2413 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2414 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2416 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2419 # --with-libnetlink {{{
2420 with_libnetlink_cflags=""
2421 with_libnetlink_libs="-lnetlink"
2422 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2424 echo "libnetlink: withval = $withval"
2425 if test "x$withval" = "xyes"
2427 with_libnetlink="yes"
2428 else if test "x$withval" = "xno"
2430 with_libnetlink="no"
2432 if test -d "$withval/include"
2434 with_libnetlink_cflags="-I$withval/include"
2435 with_libnetlink_libs="-L$withval/lib -lnetlink"
2436 with_libnetlink="yes"
2438 AC_MSG_ERROR("no such directory: $withval/include")
2443 if test "x$ac_system" = "xLinux"
2445 with_libnetlink="yes"
2447 with_libnetlink="no (Linux only library)"
2450 if test "x$with_libnetlink" = "xyes"
2452 SAVE_CFLAGS="$CFLAGS"
2453 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2455 with_libnetlink="no (libnetlink.h not found)"
2457 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2459 with_libnetlink="yes"
2463 #include <sys/types.h>
2464 #include <asm/types.h>
2465 #include <sys/socket.h>
2466 #include <linux/netlink.h>
2467 #include <linux/rtnetlink.h>])
2468 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2470 #include <sys/types.h>
2471 #include <asm/types.h>
2472 #include <sys/socket.h>])
2474 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2477 #include <sys/types.h>
2478 #include <asm/types.h>
2479 #include <sys/socket.h>
2480 #include <linux/netlink.h>
2481 #include <linux/rtnetlink.h>
2484 int retval = TCA_STATS2;
2488 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2490 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2493 #include <sys/types.h>
2494 #include <asm/types.h>
2495 #include <sys/socket.h>
2496 #include <linux/netlink.h>
2497 #include <linux/rtnetlink.h>
2500 int retval = TCA_STATS;
2504 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2506 CFLAGS="$SAVE_CFLAGS"
2508 if test "x$with_libnetlink" = "xyes"
2510 AC_CHECK_LIB(netlink, rtnl_open,
2511 [with_libnetlink="yes"],
2512 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2513 [$with_libnetlink_libs])
2515 if test "x$with_libnetlink" = "xyes"
2517 SAVE_CFLAGS="$CFLAGS"
2518 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2521 [if function 'rtnl_dump_filter' expects five arguments],
2522 [c_cv_rtnl_dump_filter_five_args],
2523 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2526 #include <sys/types.h>
2527 #include <asm/types.h>
2528 #include <sys/socket.h>
2529 #if HAVE_LIBNETLINK_H
2530 # include <libnetlink.h>
2531 #elif HAVE_IPROUTE_LIBNETLINK_H
2532 # include <iproute/libnetlink.h>
2533 #elif HAVE_LINUX_LIBNETLINK_H
2534 # include <linux/libnetlink.h>
2538 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2543 [c_cv_rtnl_dump_filter_five_args="yes"],
2544 [c_cv_rtnl_dump_filter_five_args="no"]
2549 [if function 'rtnl_dump_filter' expects three arguments],
2550 [c_cv_rtnl_dump_filter_three_args],
2551 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2554 #include <sys/types.h>
2555 #include <asm/types.h>
2556 #include <sys/socket.h>
2557 #if HAVE_LIBNETLINK_H
2558 # include <libnetlink.h>
2559 #elif HAVE_IPROUTE_LIBNETLINK_H
2560 # include <iproute/libnetlink.h>
2561 #elif HAVE_LINUX_LIBNETLINK_H
2562 # include <linux/libnetlink.h>
2566 if (rtnl_dump_filter(NULL, NULL, NULL))
2571 [c_cv_rtnl_dump_filter_three_args="yes"],
2572 [c_cv_rtnl_dump_filter_three_args="no"]
2576 CFLAGS="$SAVE_CFLAGS"
2578 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2580 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2581 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2583 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2585 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2586 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2589 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2590 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2591 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2592 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2594 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2597 # --with-libnetapp {{{
2598 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2599 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2600 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2601 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2602 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2603 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2604 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2606 if test -d "$withval"
2608 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2609 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2610 with_libnetapp="yes"
2612 with_libnetapp="$withval"
2616 with_libnetapp="yes"
2619 SAVE_CPPFLAGS="$CPPFLAGS"
2620 SAVE_LDFLAGS="$LDFLAGS"
2621 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2622 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2624 if test "x$with_libnetapp" = "xyes"
2626 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2628 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2630 AC_CHECK_HEADERS(netapp_api.h,
2631 [with_libnetapp="yes"],
2632 [with_libnetapp="no (netapp_api.h not found)"])
2635 if test "x$with_libnetapp" = "xyes"
2637 if test "x$LIBNETAPP_LDFLAGS" != "x"
2639 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2642 if test "x$LIBNETAPP_LIBS" = "x"
2644 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2646 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2648 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2649 [with_libnetapp="yes"],
2650 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2652 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2655 CPPFLAGS="$SAVE_CPPFLAGS"
2656 LDFLAGS="$SAVE_LDFLAGS"
2658 if test "x$with_libnetapp" = "xyes"
2660 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2663 AC_SUBST(LIBNETAPP_CPPFLAGS)
2664 AC_SUBST(LIBNETAPP_LDFLAGS)
2665 AC_SUBST(LIBNETAPP_LIBS)
2666 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2669 # --with-libnetsnmp {{{
2670 with_snmp_config="net-snmp-config"
2673 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2675 if test "x$withval" = "xno"
2677 with_libnetsnmp="no"
2678 else if test "x$withval" = "xyes"
2680 with_libnetsnmp="yes"
2682 if test -x "$withval"
2684 with_snmp_config="$withval"
2685 with_libnetsnmp="yes"
2687 with_snmp_config="$withval/bin/net-snmp-config"
2688 with_libnetsnmp="yes"
2692 [with_libnetsnmp="yes"])
2693 if test "x$with_libnetsnmp" = "xyes"
2695 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2696 snmp_config_status=$?
2698 if test $snmp_config_status -ne 0
2700 with_libnetsnmp="no ($with_snmp_config failed)"
2702 SAVE_CPPFLAGS="$CPPFLAGS"
2703 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2705 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2707 CPPFLAGS="$SAVE_CPPFLAGS"
2710 if test "x$with_libnetsnmp" = "xyes"
2712 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2713 snmp_config_status=$?
2715 if test $snmp_config_status -ne 0
2717 with_libnetsnmp="no ($with_snmp_config failed)"
2719 AC_CHECK_LIB(netsnmp, init_snmp,
2720 [with_libnetsnmp="yes"],
2721 [with_libnetsnmp="no (libnetsnmp not found)"],
2725 if test "x$with_libnetsnmp" = "xyes"
2727 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2728 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2729 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2730 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2732 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2735 # --with-liboconfig {{{
2736 with_own_liboconfig="no"
2737 liboconfig_LDFLAGS="$LDFLAGS"
2738 liboconfig_CPPFLAGS="$CPPFLAGS"
2739 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2741 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2743 if test -d "$withval/lib"
2745 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2747 if test -d "$withval/include"
2749 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2752 if test "x$withval" = "xno"
2754 AC_MSG_ERROR("liboconfig is required")
2758 with_liboconfig="yes"
2761 save_LDFLAGS="$LDFLAGS"
2762 save_CPPFLAGS="$CPPFLAGS"
2763 LDFLAGS="$liboconfig_LDFLAGS"
2764 CPPFLAGS="$liboconfig_CPPFLAGS"
2765 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2767 with_liboconfig="yes"
2768 with_own_liboconfig="no"
2771 with_liboconfig="yes"
2772 with_own_liboconfig="yes"
2773 LDFLAGS="$save_LDFLAGS"
2774 CPPFLAGS="$save_CPPFLAGS"
2777 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2778 if test "x$with_own_liboconfig" = "xyes"
2780 with_liboconfig="yes (shipped version)"
2784 # --with-liboping {{{
2785 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2787 if test "x$withval" = "xyes"
2790 else if test "x$withval" = "xno"
2795 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2796 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2799 [with_liboping="yes"])
2801 SAVE_CPPFLAGS="$CPPFLAGS"
2802 SAVE_LDFLAGS="$LDFLAGS"
2804 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2805 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2807 if test "x$with_liboping" = "xyes"
2809 if test "x$LIBOPING_CPPFLAGS" != "x"
2811 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2813 AC_CHECK_HEADERS(oping.h,
2814 [with_liboping="yes"],
2815 [with_liboping="no (oping.h not found)"])
2817 if test "x$with_liboping" = "xyes"
2819 if test "x$LIBOPING_LDFLAGS" != "x"
2821 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2823 AC_CHECK_LIB(oping, ping_construct,
2824 [with_liboping="yes"],
2825 [with_liboping="no (symbol 'ping_construct' not found)"])
2828 CPPFLAGS="$SAVE_CPPFLAGS"
2829 LDFLAGS="$SAVE_LDFLAGS"
2831 if test "x$with_liboping" = "xyes"
2833 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2834 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2835 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2836 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2838 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2842 with_oracle_cppflags=""
2844 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2846 if test "x$withval" = "xyes"
2848 if test "x$ORACLE_HOME" = "x"
2850 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2853 else if test "x$withval" = "xno"
2858 ORACLE_HOME="$withval"
2862 if test "x$ORACLE_HOME" = "x"
2864 with_oracle="no (ORACLE_HOME is not set)"
2869 if test "x$ORACLE_HOME" != "x"
2871 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2873 if test -e "$ORACLE_HOME/lib/ldflags"
2875 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2877 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2878 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2880 if test "x$with_oracle" = "xyes"
2882 SAVE_CPPFLAGS="$CPPFLAGS"
2883 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2885 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2887 CPPFLAGS="$SAVE_CPPFLAGS"
2889 if test "x$with_oracle" = "xyes"
2891 SAVE_CPPFLAGS="$CPPFLAGS"
2892 SAVE_LDFLAGS="$LDFLAGS"
2893 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2894 LDFLAGS="$LDFLAGS $with_oracle_libs"
2896 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2898 CPPFLAGS="$SAVE_CPPFLAGS"
2899 LDFLAGS="$SAVE_LDFLAGS"
2901 if test "x$with_oracle" = "xyes"
2903 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2904 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2905 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2906 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2910 # --with-libowcapi {{{
2911 with_libowcapi_cppflags=""
2912 with_libowcapi_libs="-lowcapi"
2913 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2915 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2917 with_libowcapi_cppflags="-I$withval/include"
2918 with_libowcapi_libs="-L$withval/lib -lowcapi"
2919 with_libowcapi="yes"
2921 with_libowcapi="$withval"
2925 with_libowcapi="yes"
2927 if test "x$with_libowcapi" = "xyes"
2929 SAVE_CPPFLAGS="$CPPFLAGS"
2930 CPPFLAGS="$with_libowcapi_cppflags"
2932 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2934 CPPFLAGS="$SAVE_CPPFLAGS"
2936 if test "x$with_libowcapi" = "xyes"
2938 SAVE_LDFLAGS="$LDFLAGS"
2939 SAVE_CPPFLAGS="$CPPFLAGS"
2940 LDFLAGS="$with_libowcapi_libs"
2941 CPPFLAGS="$with_libowcapi_cppflags"
2943 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2945 LDFLAGS="$SAVE_LDFLAGS"
2946 CPPFLAGS="$SAVE_CPPFLAGS"
2948 if test "x$with_libowcapi" = "xyes"
2950 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2951 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2952 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2953 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2957 # --with-libpcap {{{
2958 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2960 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2962 LDFLAGS="$LDFLAGS -L$withval/lib"
2963 CPPFLAGS="$CPPFLAGS -I$withval/include"
2966 with_libpcap="$withval"
2972 if test "x$with_libpcap" = "xyes"
2974 AC_CHECK_LIB(pcap, pcap_open_live,
2976 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2977 ], [with_libpcap="no (libpcap not found)"])
2979 if test "x$with_libpcap" = "xyes"
2981 AC_CHECK_HEADERS(pcap.h,,
2982 [with_libpcap="no (pcap.h not found)"])
2984 if test "x$with_libpcap" = "xyes"
2986 AC_CHECK_HEADERS(pcap-bpf.h,,
2987 [with_libpcap="no (pcap-bpf.h not found)"])
2989 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2992 # --with-libperl {{{
2993 perl_interpreter="perl"
2994 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2996 if test -f "$withval" && test -x "$withval"
2998 perl_interpreter="$withval"
3000 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3002 LDFLAGS="$LDFLAGS -L$withval/lib"
3003 CPPFLAGS="$CPPFLAGS -I$withval/include"
3004 perl_interpreter="$withval/bin/perl"
3007 with_libperl="$withval"
3014 AC_MSG_CHECKING([for perl])
3015 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3016 if test -x "$perl_interpreter"
3018 AC_MSG_RESULT([yes ($perl_interpreter)])
3024 AC_SUBST(PERL, "$perl_interpreter")
3026 if test "x$with_libperl" = "xyes" \
3027 && test -n "$perl_interpreter"
3029 SAVE_CFLAGS="$CFLAGS"
3030 SAVE_LDFLAGS="$LDFLAGS"
3031 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3032 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3033 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3034 CFLAGS="$CFLAGS $PERL_CFLAGS"
3035 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3037 AC_CACHE_CHECK([for libperl],
3038 [c_cv_have_libperl],
3042 #define PERL_NO_GET_CONTEXT
3049 load_module (PERL_LOADMOD_NOIMPORT,
3050 newSVpv ("Collectd::Plugin::FooBar", 24),
3053 [c_cv_have_libperl="yes"],
3054 [c_cv_have_libperl="no"]
3058 if test "x$c_cv_have_libperl" = "xyes"
3060 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3061 AC_SUBST(PERL_CFLAGS)
3062 AC_SUBST(PERL_LDFLAGS)
3067 CFLAGS="$SAVE_CFLAGS"
3068 LDFLAGS="$SAVE_LDFLAGS"
3069 else if test -z "$perl_interpreter"; then
3070 with_libperl="no (no perl interpreter found)"
3071 c_cv_have_libperl="no"
3073 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3075 if test "x$with_libperl" = "xyes"
3077 SAVE_CFLAGS="$CFLAGS"
3078 SAVE_LDFLAGS="$LDFLAGS"
3079 CFLAGS="$CFLAGS $PERL_CFLAGS"
3080 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3082 AC_CACHE_CHECK([if perl supports ithreads],
3083 [c_cv_have_perl_ithreads],
3091 #if !defined(USE_ITHREADS)
3092 # error "Perl does not support ithreads!"
3093 #endif /* !defined(USE_ITHREADS) */
3096 [c_cv_have_perl_ithreads="yes"],
3097 [c_cv_have_perl_ithreads="no"]
3101 if test "x$c_cv_have_perl_ithreads" = "xyes"
3103 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3106 CFLAGS="$SAVE_CFLAGS"
3107 LDFLAGS="$SAVE_LDFLAGS"
3110 if test "x$with_libperl" = "xyes"
3112 SAVE_CFLAGS="$CFLAGS"
3113 SAVE_LDFLAGS="$LDFLAGS"
3114 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3115 # (see issues #41 and #42)
3116 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3117 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3119 AC_CACHE_CHECK([for broken Perl_load_module()],
3120 [c_cv_have_broken_perl_load_module],
3124 #define PERL_NO_GET_CONTEXT
3131 load_module (PERL_LOADMOD_NOIMPORT,
3132 newSVpv ("Collectd::Plugin::FooBar", 24),
3135 [c_cv_have_broken_perl_load_module="no"],
3136 [c_cv_have_broken_perl_load_module="yes"]
3140 CFLAGS="$SAVE_CFLAGS"
3141 LDFLAGS="$SAVE_LDFLAGS"
3143 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3144 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3146 if test "x$with_libperl" = "xyes"
3148 SAVE_CFLAGS="$CFLAGS"
3149 SAVE_LDFLAGS="$LDFLAGS"
3150 CFLAGS="$CFLAGS $PERL_CFLAGS"
3151 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3154 [struct mgvtbl.svt_local],
3155 [have_struct_mgvtbl_svt_local="yes"],
3156 [have_struct_mgvtbl_svt_local="no"],
3163 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3165 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3166 [Define if Perl's struct mgvtbl has member svt_local.])
3169 CFLAGS="$SAVE_CFLAGS"
3170 LDFLAGS="$SAVE_LDFLAGS"
3175 with_pg_config="pg_config"
3176 with_libpq_includedir=""
3177 with_libpq_libdir=""
3178 with_libpq_cppflags=""
3179 with_libpq_ldflags=""
3180 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3183 if test "x$withval" = "xno"
3186 else if test "x$withval" = "xyes"
3190 if test -f "$withval" && test -x "$withval";
3192 with_pg_config="$withval"
3193 else if test -x "$withval/bin/pg_config"
3195 with_pg_config="$withval/bin/pg_config"
3203 if test "x$with_libpq" = "xyes"
3205 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3208 if test $pg_config_status -eq 0
3210 if test -n "$with_libpq_includedir"; then
3211 for dir in $with_libpq_includedir; do
3212 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3216 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3219 SAVE_CPPFLAGS="$CPPFLAGS"
3220 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3222 AC_CHECK_HEADERS(libpq-fe.h, [],
3223 [with_libpq="no (libpq-fe.h not found)"], [])
3225 CPPFLAGS="$SAVE_CPPFLAGS"
3227 if test "x$with_libpq" = "xyes"
3229 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3232 if test $pg_config_status -eq 0
3234 if test -n "$with_libpq_libdir"; then
3235 for dir in $with_libpq_libdir; do
3236 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3240 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3243 SAVE_LDFLAGS="$LDFLAGS"
3244 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3246 AC_CHECK_LIB(pq, PQconnectdb,
3248 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3250 AC_CHECK_LIB(pq, PQserverVersion,
3252 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3254 LDFLAGS="$SAVE_LDFLAGS"
3256 if test "x$with_libpq" = "xyes"
3258 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3259 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3260 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3261 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3263 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3266 # --with-libpthread {{{
3267 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3268 [ if test "x$withval" != "xno" \
3269 && test "x$withval" != "xyes"
3271 LDFLAGS="$LDFLAGS -L$withval/lib"
3272 CPPFLAGS="$CPPFLAGS -I$withval/include"
3273 with_libpthread="yes"
3275 if test "x$withval" = "xno"
3277 with_libpthread="no (disabled)"
3280 ], [with_libpthread="yes"])
3281 if test "x$with_libpthread" = "xyes"
3283 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3286 if test "x$with_libpthread" = "xyes"
3288 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3290 if test "x$with_libpthread" = "xyes"
3296 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3297 [Wether or not to use pthread (POSIX threads) library])
3298 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3303 with_python_path="$PATH"
3304 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3306 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3308 with_python="$withval"
3309 else if test -x "$withval"
3311 with_python_prog="$withval"
3312 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3314 else if test -d "$withval"
3316 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3319 AC_MSG_WARN([Argument not recognized: $withval])
3321 ], [with_python="yes"])
3324 SAVE_CPPFLAGS="$CPPFLAGS"
3325 SAVE_LDFLAGS="$LDFLAGS"
3328 PATH="$with_python_path"
3330 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3332 AC_MSG_CHECKING([for python])
3333 with_python_prog="`which python 2>/dev/null`"
3334 if test "x$with_python_prog" = "x"
3336 AC_MSG_RESULT([not found])
3337 with_python="no (interpreter not found)"
3339 AC_MSG_RESULT([$with_python_prog])
3343 if test "x$with_python" = "xyes"
3345 AC_MSG_CHECKING([for Python CPPFLAGS])
3346 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3347 python_config_status=$?
3349 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3351 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3354 AC_MSG_RESULT([$python_include_path])
3358 if test "x$with_python" = "xyes"
3360 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3361 AC_CHECK_HEADERS(Python.h,
3362 [with_python="yes"],
3363 [with_python="no ('Python.h' not found)"])
3366 if test "x$with_python" = "xyes"
3368 AC_MSG_CHECKING([for Python LDFLAGS])
3369 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`
3370 python_config_status=$?
3372 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3374 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3377 AC_MSG_RESULT([$python_library_path])
3381 if test "x$with_python" = "xyes"
3383 AC_MSG_CHECKING([for Python LIBS])
3384 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`
3385 python_config_status=$?
3387 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3389 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3392 AC_MSG_RESULT([$python_library_flags])
3396 if test "x$with_python" = "xyes"
3398 LDFLAGS="-L$python_library_path $LDFLAGS"
3399 LIBS="$python_library_flags $LIBS"
3401 AC_CHECK_FUNC(PyObject_CallFunction,
3402 [with_python="yes"],
3403 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3407 CPPFLAGS="$SAVE_CPPFLAGS"
3408 LDFLAGS="$SAVE_LDFLAGS"
3411 if test "x$with_python" = "xyes"
3413 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3414 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3415 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3416 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3417 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3418 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3422 # --with-librabbitmq {{{
3423 with_librabbitmq_cppflags=""
3424 with_librabbitmq_ldflags=""
3425 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3427 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3429 with_librabbitmq_cppflags="-I$withval/include"
3430 with_librabbitmq_ldflags="-L$withval/lib"
3431 with_librabbitmq="yes"
3433 with_librabbitmq="$withval"
3437 with_librabbitmq="yes"
3439 SAVE_CPPFLAGS="$CPPFLAGS"
3440 SAVE_LDFLAGS="$LDFLAGS"
3441 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3442 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3443 if test "x$with_librabbitmq" = "xyes"
3445 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3447 if test "x$with_librabbitmq" = "xyes"
3449 # librabbitmq up to version 0.9.1 provides "library_errno", later
3450 # versions use "library_error". The library does not provide a version
3451 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3452 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3455 # include <stdlib.h>
3461 # include <stdint.h>
3464 # include <inttypes.h>
3469 if test "x$with_librabbitmq" = "xyes"
3471 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3473 if test "x$with_librabbitmq" = "xyes"
3475 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3476 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3477 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3478 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3479 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3480 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3481 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3483 CPPFLAGS="$SAVE_CPPFLAGS"
3484 LDFLAGS="$SAVE_LDFLAGS"
3485 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3488 # --with-librouteros {{{
3489 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3491 if test "x$withval" = "xyes"
3493 with_librouteros="yes"
3494 else if test "x$withval" = "xno"
3496 with_librouteros="no"
3498 with_librouteros="yes"
3499 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3500 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3503 [with_librouteros="yes"])
3505 SAVE_CPPFLAGS="$CPPFLAGS"
3506 SAVE_LDFLAGS="$LDFLAGS"
3508 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3509 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3511 if test "x$with_librouteros" = "xyes"
3513 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3515 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3517 AC_CHECK_HEADERS(routeros_api.h,
3518 [with_librouteros="yes"],
3519 [with_librouteros="no (routeros_api.h not found)"])
3521 if test "x$with_librouteros" = "xyes"
3523 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3525 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3527 AC_CHECK_LIB(routeros, ros_interface,
3528 [with_librouteros="yes"],
3529 [with_librouteros="no (symbol 'ros_interface' not found)"])
3532 CPPFLAGS="$SAVE_CPPFLAGS"
3533 LDFLAGS="$SAVE_LDFLAGS"
3535 if test "x$with_librouteros" = "xyes"
3537 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3538 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3539 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3540 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3542 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3546 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3549 librrd_threadsafe="yes"
3550 librrd_rrdc_update="no"
3551 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3552 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3554 librrd_cflags="-I$withval/include"
3555 librrd_ldflags="-L$withval/lib"
3558 with_librrd="$withval"
3560 ], [with_librrd="yes"])
3561 if test "x$with_librrd" = "xyes"
3563 SAVE_CPPFLAGS="$CPPFLAGS"
3564 SAVE_LDFLAGS="$LDFLAGS"
3566 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3567 LDFLAGS="$LDFLAGS $librrd_ldflags"
3569 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3571 CPPFLAGS="$SAVE_CPPFLAGS"
3572 LDFLAGS="$SAVE_LDFLAGS"
3574 if test "x$with_librrd" = "xyes"
3576 SAVE_CPPFLAGS="$CPPFLAGS"
3577 SAVE_LDFLAGS="$LDFLAGS"
3579 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3580 LDFLAGS="$LDFLAGS $librrd_ldflags"
3582 AC_CHECK_LIB(rrd_th, rrd_update_r,
3584 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3586 [librrd_threadsafe="no"
3587 AC_CHECK_LIB(rrd, rrd_update,
3589 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3591 [with_librrd="no (symbol 'rrd_update' not found)"],
3596 if test "x$librrd_threadsafe" = "xyes"
3598 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3600 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3603 CPPFLAGS="$SAVE_CPPFLAGS"
3604 LDFLAGS="$SAVE_LDFLAGS"
3606 if test "x$with_librrd" = "xyes"
3608 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3609 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3610 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3611 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3613 if test "x$librrd_threadsafe" = "xyes"
3615 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3619 # --with-libsensors {{{
3620 with_sensors_cflags=""
3621 with_sensors_ldflags=""
3622 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3624 if test "x$withval" = "xno"
3626 with_libsensors="no"
3628 with_libsensors="yes"
3629 if test "x$withval" != "xyes"
3631 with_sensors_cflags="-I$withval/include"
3632 with_sensors_ldflags="-L$withval/lib"
3633 with_libsensors="yes"
3638 if test "x$ac_system" = "xLinux"
3640 with_libsensors="yes"
3642 with_libsensors="no (Linux only library)"
3645 if test "x$with_libsensors" = "xyes"
3647 SAVE_CPPFLAGS="$CPPFLAGS"
3648 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3650 # AC_CHECK_HEADERS(sensors/sensors.h,
3652 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3654 # [with_libsensors="no (sensors/sensors.h not found)"])
3655 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3657 CPPFLAGS="$SAVE_CPPFLAGS"
3659 if test "x$with_libsensors" = "xyes"
3661 SAVE_CPPFLAGS="$CPPFLAGS"
3662 SAVE_LDFLAGS="$LDFLAGS"
3663 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3664 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3666 AC_CHECK_LIB(sensors, sensors_init,
3668 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3670 [with_libsensors="no (libsensors not found)"])
3672 CPPFLAGS="$SAVE_CPPFLAGS"
3673 LDFLAGS="$SAVE_LDFLAGS"
3675 if test "x$with_libsensors" = "xyes"
3677 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3678 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3679 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3680 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3682 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3685 # --with-libstatgrab {{{
3686 with_libstatgrab_cflags=""
3687 with_libstatgrab_ldflags=""
3688 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3690 if test "x$withval" != "xno" \
3691 && test "x$withval" != "xyes"
3693 with_libstatgrab_cflags="-I$withval/include"
3694 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3695 with_libstatgrab="yes"
3696 with_libstatgrab_pkg_config="no"
3698 with_libstatgrab="$withval"
3699 with_libstatgrab_pkg_config="yes"
3703 with_libstatgrab="yes"
3704 with_libstatgrab_pkg_config="yes"
3707 if test "x$with_libstatgrab" = "xyes" \
3708 && test "x$with_libstatgrab_pkg_config" = "xyes"
3710 if test "x$PKG_CONFIG" != "x"
3712 AC_MSG_CHECKING([pkg-config for libstatgrab])
3714 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3717 with_libstatgrab_pkg_config="no"
3718 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3719 temp_result="not found"
3721 AC_MSG_RESULT([$temp_result])
3723 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3724 with_libstatgrab_pkg_config="no"
3725 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3729 if test "x$with_libstatgrab" = "xyes" \
3730 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3731 && test "x$with_libstatgrab_cflags" = "x"
3733 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3734 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3737 with_libstatgrab_cflags="$temp_result"
3739 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3740 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3742 AC_MSG_RESULT([$temp_result])
3745 if test "x$with_libstatgrab" = "xyes" \
3746 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3747 && test "x$with_libstatgrab_ldflags" = "x"
3749 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3750 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3753 with_libstatgrab_ldflags="$temp_result"
3755 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3756 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3758 AC_MSG_RESULT([$temp_result])
3761 if test "x$with_libstatgrab" = "xyes"
3763 SAVE_CPPFLAGS="$CPPFLAGS"
3764 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3766 AC_CHECK_HEADERS(statgrab.h,
3767 [with_libstatgrab="yes"],
3768 [with_libstatgrab="no (statgrab.h not found)"])
3770 CPPFLAGS="$SAVE_CPPFLAGS"
3773 if test "x$with_libstatgrab" = "xyes"
3775 SAVE_CFLAGS="$CFLAGS"
3776 SAVE_LDFLAGS="$LDFLAGS"
3778 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3779 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3781 AC_CHECK_LIB(statgrab, sg_init,
3782 [with_libstatgrab="yes"],
3783 [with_libstatgrab="no (symbol sg_init not found)"])
3785 CFLAGS="$SAVE_CFLAGS"
3786 LDFLAGS="$SAVE_LDFLAGS"
3789 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3790 if test "x$with_libstatgrab" = "xyes"
3792 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3793 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3794 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3795 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3796 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3800 # --with-libtokyotyrant {{{
3801 with_libtokyotyrant_cppflags=""
3802 with_libtokyotyrant_ldflags=""
3803 with_libtokyotyrant_libs=""
3804 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3806 if test "x$withval" = "xno"
3808 with_libtokyotyrant="no"
3809 else if test "x$withval" = "xyes"
3811 with_libtokyotyrant="yes"
3813 with_libtokyotyrant_cppflags="-I$withval/include"
3814 with_libtokyotyrant_ldflags="-L$withval/include"
3815 with_libtokyotyrant_libs="-ltokyotyrant"
3816 with_libtokyotyrant="yes"
3820 with_libtokyotyrant="yes"
3823 if test "x$with_libtokyotyrant" = "xyes"
3825 if $PKG_CONFIG --exists tokyotyrant
3827 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3828 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3829 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3833 SAVE_CPPFLAGS="$CPPFLAGS"
3834 SAVE_LDFLAGS="$LDFLAGS"
3835 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3836 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3838 if test "x$with_libtokyotyrant" = "xyes"
3840 AC_CHECK_HEADERS(tcrdb.h,
3842 AC_DEFINE(HAVE_TCRDB_H, 1,
3843 [Define to 1 if you have the <tcrdb.h> header file.])
3844 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3847 if test "x$with_libtokyotyrant" = "xyes"
3849 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3851 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3852 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3854 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3855 [$with_libtokyotyrant_libs])
3858 CPPFLAGS="$SAVE_CPPFLAGS"
3859 LDFLAGS="$SAVE_LDFLAGS"
3861 if test "x$with_libtokyotyrant" = "xyes"
3863 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3864 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3865 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3866 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3867 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3868 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3870 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3873 # --with-libupsclient {{{
3874 with_libupsclient_config=""
3875 with_libupsclient_cflags=""
3876 with_libupsclient_libs=""
3877 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3879 if test "x$withval" = "xno"
3881 with_libupsclient="no"
3882 else if test "x$withval" = "xyes"
3884 with_libupsclient="use_pkgconfig"
3886 if test -x "$withval"
3888 with_libupsclient_config="$withval"
3889 with_libupsclient="use_libupsclient_config"
3890 else if test -x "$withval/bin/libupsclient-config"
3892 with_libupsclient_config="$withval/bin/libupsclient-config"
3893 with_libupsclient="use_libupsclient_config"
3895 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3896 with_libupsclient_cflags="-I$withval/include"
3897 with_libupsclient_libs="-L$withval/lib -lupsclient"
3898 with_libupsclient="yes"
3902 [with_libupsclient="use_pkgconfig"])
3904 # configure using libupsclient-config
3905 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3907 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3908 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3911 with_libupsclient="no ($with_libupsclient_config failed)"
3913 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3916 with_libupsclient="no ($with_libupsclient_config failed)"
3919 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3921 with_libupsclient="yes"
3924 # configure using pkg-config
3925 if test "x$with_libupsclient" = "xuse_pkgconfig"
3927 if test "x$PKG_CONFIG" = "x"
3929 with_libupsclient="no (Don't have pkg-config)"
3932 if test "x$with_libupsclient" = "xuse_pkgconfig"
3934 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3935 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3938 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3941 if test "x$with_libupsclient" = "xuse_pkgconfig"
3943 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3946 with_libupsclient="no ($PKG_CONFIG failed)"
3948 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3951 with_libupsclient="no ($PKG_CONFIG failed)"
3954 if test "x$with_libupsclient" = "xuse_pkgconfig"
3956 with_libupsclient="yes"
3959 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3960 # the actual checks.
3961 if test "x$with_libupsclient" = "xyes"
3963 SAVE_CPPFLAGS="$CPPFLAGS"
3964 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3966 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3968 CPPFLAGS="$SAVE_CPPFLAGS"
3970 if test "x$with_libupsclient" = "xyes"
3972 SAVE_CPPFLAGS="$CPPFLAGS"
3973 SAVE_LDFLAGS="$LDFLAGS"
3975 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3976 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3978 AC_CHECK_LIB(upsclient, upscli_connect,
3979 [with_libupsclient="yes"],
3980 [with_libupsclient="no (symbol upscli_connect not found)"])
3982 CPPFLAGS="$SAVE_CPPFLAGS"
3983 LDFLAGS="$SAVE_LDFLAGS"
3985 if test "x$with_libupsclient" = "xyes"
3987 SAVE_CPPFLAGS="$CPPFLAGS"
3988 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3990 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3991 [#include <stdlib.h>
3993 #include <upsclient.h>])
3995 CPPFLAGS="$SAVE_CPPFLAGS"
3997 if test "x$with_libupsclient" = "xyes"
3999 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4000 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4001 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4002 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4006 # --with-libxmms {{{
4007 with_xmms_config="xmms-config"
4010 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4012 if test "x$withval" != "xno" \
4013 && test "x$withval" != "xyes"
4015 if test -f "$withval" && test -x "$withval";
4017 with_xmms_config="$withval"
4018 else if test -x "$withval/bin/xmms-config"
4020 with_xmms_config="$withval/bin/xmms-config"
4023 else if test "x$withval" = "xno"
4033 if test "x$with_libxmms" = "xyes"
4035 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4036 xmms_config_status=$?
4038 if test $xmms_config_status -ne 0
4043 if test "x$with_libxmms" = "xyes"
4045 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4046 xmms_config_status=$?
4048 if test $xmms_config_status -ne 0
4053 if test "x$with_libxmms" = "xyes"
4055 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4057 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4058 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4059 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4060 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4067 with_libxmms_numeric=0
4068 if test "x$with_libxmms" = "xyes"
4070 with_libxmms_numeric=1
4072 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4073 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4076 # --with-libyajl {{{
4077 with_libyajl_cppflags=""
4078 with_libyajl_ldflags=""
4079 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4081 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4083 with_libyajl_cppflags="-I$withval/include"
4084 with_libyajl_ldflags="-L$withval/lib"
4087 with_libyajl="$withval"
4093 if test "x$with_libyajl" = "xyes"
4095 SAVE_CPPFLAGS="$CPPFLAGS"
4096 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4098 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4099 AC_CHECK_HEADERS(yajl/yajl_version.h)
4101 CPPFLAGS="$SAVE_CPPFLAGS"
4103 if test "x$with_libyajl" = "xyes"
4105 SAVE_CPPFLAGS="$CPPFLAGS"
4106 SAVE_LDFLAGS="$LDFLAGS"
4107 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4108 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4110 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4112 CPPFLAGS="$SAVE_CPPFLAGS"
4113 LDFLAGS="$SAVE_LDFLAGS"
4115 if test "x$with_libyajl" = "xyes"
4117 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4118 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4119 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4120 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4121 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4122 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4123 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4125 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4128 # --with-libvarnish {{{
4129 with_libvarnish_cppflags=""
4130 with_libvarnish_cflags=""
4131 with_libvarnish_libs=""
4132 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4134 if test "x$withval" = "xno"
4136 with_libvarnish="no"
4137 else if test "x$withval" = "xyes"
4139 with_libvarnish="use_pkgconfig"
4140 else if test -d "$with_libvarnish/lib"
4142 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4143 with_libvarnish_cflags="-I$withval/include"
4144 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4145 with_libvarnish="yes"
4148 [with_libvarnish="use_pkgconfig"])
4150 # configure using pkg-config
4151 if test "x$with_libvarnish" = "xuse_pkgconfig"
4153 if test "x$PKG_CONFIG" = "x"
4155 with_libvarnish="no (Don't have pkg-config)"
4158 if test "x$with_libvarnish" = "xuse_pkgconfig"
4160 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4161 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4164 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4167 if test "x$with_libvarnish" = "xuse_pkgconfig"
4169 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4172 with_libvarnish="no ($PKG_CONFIG failed)"
4174 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4177 with_libvarnish="no ($PKG_CONFIG failed)"
4180 if test "x$with_libvarnish" = "xuse_pkgconfig"
4182 with_libvarnish="yes"
4185 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4186 # the actual checks.
4187 if test "x$with_libvarnish" = "xyes"
4189 SAVE_CPPFLAGS="$CPPFLAGS"
4190 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4191 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4193 CPPFLAGS="$SAVE_CPPFLAGS"
4195 if test "x$with_libvarnish" = "xyes"
4197 SAVE_CPPFLAGS="$CPPFLAGS"
4198 #SAVE_LDFLAGS="$LDFLAGS"
4200 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4201 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4203 AC_CHECK_HEADERS(varnish/vsc.h,
4204 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4205 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4207 CPPFLAGS="$SAVE_CPPFLAGS"
4208 #LDFLAGS="$SAVE_LDFLAGS"
4210 if test "x$with_libvarnish" = "xyes"
4212 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4213 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4214 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4215 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4219 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4220 with_libxml2="no (pkg-config isn't available)"
4221 with_libxml2_cflags=""
4222 with_libxml2_ldflags=""
4223 with_libvirt="no (pkg-config isn't available)"
4224 with_libvirt_cflags=""
4225 with_libvirt_ldflags=""
4226 if test "x$PKG_CONFIG" != "x"
4228 pkg-config --exists 'libxml-2.0' 2>/dev/null
4233 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4236 pkg-config --exists libvirt 2>/dev/null
4241 with_libvirt="no (pkg-config doesn't know libvirt)"
4244 if test "x$with_libxml2" = "xyes"
4246 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4251 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4257 if test "x$with_libxml2" = "xyes"
4259 SAVE_CPPFLAGS="$CPPFLAGS"
4260 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4262 AC_CHECK_HEADERS(libxml/parser.h, [],
4263 [with_libxml2="no (libxml/parser.h not found)"])
4265 CPPFLAGS="$SAVE_CPPFLAGS"
4267 if test "x$with_libxml2" = "xyes"
4269 SAVE_CFLAGS="$CFLAGS"
4270 SAVE_LDFLAGS="$LDFLAGS"
4272 CFLAGS="$CFLAGS $with_libxml2_cflags"
4273 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4275 AC_CHECK_LIB(xml2, xmlXPathEval,
4276 [with_libxml2="yes"],
4277 [with_libxml2="no (symbol xmlXPathEval not found)"])
4279 CFLAGS="$SAVE_CFLAGS"
4280 LDFLAGS="$SAVE_LDFLAGS"
4282 dnl Add the right compiler flags and libraries.
4283 if test "x$with_libxml2" = "xyes"; then
4284 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4285 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4286 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4287 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4289 if test "x$with_libvirt" = "xyes"
4291 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4296 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4302 if test "x$with_libvirt" = "xyes"
4304 SAVE_CPPFLAGS="$CPPFLAGS"
4305 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4307 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4308 [with_libvirt="no (libvirt/libvirt.h not found)"])
4310 CPPFLAGS="$SAVE_CPPFLAGS"
4312 if test "x$with_libvirt" = "xyes"
4314 SAVE_CFLAGS="$CFLAGS"
4315 SAVE_LDFLAGS="$LDFLAGS"
4317 CFLAGS="$CFLAGS $with_libvirt_cflags"
4318 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4320 AC_CHECK_LIB(virt, virDomainBlockStats,
4321 [with_libvirt="yes"],
4322 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4324 CFLAGS="$SAVE_CFLAGS"
4325 LDFLAGS="$SAVE_LDFLAGS"
4327 dnl Add the right compiler flags and libraries.
4328 if test "x$with_libvirt" = "xyes"; then
4329 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4330 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4331 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4332 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4336 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4337 with_libopenipmipthread="yes"
4338 with_libopenipmipthread_cflags=""
4339 with_libopenipmipthread_libs=""
4341 AC_MSG_CHECKING([for pkg-config])
4343 if test "x$PKG_CONFIG" = "x"
4345 with_libopenipmipthread="no"
4348 temp_result="$PKG_CONFIG"
4350 AC_MSG_RESULT([$temp_result])
4352 if test "x$with_libopenipmipthread" = "xyes"
4354 AC_MSG_CHECKING([for libOpenIPMIpthread])
4355 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4358 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4360 AC_MSG_RESULT([$with_libopenipmipthread])
4363 if test "x$with_libopenipmipthread" = "xyes"
4365 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4366 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4369 with_libopenipmipthread_cflags="$temp_result"
4371 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4372 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4374 AC_MSG_RESULT([$temp_result])
4377 if test "x$with_libopenipmipthread" = "xyes"
4379 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4380 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4383 with_libopenipmipthread_ldflags="$temp_result"
4385 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4386 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4388 AC_MSG_RESULT([$temp_result])
4391 if test "x$with_libopenipmipthread" = "xyes"
4393 SAVE_CPPFLAGS="$CPPFLAGS"
4394 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4396 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4397 [with_libopenipmipthread="yes"],
4398 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4399 [#include <OpenIPMI/ipmiif.h>
4400 #include <OpenIPMI/ipmi_err.h>
4401 #include <OpenIPMI/ipmi_posix.h>
4402 #include <OpenIPMI/ipmi_conn.h>
4405 CPPFLAGS="$SAVE_CPPFLAGS"
4408 if test "x$with_libopenipmipthread" = "xyes"
4410 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4411 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4412 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4413 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4417 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4418 [with_libnotify="yes"],
4419 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4422 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4425 # Check for enabled/disabled features
4428 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4429 # ------------------------------------------------------------
4431 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4436 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4441 m4_define([EnDis],[disabled])dnl
4442 m4_define([YesNo],[no])dnl
4448 m4_define([EnDis],[enabled])dnl
4449 m4_define([YesNo],[yes])dnl
4452 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4456 m4_if([$3], [feature], [],
4460 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4466 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4468 enable_$1='[YesNo]'dnl
4470 if test "x$enable_$1" = "xno"
4474 if test "x$enable_$1" = "xyes"
4478 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4483 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4484 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4486 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4488 # AC_PLUGIN(name, default, info)
4489 # ------------------------------------------------------------
4496 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4498 if test "x$enableval" = "xyes"
4501 else if test "x$enableval" = "xforce"
4506 enable_plugin="no (disabled on command line)"
4510 if test "x$enable_all_plugins" = "xauto"
4512 if test "x$2" = "xyes"
4519 enable_plugin="$enable_all_plugins"
4522 if test "x$enable_plugin" = "xyes"
4524 if test "x$2" = "xyes" || test "x$force" = "xyes"
4526 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4527 if test "x$2" != "xyes"
4529 dependency_warning="yes"
4531 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4532 dependency_error="yes"
4533 enable_plugin="no (dependency error)"
4536 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4537 enable_$1="$enable_plugin"
4539 )# AC_PLUGIN(name, default, info)
4541 m4_divert_once([HELP_ENABLE], [
4542 collectd features:])
4543 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4544 AC_COLLECTD([debug], [enable], [feature], [debugging])
4545 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4546 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4548 dependency_warning="no"
4549 dependency_error="no"
4554 plugin_conntrack="no"
4555 plugin_contextswitch="no"
4558 plugin_curl_json="no"
4559 plugin_curl_xml="no"
4565 plugin_interface="no"
4572 plugin_multimeter="no"
4576 plugin_processes="no"
4577 plugin_protocols="no"
4581 plugin_tcpconns="no"
4588 plugin_wireless="no"
4592 if test "x$ac_system" = "xLinux"
4594 plugin_battery="yes"
4595 plugin_conntrack="yes"
4596 plugin_contextswitch="yes"
4598 plugin_cpufreq="yes"
4600 plugin_entropy="yes"
4601 plugin_fscache="yes"
4602 plugin_interface="yes"
4608 plugin_processes="yes"
4609 plugin_protocols="yes"
4612 plugin_tcpconns="yes"
4613 plugin_thermal="yes"
4616 plugin_vserver="yes"
4617 plugin_wireless="yes"
4619 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4625 if test "x$ac_system" = "xOpenBSD"
4627 plugin_tcpconns="yes"
4631 if test "x$with_libiokit" = "xyes"
4633 plugin_battery="yes"
4639 if test "x$ac_system" = "xAIX"
4641 plugin_tcpconns="yes"
4644 if test "x$with_perfstat" = "xyes"
4650 plugin_interface="yes"
4654 if test "x$with_procinfo" = "xyes"
4656 plugin_processes="yes"
4660 if test "x$with_kstat" = "xyes"
4664 plugin_zfs_arc="yes"
4667 if test "x$with_devinfo$with_kstat" = "xyesyes"
4671 plugin_interface="yes"
4677 if test "x$with_libstatgrab" = "xyes"
4681 plugin_interface="yes"
4688 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4691 if test "x$have_strptime" = "xyes"
4697 if test "x$with_libopenipmipthread" = "xyes"
4702 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4704 plugin_curl_json="yes"
4707 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4709 plugin_curl_xml="yes"
4712 if test "x$have_processor_info" = "xyes"
4716 if test "x$have_sysctl" = "xyes"
4721 if test "x$ac_system" = "xDarwin"
4726 if test "x$have_sysctlbyname" = "xyes"
4728 plugin_contextswitch="yes"
4731 plugin_tcpconns="yes"
4734 # Df plugin: Check if we know how to determine mount points first.
4735 #if test "x$have_listmntent" = "xyes"; then
4738 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4742 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4746 #if test "x$have_getmntent" = "xseq"
4750 if test "x$c_cv_have_one_getmntent" = "xyes"
4755 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4756 if test "x$plugin_df" = "xyes"
4759 if test "x$have_statfs" = "xyes"
4763 if test "x$have_statvfs" = "xyes"
4769 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
4771 plugin_ethstat="yes"
4774 if test "x$have_getifaddrs" = "xyes"
4776 plugin_interface="yes"
4779 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4781 plugin_libvirt="yes"
4784 if test "x$have_getloadavg" = "xyes"
4789 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4794 # Mac OS X memory interface
4795 if test "x$have_host_statistics" = "xyes"
4800 if test "x$have_termios_h" = "xyes"
4802 plugin_multimeter="yes"
4806 if test "x$have_thread_info" = "xyes"
4808 plugin_processes="yes"
4811 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4813 plugin_processes="yes"
4816 if test "x$with_kvm_getswapinfo" = "xyes"
4821 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4826 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4828 plugin_tcpconns="yes"
4831 if test "x$have_getutent" = "xyes"
4835 if test "x$have_getutxent" = "xyes"
4840 m4_divert_once([HELP_ENABLE], [
4843 AC_ARG_ENABLE([all-plugins],
4844 AC_HELP_STRING([--enable-all-plugins],
4845 [enable all plugins (auto by def)]),
4847 if test "x$enableval" = "xyes"
4849 enable_all_plugins="yes"
4850 else if test "x$enableval" = "xauto"
4852 enable_all_plugins="auto"
4854 enable_all_plugins="no"
4857 [enable_all_plugins="auto"])
4859 m4_divert_once([HELP_ENABLE], [])
4861 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4862 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4863 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4864 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4865 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4866 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4867 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4868 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4869 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4870 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4871 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4872 AC_PLUGIN([csv], [yes], [CSV output plugin])
4873 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4874 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4875 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4876 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4877 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4878 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4879 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4880 AC_PLUGIN([email], [yes], [EMail statistics])
4881 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4882 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
4883 AC_PLUGIN([exec], [yes], [Execution of external programs])
4884 AC_PLUGIN([filecount], [yes], [Count files in directories])
4885 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4886 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4887 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4888 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4889 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4890 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4891 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4892 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4893 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4894 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4895 AC_PLUGIN([load], [$plugin_load], [System load])
4896 AC_PLUGIN([logfile], [yes], [File logging plugin])
4897 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4898 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4899 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4900 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4901 AC_PLUGIN([match_regex], [yes], [The regex match])
4902 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4903 AC_PLUGIN([match_value], [yes], [The value match])
4904 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4905 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
4906 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4907 AC_PLUGIN([memcached], [yes], [memcached statistics])
4908 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4909 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4910 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4911 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4912 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4913 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4914 AC_PLUGIN([network], [yes], [Network communication plugin])
4915 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4916 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4917 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4918 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4919 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4920 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
4921 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4922 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4923 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4924 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4925 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4926 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4927 # FIXME: Check for libevent, too.
4928 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4929 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4930 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4931 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4932 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4933 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4934 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4935 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
4936 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4937 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4938 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4939 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4940 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4941 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4942 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4943 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4944 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4945 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4946 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4947 AC_PLUGIN([target_notification], [yes], [The notification target])
4948 AC_PLUGIN([target_replace], [yes], [The replace target])
4949 AC_PLUGIN([target_scale],[yes], [The scale target])
4950 AC_PLUGIN([target_set], [yes], [The set target])
4951 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
4952 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4953 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4954 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4955 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4956 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
4957 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4958 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4959 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4960 AC_PLUGIN([users], [$plugin_users], [User statistics])
4961 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4962 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
4963 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4964 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4965 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4966 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
4967 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4968 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
4969 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
4970 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4971 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4973 dnl Default configuration file
4974 # Load either syslog or logfile
4975 LOAD_PLUGIN_SYSLOG=""
4976 LOAD_PLUGIN_LOGFILE=""
4978 AC_MSG_CHECKING([which default log plugin to load])
4979 default_log_plugin="none"
4980 if test "x$enable_syslog" = "xyes"
4982 default_log_plugin="syslog"
4984 LOAD_PLUGIN_SYSLOG="##"
4987 if test "x$enable_logfile" = "xyes"
4989 if test "x$default_log_plugin" = "xnone"
4991 default_log_plugin="logfile"
4993 LOAD_PLUGIN_LOGFILE="#"
4996 LOAD_PLUGIN_LOGFILE="##"
4998 AC_MSG_RESULT([$default_log_plugin])
5000 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5001 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5003 DEFAULT_LOG_LEVEL="info"
5004 if test "x$enable_debug" = "xyes"
5006 DEFAULT_LOG_LEVEL="debug"
5008 AC_SUBST(DEFAULT_LOG_LEVEL)
5010 # Load only one of rrdtool, network, csv in the default config.
5011 LOAD_PLUGIN_RRDTOOL=""
5012 LOAD_PLUGIN_NETWORK=""
5015 AC_MSG_CHECKING([which default write plugin to load])
5016 default_write_plugin="none"
5017 if test "x$enable_rrdtool" = "xyes"
5019 default_write_plugin="rrdtool"
5021 LOAD_PLUGIN_RRDTOOL="##"
5024 if test "x$enable_network" = "xyes"
5026 if test "x$default_write_plugin" = "xnone"
5028 default_write_plugin="network"
5030 LOAD_PLUGIN_NETWORK="#"
5033 LOAD_PLUGIN_NETWORK="##"
5036 if test "x$enable_csv" = "xyes"
5038 if test "x$default_write_plugin" = "xnone"
5040 default_write_plugin="csv"
5045 LOAD_PLUGIN_CSV="##"
5047 AC_MSG_RESULT([$default_write_plugin])
5049 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5050 AC_SUBST(LOAD_PLUGIN_NETWORK)
5051 AC_SUBST(LOAD_PLUGIN_CSV)
5054 if test "x$ac_system" = "xLinux" \
5055 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5057 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5060 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5062 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5066 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5068 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5070 PERL_BINDINGS_OPTIONS="$withval"
5071 with_perl_bindings="yes"
5073 PERL_BINDINGS_OPTIONS=""
5074 with_perl_bindings="$withval"
5078 PERL_BINDINGS_OPTIONS=""
5079 if test -n "$perl_interpreter"
5081 with_perl_bindings="yes"
5083 with_perl_bindings="no (no perl interpreter found)"
5086 if test "x$with_perl_bindings" = "xyes"
5088 PERL_BINDINGS="perl"
5092 AC_SUBST(PERL_BINDINGS)
5093 AC_SUBST(PERL_BINDINGS_OPTIONS)
5095 dnl libcollectdclient
5096 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5097 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5098 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5100 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5102 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5104 AC_SUBST(LCC_VERSION_MAJOR)
5105 AC_SUBST(LCC_VERSION_MINOR)
5106 AC_SUBST(LCC_VERSION_PATCH)
5107 AC_SUBST(LCC_VERSION_EXTRA)
5108 AC_SUBST(LCC_VERSION_STRING)
5110 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
5112 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
5114 if test "x$with_librrd" = "xyes" \
5115 && test "x$librrd_threadsafe" != "xyes"
5117 with_librrd="yes (warning: librrd is not thread-safe)"
5120 if test "x$with_libperl" = "xyes"
5122 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5124 enable_perl="no (needs libperl)"
5127 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5129 enable_perl="no (libperl doesn't support ithreads)"
5132 if test "x$with_perl_bindings" = "xyes" \
5133 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5135 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5142 libcurl . . . . . . . $with_libcurl
5143 libdbi . . . . . . . $with_libdbi
5144 libcredis . . . . . . $with_libcredis
5145 libesmtp . . . . . . $with_libesmtp
5146 libganglia . . . . . $with_libganglia
5147 libgcrypt . . . . . . $with_libgcrypt
5148 libiokit . . . . . . $with_libiokit
5149 libiptc . . . . . . . $with_libiptc
5150 libjvm . . . . . . . $with_java
5151 libkstat . . . . . . $with_kstat
5152 libkvm . . . . . . . $with_libkvm
5153 libmemcached . . . . $with_libmemcached
5154 libmodbus . . . . . . $with_libmodbus
5155 libmysql . . . . . . $with_libmysql
5156 libnetapp . . . . . . $with_libnetapp
5157 libnetlink . . . . . $with_libnetlink
5158 libnetsnmp . . . . . $with_libnetsnmp
5159 libnotify . . . . . . $with_libnotify
5160 liboconfig . . . . . $with_liboconfig
5161 libopenipmi . . . . . $with_libopenipmipthread
5162 liboping . . . . . . $with_liboping
5163 libpcap . . . . . . . $with_libpcap
5164 libperfstat . . . . . $with_perfstat
5165 libperl . . . . . . . $with_libperl
5166 libpq . . . . . . . . $with_libpq
5167 libpthread . . . . . $with_libpthread
5168 librabbitmq . . . . . $with_librabbitmq
5169 librouteros . . . . . $with_librouteros
5170 librrd . . . . . . . $with_librrd
5171 libsensors . . . . . $with_libsensors
5172 libstatgrab . . . . . $with_libstatgrab
5173 libtokyotyrant . . . $with_libtokyotyrant
5174 libupsclient . . . . $with_libupsclient
5175 libvarnish . . . . . $with_libvarnish
5176 libvirt . . . . . . . $with_libvirt
5177 libxml2 . . . . . . . $with_libxml2
5178 libxmms . . . . . . . $with_libxmms
5179 libyajl . . . . . . . $with_libyajl
5180 libevent . . . . . . $with_libevent
5181 protobuf-c . . . . . $have_protoc_c
5182 oracle . . . . . . . $with_oracle
5183 python . . . . . . . $with_python
5186 daemon mode . . . . . $enable_daemon
5187 debug . . . . . . . . $enable_debug
5190 perl . . . . . . . . $with_perl_bindings
5193 amqp . . . . . . . $enable_amqp
5194 apache . . . . . . . $enable_apache
5195 apcups . . . . . . . $enable_apcups
5196 apple_sensors . . . . $enable_apple_sensors
5197 ascent . . . . . . . $enable_ascent
5198 battery . . . . . . . $enable_battery
5199 bind . . . . . . . . $enable_bind
5200 conntrack . . . . . . $enable_conntrack
5201 contextswitch . . . . $enable_contextswitch
5202 cpu . . . . . . . . . $enable_cpu
5203 cpufreq . . . . . . . $enable_cpufreq
5204 csv . . . . . . . . . $enable_csv
5205 curl . . . . . . . . $enable_curl
5206 curl_json . . . . . . $enable_curl_json
5207 curl_xml . . . . . . $enable_curl_xml
5208 dbi . . . . . . . . . $enable_dbi
5209 df . . . . . . . . . $enable_df
5210 disk . . . . . . . . $enable_disk
5211 dns . . . . . . . . . $enable_dns
5212 email . . . . . . . . $enable_email
5213 entropy . . . . . . . $enable_entropy
5214 ethstat . . . . . . . $enable_ethstat
5215 exec . . . . . . . . $enable_exec
5216 filecount . . . . . . $enable_filecount
5217 fscache . . . . . . . $enable_fscache
5218 gmond . . . . . . . . $enable_gmond
5219 hddtemp . . . . . . . $enable_hddtemp
5220 interface . . . . . . $enable_interface
5221 ipmi . . . . . . . . $enable_ipmi
5222 iptables . . . . . . $enable_iptables
5223 ipvs . . . . . . . . $enable_ipvs
5224 irq . . . . . . . . . $enable_irq
5225 java . . . . . . . . $enable_java
5226 libvirt . . . . . . . $enable_libvirt
5227 load . . . . . . . . $enable_load
5228 logfile . . . . . . . $enable_logfile
5229 lpar... . . . . . . . $enable_lpar
5230 madwifi . . . . . . . $enable_madwifi
5231 match_empty_counter . $enable_match_empty_counter
5232 match_hashed . . . . $enable_match_hashed
5233 match_regex . . . . . $enable_match_regex
5234 match_timediff . . . $enable_match_timediff
5235 match_value . . . . . $enable_match_value
5236 mbmon . . . . . . . . $enable_mbmon
5237 md . . . . . . . . . $enable_md
5238 memcachec . . . . . . $enable_memcachec
5239 memcached . . . . . . $enable_memcached
5240 memory . . . . . . . $enable_memory
5241 modbus . . . . . . . $enable_modbus
5242 multimeter . . . . . $enable_multimeter
5243 mysql . . . . . . . . $enable_mysql
5244 netapp . . . . . . . $enable_netapp
5245 netlink . . . . . . . $enable_netlink
5246 network . . . . . . . $enable_network
5247 nfs . . . . . . . . . $enable_nfs
5248 nginx . . . . . . . . $enable_nginx
5249 notify_desktop . . . $enable_notify_desktop
5250 notify_email . . . . $enable_notify_email
5251 ntpd . . . . . . . . $enable_ntpd
5252 numa . . . . . . . . $enable_numa
5253 nut . . . . . . . . . $enable_nut
5254 olsrd . . . . . . . . $enable_olsrd
5255 onewire . . . . . . . $enable_onewire
5256 openvpn . . . . . . . $enable_openvpn
5257 oracle . . . . . . . $enable_oracle
5258 perl . . . . . . . . $enable_perl
5259 pinba . . . . . . . . $enable_pinba
5260 ping . . . . . . . . $enable_ping
5261 postgresql . . . . . $enable_postgresql
5262 powerdns . . . . . . $enable_powerdns
5263 processes . . . . . . $enable_processes
5264 protocols . . . . . . $enable_protocols
5265 python . . . . . . . $enable_python
5266 redis . . . . . . . . $enable_redis
5267 routeros . . . . . . $enable_routeros
5268 rrdcached . . . . . . $enable_rrdcached
5269 rrdtool . . . . . . . $enable_rrdtool
5270 sensors . . . . . . . $enable_sensors
5271 serial . . . . . . . $enable_serial
5272 snmp . . . . . . . . $enable_snmp
5273 swap . . . . . . . . $enable_swap
5274 syslog . . . . . . . $enable_syslog
5275 table . . . . . . . . $enable_table
5276 tail . . . . . . . . $enable_tail
5277 tape . . . . . . . . $enable_tape
5278 target_notification . $enable_target_notification
5279 target_replace . . . $enable_target_replace
5280 target_scale . . . . $enable_target_scale
5281 target_set . . . . . $enable_target_set
5282 target_v5upgrade . . $enable_target_v5upgrade
5283 tcpconns . . . . . . $enable_tcpconns
5284 teamspeak2 . . . . . $enable_teamspeak2
5285 ted . . . . . . . . . $enable_ted
5286 thermal . . . . . . . $enable_thermal
5287 threshold . . . . . . $enable_threshold
5288 tokyotyrant . . . . . $enable_tokyotyrant
5289 unixsock . . . . . . $enable_unixsock
5290 uptime . . . . . . . $enable_uptime
5291 users . . . . . . . . $enable_users
5292 uuid . . . . . . . . $enable_uuid
5293 varnish . . . . . . . $enable_varnish
5294 vmem . . . . . . . . $enable_vmem
5295 vserver . . . . . . . $enable_vserver
5296 wireless . . . . . . $enable_wireless
5297 write_graphite . . . $enable_write_graphite
5298 write_http . . . . . $enable_write_http
5299 write_redis . . . . . $enable_write_redis
5300 write_mongodb . . . . $enable_write_mongodb
5301 xmms . . . . . . . . $enable_xmms
5302 zfs_arc . . . . . . . $enable_zfs_arc
5306 if test "x$dependency_error" = "xyes"; then
5307 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5310 if test "x$dependency_warning" = "xyes"; then
5311 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5314 # vim: set fdm=marker :