1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, [m4_esyscmd(./version-gen.sh)])
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AC_CONFIG_AUX_DIR([libltdl/config])
7 m4_ifdef([LT_PACKAGE_VERSION],
10 LT_CONFIG_LTDL_DIR([libltdl])
12 LTDL_INIT([convenience])
13 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
18 AC_LIBLTDL_CONVENIENCE
22 AC_CONFIG_SUBDIRS(libltdl)
23 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
27 AM_INIT_AUTOMAKE([tar-pax dist-bzip2])
30 AC_PREFIX_DEFAULT("/opt/collectd")
35 # Checks for programs.
43 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
51 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
52 AC_CHECK_HEADERS([google/protobuf-c/protobuf-c.h],
53 [have_protobuf_c_h="yes"],
54 [have_protobuf_c_h="no"])
55 if test "x$have_protoc_c" = "xyes" && test "x$have_protobuf_c_h" != "xyes"
57 have_protoc_c="no (unable to find <google/protobuf-c/protobuf-c.h>)"
59 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
61 AC_MSG_CHECKING([for kernel type ($host_os)])
64 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
68 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
78 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
84 AC_MSG_RESULT([$ac_system])
86 if test "x$ac_system" = "xLinux"
88 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
89 if test -z "$KERNEL_DIR"
91 KERNEL_DIR="/lib/modules/`uname -r`/source"
94 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
95 AC_SUBST(KERNEL_CFLAGS)
98 if test "x$ac_system" = "xSolaris"
100 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
101 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
103 if test "x$ac_system" = "xAIX"
105 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
108 # Where to install .pc files.
109 pkgconfigdir="${libdir}/pkgconfig"
110 AC_SUBST(pkgconfigdir)
112 # Check for standards compliance mode
113 AC_ARG_ENABLE(standards,
114 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
115 [enable_standards="$enableval"],
116 [enable_standards="no"])
117 if test "x$enable_standards" = "xyes"
119 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
120 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
121 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
122 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
123 if test "x$GCC" = "xyes"
125 CFLAGS="$CFLAGS -std=c99"
128 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
131 # Checks for header files.
138 AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h fnmatch.h libgen.h)
141 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
146 # include <sys/types.h>
149 AC_CHECK_HEADERS(netinet/in.h, [], [],
154 # include <sys/types.h>
156 #if HAVE_NETINET_IN_SYSTM_H
157 # include <netinet/in_systm.h>
160 AC_CHECK_HEADERS(netinet/ip.h, [], [],
165 # include <sys/types.h>
167 #if HAVE_NETINET_IN_SYSTM_H
168 # include <netinet/in_systm.h>
170 #if HAVE_NETINET_IN_H
171 # include <netinet/in.h>
174 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
179 # include <sys/types.h>
181 #if HAVE_NETINET_IN_SYSTM_H
182 # include <netinet/in_systm.h>
184 #if HAVE_NETINET_IN_H
185 # include <netinet/in.h>
187 #if HAVE_NETINET_IP_H
188 # include <netinet/ip.h>
191 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
196 # include <sys/types.h>
198 #if HAVE_NETINET_IN_SYSTM_H
199 # include <netinet/in_systm.h>
201 #if HAVE_NETINET_IN_H
202 # include <netinet/in.h>
204 #if HAVE_NETINET_IP_H
205 # include <netinet/ip.h>
208 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
213 # include <sys/types.h>
215 #if HAVE_NETINET_IN_SYSTM_H
216 # include <netinet/in_systm.h>
218 #if HAVE_NETINET_IN_H
219 # include <netinet/in.h>
222 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
227 # include <sys/types.h>
229 #if HAVE_NETINET_IN_SYSTM_H
230 # include <netinet/in_systm.h>
232 #if HAVE_NETINET_IN_H
233 # include <netinet/in.h>
235 #if HAVE_NETINET_IP6_H
236 # include <netinet/ip6.h>
239 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
244 # include <sys/types.h>
246 #if HAVE_NETINET_IN_SYSTM_H
247 # include <netinet/in_systm.h>
249 #if HAVE_NETINET_IN_H
250 # include <netinet/in.h>
252 #if HAVE_NETINET_IP_H
253 # include <netinet/ip.h>
256 AC_CHECK_HEADERS(netinet/udp.h, [], [],
261 # include <sys/types.h>
263 #if HAVE_NETINET_IN_SYSTM_H
264 # include <netinet/in_systm.h>
266 #if HAVE_NETINET_IN_H
267 # include <netinet/in.h>
269 #if HAVE_NETINET_IP_H
270 # include <netinet/ip.h>
275 AC_CHECK_HEADERS(sys/dkstat.h)
276 if test "x$ac_system" = "xDarwin"
278 AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h)
279 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
280 # For the battery plugin
281 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
283 #if HAVE_IOKIT_IOKITLIB_H
284 # include <IOKit/IOKitLib.h>
286 #if HAVE_IOKIT_IOTYPES_H
287 # include <IOKit/IOTypes.h>
293 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
296 # include <sys/types.h>
299 # include <sys/param.h>
303 AC_MSG_CHECKING([for sysctl kern.cp_times])
304 if test -x /sbin/sysctl
306 /sbin/sysctl kern.cp_times 2>/dev/null
310 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
311 [Define if sysctl supports kern.cp_times])
320 AC_CHECK_HEADERS(linux/major.h)
322 # For md module (Linux only)
323 if test "x$ac_system" = "xLinux"
325 AC_CHECK_HEADERS(linux/raid/md_u.h,
326 [have_linux_raid_md_u_h="yes"],
327 [have_linux_raid_md_u_h="no"],
329 #include <sys/ioctl.h>
330 #include <linux/major.h>
331 #include <linux/types.h>
334 have_linux_raid_md_u_h="no"
337 # For the swap module
338 have_linux_wireless_h="no"
339 if test "x$ac_system" = "xLinux"
341 AC_CHECK_HEADERS(linux/wireless.h,
342 [have_linux_wireless_h="yes"],
343 [have_linux_wireless_h="no"],
346 #include <sys/ioctl.h>
347 #include <sys/socket.h>
351 # For the swap module
352 have_sys_swap_h="yes"
353 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
355 #undef _FILE_OFFSET_BITS
356 #undef _LARGEFILE64_SOURCE
358 # include <sys/types.h>
361 # include <sys/param.h>
365 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
368 if test "x$GCC" = "xyes"
370 hint_64="CFLAGS='-m64'"
372 hint_64="CFLAGS='-xarch=v9'"
374 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
378 # For the processes plugin
380 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
382 # For interface plugin
383 AC_CHECK_HEADERS(ifaddrs.h)
384 AC_CHECK_HEADERS(net/if.h, [], [],
387 # include <sys/types.h>
389 #if HAVE_SYS_SOCKET_H
390 # include <sys/socket.h>
393 AC_CHECK_HEADERS(linux/if.h, [], [],
396 # include <sys/types.h>
398 #if HAVE_SYS_SOCKET_H
399 # include <sys/socket.h>
402 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
405 # include <sys/types.h>
407 #if HAVE_SYS_SOCKET_H
408 # include <sys/socket.h>
411 # include <linux/if.h>
416 AC_CHECK_HEADERS(linux/sockios.h,
417 [have_linux_sockios_h="yes"],
418 [have_linux_sockios_h="no"],
421 # include <sys/ioctl.h>
427 AC_CHECK_HEADERS(linux/ethtool.h,
428 [have_linux_ethtool_h="yes"],
429 [have_linux_ethtool_h="no"],
432 # include <sys/ioctl.h>
437 #if HAVE_LINUX_SOCKIOS_H
438 # include <linux/sockios.h>
443 have_linux_ip_vs_h="no"
444 have_net_ip_vs_h="no"
446 ip_vs_h_needs_kernel_cflags="no"
447 if test "x$ac_system" = "xLinux"
449 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
450 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
451 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
453 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
455 SAVE_CFLAGS="$CFLAGS"
456 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
458 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
460 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
461 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
462 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
464 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
466 ip_vs_h_needs_kernel_cflags="yes"
469 CFLAGS="$SAVE_CFLAGS"
472 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
475 AC_CHECK_HEADERS(sys/ucred.h, [], [],
478 # include <sys/types.h>
481 # include <sys/param.h>
485 # For mount interface
486 AC_CHECK_HEADERS(sys/mount.h, [], [],
489 # include <sys/types.h>
492 # include <sys/param.h>
496 # For the email plugin
497 AC_CHECK_HEADERS(linux/un.h, [], [],
499 #if HAVE_SYS_SOCKET_H
500 # include <sys/socket.h>
504 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h wordexp.h)
507 AC_CHECK_HEADERS(arpa/nameser.h)
508 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
510 #if HAVE_ARPA_NAMESER_H
511 # include <arpa/nameser.h>
515 AC_CHECK_HEADERS(net/if_arp.h, [], [],
516 [#if HAVE_SYS_SOCKET_H
517 # include <sys/socket.h>
520 AC_CHECK_HEADERS(net/ppp_defs.h)
521 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
522 [#if HAVE_NET_PPP_DEFS_H
523 # include <net/ppp_defs.h>
526 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
531 # include <sys/types.h>
533 #if HAVE_SYS_SOCKET_H
534 # include <sys/socket.h>
539 #if HAVE_NETINET_IN_H
540 # include <netinet/in.h>
544 AC_CHECK_HEADERS(netinet/ip_compat.h)
546 have_net_pfvar_h="no"
547 AC_CHECK_HEADERS(net/pfvar.h,
548 [have_net_pfvar_h="yes"],
549 [have_net_pfvar_h="no"],
552 # include <sys/ioctl.h>
554 #if HAVE_SYS_SOCKET_H
555 # include <sys/socket.h>
562 # For the multimeter plugin
564 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
567 # Checks for typedefs, structures, and compiler characteristics.
576 # Checks for library functions.
578 AC_PROG_GCC_TRADITIONAL
579 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
583 SAVE_CFLAGS="$CFLAGS"
584 # Emulate behavior of src/Makefile.am
585 if test "x$GCC" = "xyes"
587 CFLAGS="$CFLAGS -Wall -Werror"
590 AC_CACHE_CHECK([for strtok_r],
591 [c_cv_have_strtok_r_default],
600 char buffer[] = "foo,bar,baz";
607 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
610 printf ("token = %s;\n", token);
613 [c_cv_have_strtok_r_default="yes"],
614 [c_cv_have_strtok_r_default="no"]
618 if test "x$c_cv_have_strtok_r_default" = "xno"
620 CFLAGS="$CFLAGS -D_REENTRANT=1"
622 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
623 [c_cv_have_strtok_r_reentrant],
632 char buffer[] = "foo,bar,baz";
639 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
642 printf ("token = %s;\n", token);
645 [c_cv_have_strtok_r_reentrant="yes"],
646 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
651 CFLAGS="$SAVE_CFLAGS"
652 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
654 CFLAGS="$CFLAGS -D_REENTRANT=1"
657 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
659 socket_needs_socket="no"
660 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
661 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
663 clock_gettime_needs_rt="no"
664 clock_gettime_needs_posix4="no"
665 have_clock_gettime="no"
666 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
667 if test "x$have_clock_gettime" = "xno"
669 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
670 have_clock_gettime="yes"])
672 if test "x$have_clock_gettime" = "xno"
674 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
675 have_clock_gettime="yes"])
677 if test "x$have_clock_gettime" = "xyes"
679 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
681 AC_MSG_WARN(cannot find clock_gettime)
684 nanosleep_needs_rt="no"
685 nanosleep_needs_posix4="no"
686 AC_CHECK_FUNCS(nanosleep,
688 AC_CHECK_LIB(rt, nanosleep,
689 [nanosleep_needs_rt="yes"],
690 AC_CHECK_LIB(posix4, nanosleep,
691 [nanosleep_needs_posix4="yes"],
692 AC_MSG_ERROR(cannot find nanosleep))))
694 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
695 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
697 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
698 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
699 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
700 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
701 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
702 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
703 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
704 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
705 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
706 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
707 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
708 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
710 # Check for strptime {{{
711 if test "x$GCC" = "xyes"
713 SAVE_CFLAGS="$CFLAGS"
714 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
717 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
718 if test "x$have_strptime" = "xyes"
720 AC_CACHE_CHECK([whether strptime is exported by default],
721 [c_cv_have_strptime_default],
729 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
731 [c_cv_have_strptime_default="yes"],
732 [c_cv_have_strptime_default="no"]))
734 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
736 AC_CACHE_CHECK([whether strptime needs standards mode],
737 [c_cv_have_strptime_standards],
741 #ifndef _ISOC99_SOURCE
742 # define _ISOC99_SOURCE 1
744 #ifndef _POSIX_C_SOURCE
745 # define _POSIX_C_SOURCE 200112L
747 #ifndef _XOPEN_SOURCE
748 # define _XOPEN_SOURCE 500
755 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
757 [c_cv_have_strptime_standards="yes"],
758 [c_cv_have_strptime_standards="no"]))
760 if test "x$c_cv_have_strptime_standards" = "xyes"
762 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
768 if test "x$GCC" = "xyes"
770 CFLAGS="$SAVE_CFLAGS"
773 # }}} Check for strptime
775 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
776 if test "x$have_swapctl" = "xyes"; then
777 AC_CACHE_CHECK([whether swapctl takes two arguments],
778 [c_cv_have_swapctl_two_args],
779 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
781 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
782 # undef _FILE_OFFSET_BITS
783 # undef _LARGEFILE64_SOURCE
785 #include <sys/stat.h>
786 #include <sys/swap.h>
789 int num = swapctl(0, NULL);
792 [c_cv_have_swapctl_two_args="yes"],
793 [c_cv_have_swapctl_two_args="no"]
796 AC_CACHE_CHECK([whether swapctl takes three arguments],
797 [c_cv_have_swapctl_three_args],
801 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
802 # undef _FILE_OFFSET_BITS
803 # undef _LARGEFILE64_SOURCE
805 #include <sys/stat.h>
806 #include <sys/swap.h>
809 int num = swapctl(0, NULL, 0);
812 [c_cv_have_swapctl_three_args="yes"],
813 [c_cv_have_swapctl_three_args="no"]
817 # Check for different versions of `swapctl' here..
818 if test "x$have_swapctl" = "xyes"; then
819 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
820 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
821 [Define if the function swapctl exists and takes two arguments.])
823 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
824 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
825 [Define if the function swapctl exists and takes three arguments.])
830 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
832 if test "x$withval" = "xno"; then
834 else if test "x$withval" = "xyes"; then
841 if test "x$nan_type" = "xnone"; then
842 AC_CACHE_CHECK([whether NAN is defined by default],
843 [c_cv_have_nan_default],
849 static double foo = NAN;
857 [c_cv_have_nan_default="yes"],
858 [c_cv_have_nan_default="no"]
861 if test "x$c_cv_have_nan_default" = "xyes"
866 if test "x$nan_type" = "xnone"; then
867 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
868 [c_cv_have_nan_isoc],
873 #define __USE_ISOC99 1
875 static double foo = NAN;
883 [c_cv_have_nan_isoc="yes"],
884 [c_cv_have_nan_isoc="no"]
887 if test "x$c_cv_have_nan_isoc" = "xyes"
892 if test "x$nan_type" = "xnone"; then
893 SAVE_LDFLAGS=$LDFLAGS
894 LDFLAGS="$LDFLAGS -lm"
895 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
896 [c_cv_have_nan_zero],
905 #define NAN (0.0 / 0.0)
907 # define isnan(f) ((f) != (f))
909 static double foo = NAN;
917 [c_cv_have_nan_zero="yes"],
918 [c_cv_have_nan_zero="no"]
921 LDFLAGS=$SAVE_LDFLAGS
922 if test "x$c_cv_have_nan_zero" = "xyes"
928 if test "x$nan_type" = "xdefault"; then
929 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
930 [Define if NAN is defined by default and can initialize static variables.])
931 else if test "x$nan_type" = "xisoc99"; then
932 AC_DEFINE(NAN_STATIC_ISOC, 1,
933 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
934 else if test "x$nan_type" = "xzero"; then
935 AC_DEFINE(NAN_ZERO_ZERO, 1,
936 [Define if NAN can be defined as (0.0 / 0.0)])
938 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
941 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
943 if test "x$withval" = "xnothing"; then
944 fp_layout_type="nothing"
945 else if test "x$withval" = "xendianflip"; then
946 fp_layout_type="endianflip"
947 else if test "x$withval" = "xintswap"; then
948 fp_layout_type="intswap"
950 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
953 [fp_layout_type="unknown"])
955 if test "x$fp_layout_type" = "xunknown"; then
956 AC_CACHE_CHECK([if doubles are stored in x86 representation],
957 [c_cv_fp_layout_need_nothing],
968 # include <inttypes.h>
971 # include <stdbool.h>
981 memcpy ((void *) &i0, (void *) &d, 8);
984 memcpy ((void *) c, (void *) &i1, 8);
986 if ((c[0] == 0x2f) && (c[1] == 0x25)
987 && (c[2] == 0xc0) && (c[3] == 0xc7)
988 && (c[4] == 0x43) && (c[5] == 0x2b)
989 && (c[6] == 0x1f) && (c[7] == 0x5b))
994 [c_cv_fp_layout_need_nothing="yes"],
995 [c_cv_fp_layout_need_nothing="no"]
998 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
999 fp_layout_type="nothing"
1002 if test "x$fp_layout_type" = "xunknown"; then
1003 AC_CACHE_CHECK([if endianflip converts to x86 representation],
1004 [c_cv_fp_layout_need_endianflip],
1012 # include <stdint.h>
1015 # include <inttypes.h>
1018 # include <stdbool.h>
1020 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
1021 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
1022 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1023 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
1024 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
1025 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1026 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1027 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1036 memcpy ((void *) &i0, (void *) &d, 8);
1038 i1 = endianflip (i0);
1039 memcpy ((void *) c, (void *) &i1, 8);
1041 if ((c[0] == 0x2f) && (c[1] == 0x25)
1042 && (c[2] == 0xc0) && (c[3] == 0xc7)
1043 && (c[4] == 0x43) && (c[5] == 0x2b)
1044 && (c[6] == 0x1f) && (c[7] == 0x5b))
1049 [c_cv_fp_layout_need_endianflip="yes"],
1050 [c_cv_fp_layout_need_endianflip="no"]
1053 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1054 fp_layout_type="endianflip"
1057 if test "x$fp_layout_type" = "xunknown"; then
1058 AC_CACHE_CHECK([if intswap converts to x86 representation],
1059 [c_cv_fp_layout_need_intswap],
1067 # include <stdint.h>
1070 # include <inttypes.h>
1073 # include <stdbool.h>
1075 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1076 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1085 memcpy ((void *) &i0, (void *) &d, 8);
1088 memcpy ((void *) c, (void *) &i1, 8);
1090 if ((c[0] == 0x2f) && (c[1] == 0x25)
1091 && (c[2] == 0xc0) && (c[3] == 0xc7)
1092 && (c[4] == 0x43) && (c[5] == 0x2b)
1093 && (c[6] == 0x1f) && (c[7] == 0x5b))
1098 [c_cv_fp_layout_need_intswap="yes"],
1099 [c_cv_fp_layout_need_intswap="no"]
1102 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1103 fp_layout_type="intswap"
1107 if test "x$fp_layout_type" = "xnothing"; then
1108 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1109 [Define if doubles are stored in x86 representation.])
1110 else if test "x$fp_layout_type" = "xendianflip"; then
1111 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1112 [Define if endianflip is needed to convert to x86 representation.])
1113 else if test "x$fp_layout_type" = "xintswap"; then
1114 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1115 [Define if intswap is needed to convert to x86 representation.])
1117 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1121 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1122 have_getvfsstat="no"
1123 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1124 have_listmntent="no"
1125 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1128 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1129 if test "x$have_getmntent" = "xno"; then
1130 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1132 if test "x$have_getmntent" = "xno"; then
1133 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1135 if test "x$have_getmntent" = "xno"; then
1136 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1139 if test "x$have_getmntent" = "xc"; then
1140 AC_CACHE_CHECK([whether getmntent takes one argument],
1141 [c_cv_have_one_getmntent],
1145 #include "$srcdir/src/utils_mount.h"
1150 fh = setmntent ("/etc/mtab", "r");
1151 me = getmntent (fh);
1154 [c_cv_have_one_getmntent="yes"],
1155 [c_cv_have_one_getmntent="no"]
1158 AC_CACHE_CHECK([whether getmntent takes two arguments],
1159 [c_cv_have_two_getmntent],
1163 #include "$srcdir/src/utils_mount.h"
1169 fh = fopen ("/etc/mnttab", "r");
1170 status = getmntent (fh, &mt);
1173 [c_cv_have_two_getmntent="yes"],
1174 [c_cv_have_two_getmntent="no"]
1179 # Check for different versions of `getmntent' here..
1181 if test "x$have_getmntent" = "xc"; then
1182 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1183 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1184 [Define if the function getmntent exists and takes one argument.])
1186 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1187 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1188 [Define if the function getmntent exists and takes two arguments.])
1191 if test "x$have_getmntent" = "xsun"; then
1192 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1193 [Define if the function getmntent exists. It's the version from libsun.])
1195 if test "x$have_getmntent" = "xseq"; then
1196 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1197 [Define if the function getmntent exists. It's the version from libseq.])
1199 if test "x$have_getmntent" = "xgen"; then
1200 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1201 [Define if the function getmntent exists. It's the version from libgen.])
1205 AC_MSG_CHECKING([if have htonll defined])
1210 #include <sys/types.h>
1211 #include <netinet/in.h>
1213 # include <inttypes.h>
1220 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1223 AC_MSG_RESULT([$have_htonll])
1225 # Check for structures
1226 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1227 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1230 #include <sys/types.h>
1231 #include <sys/socket.h>
1234 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1235 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1238 #include <sys/types.h>
1239 #include <sys/socket.h>
1240 #include <linux/if.h>
1241 #include <linux/netdevice.h>
1244 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1247 #include <netinet/in.h>
1251 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1253 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1254 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1255 have_struct_kinfo_proc_freebsd="yes"
1258 have_struct_kinfo_proc_freebsd="no"
1262 #include <sys/param.h>
1263 #include <sys/sysctl.h>
1264 #include <sys/user.h>
1267 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1269 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1270 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1271 have_struct_kinfo_proc_openbsd="yes"
1274 have_struct_kinfo_proc_openbsd="no"
1277 #include <sys/param.h>
1278 #include <sys/sysctl.h>
1282 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1283 [#define _BSD_SOURCE
1285 # include <stdint.h>
1287 #if HAVE_SYS_TYPES_H
1288 # include <sys/types.h>
1290 #if HAVE_NETINET_IN_SYSTM_H
1291 # include <netinet/in_systm.h>
1293 #if HAVE_NETINET_IN_H
1294 # include <netinet/in.h>
1296 #if HAVE_NETINET_IP_H
1297 # include <netinet/ip.h>
1299 #if HAVE_NETINET_UDP_H
1300 # include <netinet/udp.h>
1303 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1304 [#define _BSD_SOURCE
1306 # include <stdint.h>
1308 #if HAVE_SYS_TYPES_H
1309 # include <sys/types.h>
1311 #if HAVE_NETINET_IN_SYSTM_H
1312 # include <netinet/in_systm.h>
1314 #if HAVE_NETINET_IN_H
1315 # include <netinet/in.h>
1317 #if HAVE_NETINET_IP_H
1318 # include <netinet/ip.h>
1320 #if HAVE_NETINET_UDP_H
1321 # include <netinet/udp.h>
1325 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1335 # Checks for libraries begin here
1338 with_libresolv="yes"
1339 AC_CHECK_LIB(resolv, res_search,
1341 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1343 [with_libresolv="no"])
1344 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1346 dnl Check for HAL (hardware abstraction library)
1348 AC_CHECK_LIB(hal,libhal_device_property_exists,
1349 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1351 if test "x$with_libhal" = "xyes"; then
1352 if test "x$PKG_CONFIG" != "x"; then
1353 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1354 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1355 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1356 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1360 m4_divert_once([HELP_WITH], [
1361 collectd additional packages:])
1363 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1365 if test "x$ac_system" = "xAIX"
1370 with_perfstat="no (AIX only)"
1371 with_procinfo="no (AIX only)"
1374 if test "x$with_perfstat" = "xyes"
1376 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1377 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1379 if test "x$with_perfstat" = "xyes"
1381 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1382 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1383 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1384 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1386 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1389 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1391 # Processes plugin under AIX.
1392 if test "x$with_procinfo" = "xyes"
1394 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1396 if test "x$with_procinfo" = "xyes"
1398 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1401 if test "x$ac_system" = "xSolaris"
1406 with_kstat="no (Solaris only)"
1407 with_devinfo="no (Solaris only)"
1410 if test "x$with_kstat" = "xyes"
1412 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1414 if test "x$with_kstat" = "xyes"
1416 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1417 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1419 if test "x$with_kstat" = "xyes"
1421 AC_DEFINE(HAVE_LIBKSTAT, 1,
1422 [Define to 1 if you have the 'kstat' library (-lkstat)])
1424 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1425 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1428 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1435 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1438 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1439 if test "x$with_kvm_getprocs" = "xyes"
1441 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1442 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1445 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1447 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1448 if test "x$with_kvm_getswapinfo" = "xyes"
1450 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1451 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1454 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1456 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1457 if test "x$with_kvm_nlist" = "xyes"
1459 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1460 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1461 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1464 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1466 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1467 if test "x$with_kvm_openfiles" = "xyes"
1469 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1470 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1473 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1475 # --with-libcredis {{{
1476 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1478 if test "x$withval" = "xyes"
1480 with_libcredis="yes"
1481 else if test "x$withval" = "xno"
1485 with_libcredis="yes"
1486 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1487 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1490 [with_libcredis="yes"])
1492 SAVE_CPPFLAGS="$CPPFLAGS"
1493 SAVE_LDFLAGS="$LDFLAGS"
1495 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1496 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1498 if test "x$with_libcredis" = "xyes"
1500 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1502 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1504 AC_CHECK_HEADERS(credis.h,
1505 [with_libcredis="yes"],
1506 [with_libcredis="no (credis.h not found)"])
1508 if test "x$with_libcredis" = "xyes"
1510 if test "x$LIBCREDIS_LDFLAGS" != "x"
1512 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1514 AC_CHECK_LIB(credis, credis_info,
1515 [with_libcredis="yes"],
1516 [with_libcredis="no (symbol 'credis_info' not found)"])
1520 CPPFLAGS="$SAVE_CPPFLAGS"
1521 LDFLAGS="$SAVE_LDFLAGS"
1523 if test "x$with_libcredis" = "xyes"
1525 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1526 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1527 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1528 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1530 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1533 # --with-libcurl {{{
1534 with_curl_config="curl-config"
1537 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1539 if test "x$withval" = "xno"
1542 else if test "x$withval" = "xyes"
1546 if test -f "$withval" && test -x "$withval"
1548 with_curl_config="$withval"
1550 else if test -x "$withval/bin/curl-config"
1552 with_curl_config="$withval/bin/curl-config"
1561 if test "x$with_libcurl" = "xyes"
1563 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1564 curl_config_status=$?
1566 if test $curl_config_status -ne 0
1568 with_libcurl="no ($with_curl_config failed)"
1570 SAVE_CPPFLAGS="$CPPFLAGS"
1571 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1573 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1575 CPPFLAGS="$SAVE_CPPFLAGS"
1578 if test "x$with_libcurl" = "xyes"
1580 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1581 curl_config_status=$?
1583 if test $curl_config_status -ne 0
1585 with_libcurl="no ($with_curl_config failed)"
1587 AC_CHECK_LIB(curl, curl_easy_init,
1588 [with_libcurl="yes"],
1589 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1593 if test "x$with_libcurl" = "xyes"
1595 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1596 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1597 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1598 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1600 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1604 with_libdbi_cppflags=""
1605 with_libdbi_ldflags=""
1606 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1608 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1610 with_libdbi_cppflags="-I$withval/include"
1611 with_libdbi_ldflags="-L$withval/lib"
1614 with_libdbi="$withval"
1620 if test "x$with_libdbi" = "xyes"
1622 SAVE_CPPFLAGS="$CPPFLAGS"
1623 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1625 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1627 CPPFLAGS="$SAVE_CPPFLAGS"
1629 if test "x$with_libdbi" = "xyes"
1631 SAVE_CPPFLAGS="$CPPFLAGS"
1632 SAVE_LDFLAGS="$LDFLAGS"
1633 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1634 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1636 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1638 CPPFLAGS="$SAVE_CPPFLAGS"
1639 LDFLAGS="$SAVE_LDFLAGS"
1641 if test "x$with_libdbi" = "xyes"
1643 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1644 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1645 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1646 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1647 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1648 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1650 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1653 # --with-libesmtp {{{
1654 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1656 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1658 LDFLAGS="$LDFLAGS -L$withval/lib"
1659 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1662 with_libesmtp="$withval"
1668 if test "x$with_libesmtp" = "xyes"
1670 AC_CHECK_LIB(esmtp, smtp_create_session,
1672 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1673 ], [with_libesmtp="no (libesmtp not found)"])
1675 if test "x$with_libesmtp" = "xyes"
1677 AC_CHECK_HEADERS(libesmtp.h,
1679 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1680 ], [with_libesmtp="no (libesmtp.h not found)"])
1682 if test "x$with_libesmtp" = "xyes"
1688 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1689 [Wether or not to use the esmtp library])
1690 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1693 # --with-libganglia {{{
1694 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1696 if test -f "$withval" && test -x "$withval"
1698 with_libganglia_config="$withval"
1699 with_libganglia="yes"
1700 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1702 with_libganglia_config="$withval/bin/ganglia-config"
1703 with_libganglia="yes"
1704 else if test -d "$withval"
1706 GANGLIA_CPPFLAGS="-I$withval/include"
1707 GANGLIA_LDFLAGS="-L$withval/lib"
1708 with_libganglia="yes"
1710 with_libganglia_config="ganglia-config"
1711 with_libganglia="$withval"
1715 with_libganglia_config="ganglia-config"
1716 with_libganglia="yes"
1719 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1721 if test "x$GANGLIA_CPPFLAGS" = "x"
1723 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1726 if test "x$GANGLIA_LDFLAGS" = "x"
1728 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1731 if test "x$GANGLIA_LIBS" = "x"
1733 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1737 SAVE_CPPFLAGS="$CPPFLAGS"
1738 SAVE_LDFLAGS="$LDFLAGS"
1739 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1740 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1742 if test "x$with_libganglia" = "xyes"
1744 AC_CHECK_HEADERS(gm_protocol.h,
1746 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1747 [Define to 1 if you have the <gm_protocol.h> header file.])
1748 ], [with_libganglia="no (gm_protocol.h not found)"])
1751 if test "x$with_libganglia" = "xyes"
1753 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1755 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1756 [Define to 1 if you have the ganglia library (-lganglia).])
1757 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1760 CPPFLAGS="$SAVE_CPPFLAGS"
1761 LDFLAGS="$SAVE_LDFLAGS"
1763 AC_SUBST(GANGLIA_CPPFLAGS)
1764 AC_SUBST(GANGLIA_LDFLAGS)
1765 AC_SUBST(GANGLIA_LIBS)
1766 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1769 # --with-libgcrypt {{{
1770 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1771 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1772 GCRYPT_LIBS="$GCRYPT_LIBS"
1773 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1775 if test -f "$withval" && test -x "$withval"
1777 with_libgcrypt_config="$withval"
1778 with_libgcrypt="yes"
1779 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1781 with_libgcrypt_config="$withval/bin/gcrypt-config"
1782 with_libgcrypt="yes"
1783 else if test -d "$withval"
1785 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1786 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1787 with_libgcrypt="yes"
1789 with_libgcrypt_config="gcrypt-config"
1790 with_libgcrypt="$withval"
1794 with_libgcrypt_config="libgcrypt-config"
1795 with_libgcrypt="yes"
1798 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1800 if test "x$GCRYPT_CPPFLAGS" = "x"
1802 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1805 if test "x$GCRYPT_LDFLAGS" = "x"
1807 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1808 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1811 if test "x$GCRYPT_LIBS" = "x"
1813 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1817 SAVE_CPPFLAGS="$CPPFLAGS"
1818 SAVE_LDFLAGS="$LDFLAGS"
1819 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1820 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1822 if test "x$with_libgcrypt" = "xyes"
1824 if test "x$GCRYPT_CPPFLAGS" != "x"
1826 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1828 AC_CHECK_HEADERS(gcrypt.h,
1829 [with_libgcrypt="yes"],
1830 [with_libgcrypt="no (gcrypt.h not found)"])
1833 if test "x$with_libgcrypt" = "xyes"
1835 if test "x$GCRYPT_LDFLAGS" != "x"
1837 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1839 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1840 [with_libgcrypt="yes"],
1841 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1843 if test "$with_libgcrypt" != "no"; then
1844 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1845 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS"
1846 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
1850 CPPFLAGS="$SAVE_CPPFLAGS"
1851 LDFLAGS="$SAVE_LDFLAGS"
1853 if test "x$with_libgcrypt" = "xyes"
1855 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1858 AC_SUBST(GCRYPT_CPPFLAGS)
1859 AC_SUBST(GCRYPT_LDFLAGS)
1860 AC_SUBST(GCRYPT_LIBS)
1861 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1864 # --with-libiptc {{{
1865 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1867 if test "x$withval" = "xshipped"
1870 else if test "x$withval" = "xyes"
1872 with_libiptc="pkgconfig"
1873 else if test "x$withval" = "xno"
1878 with_libiptc_cflags="-I$withval/include"
1879 with_libiptc_libs="-L$withval/lib"
1883 if test "x$ac_system" = "xLinux"
1885 with_libiptc="pkgconfig"
1887 with_libiptc="no (Linux only)"
1891 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1893 with_libiptc="no (Don't have pkg-config)"
1896 if test "x$with_libiptc" = "xpkgconfig"
1898 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1901 with_libiptc="no (pkg-config doesn't know libiptc)"
1904 if test "x$with_libiptc" = "xpkgconfig"
1906 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1909 with_libiptc="no ($PKG_CONFIG failed)"
1911 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1914 with_libiptc="no ($PKG_CONFIG failed)"
1918 SAVE_CPPFLAGS="$CPPFLAGS"
1919 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1921 # check whether the header file for libiptc is available.
1922 if test "x$with_libiptc" = "xpkgconfig"
1924 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1925 [with_libiptc="no (header file missing)"])
1927 # If the header file is available, check for the required type declaractions.
1928 # They may be missing in old versions of libiptc. In that case, they will be
1929 # declared in the iptables plugin.
1930 if test "x$with_libiptc" = "xpkgconfig"
1932 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1934 # Check for the iptc_init symbol in the library.
1935 # This could be in iptc or ip4tc
1936 if test "x$with_libiptc" = "xpkgconfig"
1939 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1940 [with_libiptc="pkgconfig"],
1941 [with_libiptc="no"],
1942 [$with_libiptc_libs])
1945 if test "x$with_libiptc" = "xpkgconfig"
1950 CPPFLAGS="$SAVE_CPPFLAGS"
1952 if test "x$with_libiptc" = "xown"
1954 with_libiptc_cflags=""
1955 with_libiptc_libs=""
1957 if test "x$with_libiptc" = "xown"
1959 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1961 with_libiptc="no (Linux iptables headers not found)"
1964 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1967 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1968 if test "x$with_libiptc" = "xown"
1970 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1974 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1975 if test "x$with_libiptc" = "xyes"
1977 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1978 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1979 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1980 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1985 with_java_home="$JAVA_HOME"
1986 with_java_vmtype="client"
1991 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1993 if test "x$withval" = "xno"
1996 else if test "x$withval" = "xyes"
2000 with_java_home="$withval"
2005 if test "x$with_java" = "xyes"
2007 if test -d "$with_java_home"
2009 AC_MSG_CHECKING([for jni.h])
2010 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2011 if test "x$TMPDIR" != "x"
2013 AC_MSG_RESULT([found in $TMPDIR])
2014 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
2016 AC_MSG_RESULT([not found])
2019 AC_MSG_CHECKING([for jni_md.h])
2020 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2021 if test "x$TMPDIR" != "x"
2023 AC_MSG_RESULT([found in $TMPDIR])
2024 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
2026 AC_MSG_RESULT([not found])
2029 AC_MSG_CHECKING([for libjvm.so])
2030 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2031 if test "x$TMPDIR" != "x"
2033 AC_MSG_RESULT([found in $TMPDIR])
2034 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
2036 AC_MSG_RESULT([not found])
2039 if test "x$JAVAC" = "x"
2041 AC_MSG_CHECKING([for javac])
2042 TMPDIR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2043 if test "x$TMPDIR" != "x"
2046 AC_MSG_RESULT([$JAVAC])
2048 AC_MSG_RESULT([not found])
2051 if test "x$JAR" = "x"
2053 AC_MSG_CHECKING([for jar])
2054 TMPDIR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2055 if test "x$TMPDIR" != "x"
2058 AC_MSG_RESULT([$JAR])
2060 AC_MSG_RESULT([not found])
2063 else if test "x$with_java_home" != "x"
2065 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2069 if test "x$JAVA_CPPFLAGS" != "x"
2071 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2073 if test "x$JAVA_CFLAGS" != "x"
2075 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2077 if test "x$JAVA_LDFLAGS" != "x"
2079 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2081 if test "x$JAVAC" = "x"
2083 with_javac_path="$PATH"
2084 if test "x$with_java_home" != "x"
2086 with_javac_path="$with_java_home:with_javac_path"
2087 if test -d "$with_java_home/bin"
2089 with_javac_path="$with_java_home/bin:with_javac_path"
2093 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2095 if test "x$JAVAC" = "x"
2097 with_java="no (javac not found)"
2099 if test "x$JAR" = "x"
2101 with_jar_path="$PATH"
2102 if test "x$with_java_home" != "x"
2104 with_jar_path="$with_java_home:$with_jar_path"
2105 if test -d "$with_java_home/bin"
2107 with_jar_path="$with_java_home/bin:$with_jar_path"
2111 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2113 if test "x$JAR" = "x"
2115 with_java="no (jar not found)"
2118 SAVE_CPPFLAGS="$CPPFLAGS"
2119 SAVE_CFLAGS="$CFLAGS"
2120 SAVE_LDFLAGS="$LDFLAGS"
2121 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2122 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2123 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2125 if test "x$with_java" = "xyes"
2127 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2129 if test "x$with_java" = "xyes"
2131 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2133 [with_java="no (libjvm not found)"],
2136 if test "x$with_java" = "xyes"
2138 JAVA_LIBS="$JAVA_LIBS -ljvm"
2139 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2142 CPPFLAGS="$SAVE_CPPFLAGS"
2143 CFLAGS="$SAVE_CFLAGS"
2144 LDFLAGS="$SAVE_LDFLAGS"
2146 AC_SUBST(JAVA_CPPFLAGS)
2147 AC_SUBST(JAVA_CFLAGS)
2148 AC_SUBST(JAVA_LDFLAGS)
2150 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2153 # --with-libmemcached {{{
2154 with_libmemcached_cppflags=""
2155 with_libmemcached_ldflags=""
2156 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2158 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2160 with_libmemcached_cppflags="-I$withval/include"
2161 with_libmemcached_ldflags="-L$withval/lib"
2162 with_libmemcached="yes"
2164 with_libmemcached="$withval"
2168 with_libmemcached="yes"
2170 if test "x$with_libmemcached" = "xyes"
2172 SAVE_CPPFLAGS="$CPPFLAGS"
2173 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2175 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2177 CPPFLAGS="$SAVE_CPPFLAGS"
2179 if test "x$with_libmemcached" = "xyes"
2181 SAVE_CPPFLAGS="$CPPFLAGS"
2182 SAVE_LDFLAGS="$LDFLAGS"
2183 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2184 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2186 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2188 CPPFLAGS="$SAVE_CPPFLAGS"
2189 LDFLAGS="$SAVE_LDFLAGS"
2191 if test "x$with_libmemcached" = "xyes"
2193 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2194 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2195 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2196 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2197 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2198 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2199 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2201 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2204 # --with-libmodbus {{{
2205 with_libmodbus_config=""
2206 with_libmodbus_cflags=""
2207 with_libmodbus_libs=""
2208 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2210 if test "x$withval" = "xno"
2213 else if test "x$withval" = "xyes"
2215 with_libmodbus="use_pkgconfig"
2216 else if test -d "$with_libmodbus/lib"
2218 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2219 with_libmodbus_cflags="-I$withval/include"
2220 with_libmodbus_libs="-L$withval/lib -lmodbus"
2221 with_libmodbus="yes"
2224 [with_libmodbus="use_pkgconfig"])
2226 # configure using pkg-config
2227 if test "x$with_libmodbus" = "xuse_pkgconfig"
2229 if test "x$PKG_CONFIG" = "x"
2231 with_libmodbus="no (Don't have pkg-config)"
2234 if test "x$with_libmodbus" = "xuse_pkgconfig"
2236 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2237 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2240 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2243 if test "x$with_libmodbus" = "xuse_pkgconfig"
2245 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2248 with_libmodbus="no ($PKG_CONFIG failed)"
2250 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2253 with_libmodbus="no ($PKG_CONFIG failed)"
2256 if test "x$with_libmodbus" = "xuse_pkgconfig"
2258 with_libmodbus="yes"
2261 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2262 # the actual checks.
2263 if test "x$with_libmodbus" = "xyes"
2265 SAVE_CPPFLAGS="$CPPFLAGS"
2266 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2268 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2270 CPPFLAGS="$SAVE_CPPFLAGS"
2272 if test "x$with_libmodbus" = "xyes"
2274 SAVE_CPPFLAGS="$CPPFLAGS"
2275 SAVE_LDFLAGS="$LDFLAGS"
2277 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2278 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2280 AC_CHECK_LIB(modbus, modbus_connect,
2281 [with_libmodbus="yes"],
2282 [with_libmodbus="no (symbol modbus_connect not found)"])
2284 CPPFLAGS="$SAVE_CPPFLAGS"
2285 LDFLAGS="$SAVE_LDFLAGS"
2287 if test "x$with_libmodbus" = "xyes"
2289 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2290 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2291 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2292 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2296 # --with-libmongoc {{{
2297 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2299 if test "x$withval" = "xyes"
2301 with_libmongoc="yes"
2302 else if test "x$withval" = "xno"
2306 with_libmongoc="yes"
2307 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2308 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2311 [with_libmongoc="yes"])
2313 SAVE_CPPFLAGS="$CPPFLAGS"
2314 SAVE_LDFLAGS="$LDFLAGS"
2316 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2317 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2319 if test "x$with_libmongoc" = "xyes"
2321 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2323 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2325 AC_CHECK_HEADERS(mongo.h,
2326 [with_libmongoc="yes"],
2327 [with_libmongoc="no ('mongo.h' not found)"],
2329 # define MONGO_HAVE_STDINT 1
2331 # define MONGO_USE_LONG_LONG_INT 1
2335 if test "x$with_libmongoc" = "xyes"
2337 if test "x$LIBMONGOC_LDFLAGS" != "x"
2339 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2341 AC_CHECK_LIB(mongoc, mongo_run_command,
2342 [with_libmongoc="yes"],
2343 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2346 CPPFLAGS="$SAVE_CPPFLAGS"
2347 LDFLAGS="$SAVE_LDFLAGS"
2349 if test "x$with_libmongoc" = "xyes"
2351 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2352 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2353 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2354 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2356 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2359 # --with-libmysql {{{
2360 with_mysql_config="mysql_config"
2361 with_mysql_cflags=""
2363 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2365 if test "x$withval" = "xno"
2368 else if test "x$withval" = "xyes"
2372 if test -f "$withval" && test -x "$withval";
2374 with_mysql_config="$withval"
2375 else if test -x "$withval/bin/mysql_config"
2377 with_mysql_config="$withval/bin/mysql_config"
2385 if test "x$with_libmysql" = "xyes"
2387 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2388 mysql_config_status=$?
2390 if test $mysql_config_status -ne 0
2392 with_libmysql="no ($with_mysql_config failed)"
2394 SAVE_CPPFLAGS="$CPPFLAGS"
2395 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2398 have_mysql_mysql_h="no"
2399 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2401 if test "x$have_mysql_h" = "xno"
2403 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2406 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2408 with_libmysql="no (mysql.h not found)"
2411 CPPFLAGS="$SAVE_CPPFLAGS"
2414 if test "x$with_libmysql" = "xyes"
2416 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2417 mysql_config_status=$?
2419 if test $mysql_config_status -ne 0
2421 with_libmysql="no ($with_mysql_config failed)"
2423 AC_CHECK_LIB(mysqlclient, mysql_init,
2424 [with_libmysql="yes"],
2425 [with_libmysql="no (symbol 'mysql_init' not found)"],
2428 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2429 [with_libmysql="yes"],
2430 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2434 if test "x$with_libmysql" = "xyes"
2436 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2437 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2438 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2439 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2441 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2444 # --with-libnetlink {{{
2445 with_libnetlink_cflags=""
2446 with_libnetlink_libs="-lnetlink"
2447 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2449 echo "libnetlink: withval = $withval"
2450 if test "x$withval" = "xyes"
2452 with_libnetlink="yes"
2453 else if test "x$withval" = "xno"
2455 with_libnetlink="no"
2457 if test -d "$withval/include"
2459 with_libnetlink_cflags="-I$withval/include"
2460 with_libnetlink_libs="-L$withval/lib -lnetlink"
2461 with_libnetlink="yes"
2463 AC_MSG_ERROR("no such directory: $withval/include")
2468 if test "x$ac_system" = "xLinux"
2470 with_libnetlink="yes"
2472 with_libnetlink="no (Linux only library)"
2475 if test "x$with_libnetlink" = "xyes"
2477 SAVE_CFLAGS="$CFLAGS"
2478 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2480 with_libnetlink="no (libnetlink.h not found)"
2482 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2484 with_libnetlink="yes"
2488 #include <sys/types.h>
2489 #include <asm/types.h>
2490 #include <sys/socket.h>
2491 #include <linux/netlink.h>
2492 #include <linux/rtnetlink.h>])
2493 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2495 #include <sys/types.h>
2496 #include <asm/types.h>
2497 #include <sys/socket.h>])
2499 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2502 #include <sys/types.h>
2503 #include <asm/types.h>
2504 #include <sys/socket.h>
2505 #include <linux/netlink.h>
2506 #include <linux/rtnetlink.h>
2509 int retval = TCA_STATS2;
2513 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2515 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2518 #include <sys/types.h>
2519 #include <asm/types.h>
2520 #include <sys/socket.h>
2521 #include <linux/netlink.h>
2522 #include <linux/rtnetlink.h>
2525 int retval = TCA_STATS;
2529 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2531 CFLAGS="$SAVE_CFLAGS"
2533 if test "x$with_libnetlink" = "xyes"
2535 AC_CHECK_LIB(netlink, rtnl_open,
2536 [with_libnetlink="yes"],
2537 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2538 [$with_libnetlink_libs])
2540 if test "x$with_libnetlink" = "xyes"
2542 SAVE_CFLAGS="$CFLAGS"
2543 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2546 [if function 'rtnl_dump_filter' expects five arguments],
2547 [c_cv_rtnl_dump_filter_five_args],
2548 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2551 #include <sys/types.h>
2552 #include <asm/types.h>
2553 #include <sys/socket.h>
2554 #if HAVE_LIBNETLINK_H
2555 # include <libnetlink.h>
2556 #elif HAVE_IPROUTE_LIBNETLINK_H
2557 # include <iproute/libnetlink.h>
2558 #elif HAVE_LINUX_LIBNETLINK_H
2559 # include <linux/libnetlink.h>
2563 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2568 [c_cv_rtnl_dump_filter_five_args="yes"],
2569 [c_cv_rtnl_dump_filter_five_args="no"]
2574 [if function 'rtnl_dump_filter' expects three arguments],
2575 [c_cv_rtnl_dump_filter_three_args],
2576 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2579 #include <sys/types.h>
2580 #include <asm/types.h>
2581 #include <sys/socket.h>
2582 #if HAVE_LIBNETLINK_H
2583 # include <libnetlink.h>
2584 #elif HAVE_IPROUTE_LIBNETLINK_H
2585 # include <iproute/libnetlink.h>
2586 #elif HAVE_LINUX_LIBNETLINK_H
2587 # include <linux/libnetlink.h>
2591 if (rtnl_dump_filter(NULL, NULL, NULL))
2596 [c_cv_rtnl_dump_filter_three_args="yes"],
2597 [c_cv_rtnl_dump_filter_three_args="no"]
2601 CFLAGS="$SAVE_CFLAGS"
2603 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2605 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2606 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2608 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2610 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2611 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2614 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2615 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2616 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2617 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2619 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2622 # --with-libnetapp {{{
2623 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2624 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2625 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2626 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2627 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2628 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2629 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2631 if test -d "$withval"
2633 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2634 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2635 with_libnetapp="yes"
2637 with_libnetapp="$withval"
2641 with_libnetapp="yes"
2644 SAVE_CPPFLAGS="$CPPFLAGS"
2645 SAVE_LDFLAGS="$LDFLAGS"
2646 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2647 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2649 if test "x$with_libnetapp" = "xyes"
2651 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2653 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2655 AC_CHECK_HEADERS(netapp_api.h,
2656 [with_libnetapp="yes"],
2657 [with_libnetapp="no (netapp_api.h not found)"])
2660 if test "x$with_libnetapp" = "xyes"
2662 if test "x$LIBNETAPP_LDFLAGS" != "x"
2664 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2667 if test "x$LIBNETAPP_LIBS" = "x"
2669 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2671 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2673 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2674 [with_libnetapp="yes"],
2675 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2677 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2680 CPPFLAGS="$SAVE_CPPFLAGS"
2681 LDFLAGS="$SAVE_LDFLAGS"
2683 if test "x$with_libnetapp" = "xyes"
2685 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2688 AC_SUBST(LIBNETAPP_CPPFLAGS)
2689 AC_SUBST(LIBNETAPP_LDFLAGS)
2690 AC_SUBST(LIBNETAPP_LIBS)
2691 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2694 # --with-libnetsnmp {{{
2695 with_snmp_config="net-snmp-config"
2698 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2700 if test "x$withval" = "xno"
2702 with_libnetsnmp="no"
2703 else if test "x$withval" = "xyes"
2705 with_libnetsnmp="yes"
2707 if test -x "$withval"
2709 with_snmp_config="$withval"
2710 with_libnetsnmp="yes"
2712 with_snmp_config="$withval/bin/net-snmp-config"
2713 with_libnetsnmp="yes"
2717 [with_libnetsnmp="yes"])
2718 if test "x$with_libnetsnmp" = "xyes"
2720 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2721 snmp_config_status=$?
2723 if test $snmp_config_status -ne 0
2725 with_libnetsnmp="no ($with_snmp_config failed)"
2727 SAVE_CPPFLAGS="$CPPFLAGS"
2728 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2730 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2732 CPPFLAGS="$SAVE_CPPFLAGS"
2735 if test "x$with_libnetsnmp" = "xyes"
2737 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2738 snmp_config_status=$?
2740 if test $snmp_config_status -ne 0
2742 with_libnetsnmp="no ($with_snmp_config failed)"
2744 AC_CHECK_LIB(netsnmp, init_snmp,
2745 [with_libnetsnmp="yes"],
2746 [with_libnetsnmp="no (libnetsnmp not found)"],
2750 if test "x$with_libnetsnmp" = "xyes"
2752 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2753 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2754 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2755 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2757 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2760 # --with-liboconfig {{{
2761 with_own_liboconfig="no"
2762 liboconfig_LDFLAGS="$LDFLAGS"
2763 liboconfig_CPPFLAGS="$CPPFLAGS"
2764 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2766 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2768 if test -d "$withval/lib"
2770 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2772 if test -d "$withval/include"
2774 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2777 if test "x$withval" = "xno"
2779 AC_MSG_ERROR("liboconfig is required")
2783 with_liboconfig="yes"
2786 save_LDFLAGS="$LDFLAGS"
2787 save_CPPFLAGS="$CPPFLAGS"
2788 LDFLAGS="$liboconfig_LDFLAGS"
2789 CPPFLAGS="$liboconfig_CPPFLAGS"
2790 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2792 with_liboconfig="yes"
2793 with_own_liboconfig="no"
2796 with_liboconfig="yes"
2797 with_own_liboconfig="yes"
2798 LDFLAGS="$save_LDFLAGS"
2799 CPPFLAGS="$save_CPPFLAGS"
2802 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2803 if test "x$with_own_liboconfig" = "xyes"
2805 with_liboconfig="yes (shipped version)"
2809 # --with-liboping {{{
2810 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2812 if test "x$withval" = "xyes"
2815 else if test "x$withval" = "xno"
2820 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2821 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2824 [with_liboping="yes"])
2826 SAVE_CPPFLAGS="$CPPFLAGS"
2827 SAVE_LDFLAGS="$LDFLAGS"
2829 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2830 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2832 if test "x$with_liboping" = "xyes"
2834 if test "x$LIBOPING_CPPFLAGS" != "x"
2836 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2838 AC_CHECK_HEADERS(oping.h,
2839 [with_liboping="yes"],
2840 [with_liboping="no (oping.h not found)"])
2842 if test "x$with_liboping" = "xyes"
2844 if test "x$LIBOPING_LDFLAGS" != "x"
2846 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2848 AC_CHECK_LIB(oping, ping_construct,
2849 [with_liboping="yes"],
2850 [with_liboping="no (symbol 'ping_construct' not found)"])
2853 CPPFLAGS="$SAVE_CPPFLAGS"
2854 LDFLAGS="$SAVE_LDFLAGS"
2856 if test "x$with_liboping" = "xyes"
2858 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2859 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2860 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2861 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2863 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2867 with_oracle_cppflags=""
2869 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2871 if test "x$withval" = "xyes"
2873 if test "x$ORACLE_HOME" = "x"
2875 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2878 else if test "x$withval" = "xno"
2883 ORACLE_HOME="$withval"
2887 if test "x$ORACLE_HOME" = "x"
2889 with_oracle="no (ORACLE_HOME is not set)"
2894 if test "x$ORACLE_HOME" != "x"
2896 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2898 if test -e "$ORACLE_HOME/lib/ldflags"
2900 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2902 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2903 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2905 if test "x$with_oracle" = "xyes"
2907 SAVE_CPPFLAGS="$CPPFLAGS"
2908 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2910 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2912 CPPFLAGS="$SAVE_CPPFLAGS"
2914 if test "x$with_oracle" = "xyes"
2916 SAVE_CPPFLAGS="$CPPFLAGS"
2917 SAVE_LDFLAGS="$LDFLAGS"
2918 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2919 LDFLAGS="$LDFLAGS $with_oracle_libs"
2921 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2923 CPPFLAGS="$SAVE_CPPFLAGS"
2924 LDFLAGS="$SAVE_LDFLAGS"
2926 if test "x$with_oracle" = "xyes"
2928 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2929 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2930 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2931 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2935 # --with-libowcapi {{{
2936 with_libowcapi_cppflags=""
2937 with_libowcapi_libs="-lowcapi"
2938 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2940 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2942 with_libowcapi_cppflags="-I$withval/include"
2943 with_libowcapi_libs="-L$withval/lib -lowcapi"
2944 with_libowcapi="yes"
2946 with_libowcapi="$withval"
2950 with_libowcapi="yes"
2952 if test "x$with_libowcapi" = "xyes"
2954 SAVE_CPPFLAGS="$CPPFLAGS"
2955 CPPFLAGS="$with_libowcapi_cppflags"
2957 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2959 CPPFLAGS="$SAVE_CPPFLAGS"
2961 if test "x$with_libowcapi" = "xyes"
2963 SAVE_LDFLAGS="$LDFLAGS"
2964 SAVE_CPPFLAGS="$CPPFLAGS"
2965 LDFLAGS="$with_libowcapi_libs"
2966 CPPFLAGS="$with_libowcapi_cppflags"
2968 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2970 LDFLAGS="$SAVE_LDFLAGS"
2971 CPPFLAGS="$SAVE_CPPFLAGS"
2973 if test "x$with_libowcapi" = "xyes"
2975 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2976 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2977 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2978 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2982 # --with-libpcap {{{
2983 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2985 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2987 LDFLAGS="$LDFLAGS -L$withval/lib"
2988 CPPFLAGS="$CPPFLAGS -I$withval/include"
2991 with_libpcap="$withval"
2997 if test "x$with_libpcap" = "xyes"
2999 AC_CHECK_LIB(pcap, pcap_open_live,
3001 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
3002 ], [with_libpcap="no (libpcap not found)"])
3004 if test "x$with_libpcap" = "xyes"
3006 AC_CHECK_HEADERS(pcap.h,,
3007 [with_libpcap="no (pcap.h not found)"])
3009 if test "x$with_libpcap" = "xyes"
3011 AC_CHECK_HEADERS(pcap-bpf.h,,
3012 [with_libpcap="no (pcap-bpf.h not found)"])
3014 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3017 # --with-libperl {{{
3018 perl_interpreter="perl"
3019 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3021 if test -f "$withval" && test -x "$withval"
3023 perl_interpreter="$withval"
3025 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3027 LDFLAGS="$LDFLAGS -L$withval/lib"
3028 CPPFLAGS="$CPPFLAGS -I$withval/include"
3029 perl_interpreter="$withval/bin/perl"
3032 with_libperl="$withval"
3039 AC_MSG_CHECKING([for perl])
3040 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3041 if test -x "$perl_interpreter"
3043 AC_MSG_RESULT([yes ($perl_interpreter)])
3049 AC_SUBST(PERL, "$perl_interpreter")
3051 if test "x$with_libperl" = "xyes" \
3052 && test -n "$perl_interpreter"
3054 SAVE_CFLAGS="$CFLAGS"
3055 SAVE_LDFLAGS="$LDFLAGS"
3056 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3057 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3058 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3059 CFLAGS="$CFLAGS $PERL_CFLAGS"
3060 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3062 AC_CACHE_CHECK([for libperl],
3063 [c_cv_have_libperl],
3067 #define PERL_NO_GET_CONTEXT
3074 load_module (PERL_LOADMOD_NOIMPORT,
3075 newSVpv ("Collectd::Plugin::FooBar", 24),
3078 [c_cv_have_libperl="yes"],
3079 [c_cv_have_libperl="no"]
3083 if test "x$c_cv_have_libperl" = "xyes"
3085 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3086 AC_SUBST(PERL_CFLAGS)
3087 AC_SUBST(PERL_LDFLAGS)
3092 CFLAGS="$SAVE_CFLAGS"
3093 LDFLAGS="$SAVE_LDFLAGS"
3094 else if test -z "$perl_interpreter"; then
3095 with_libperl="no (no perl interpreter found)"
3096 c_cv_have_libperl="no"
3098 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3100 if test "x$with_libperl" = "xyes"
3102 SAVE_CFLAGS="$CFLAGS"
3103 SAVE_LDFLAGS="$LDFLAGS"
3104 CFLAGS="$CFLAGS $PERL_CFLAGS"
3105 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3107 AC_CACHE_CHECK([if perl supports ithreads],
3108 [c_cv_have_perl_ithreads],
3116 #if !defined(USE_ITHREADS)
3117 # error "Perl does not support ithreads!"
3118 #endif /* !defined(USE_ITHREADS) */
3121 [c_cv_have_perl_ithreads="yes"],
3122 [c_cv_have_perl_ithreads="no"]
3126 if test "x$c_cv_have_perl_ithreads" = "xyes"
3128 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3131 CFLAGS="$SAVE_CFLAGS"
3132 LDFLAGS="$SAVE_LDFLAGS"
3135 if test "x$with_libperl" = "xyes"
3137 SAVE_CFLAGS="$CFLAGS"
3138 SAVE_LDFLAGS="$LDFLAGS"
3139 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3140 # (see issues #41 and #42)
3141 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3142 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3144 AC_CACHE_CHECK([for broken Perl_load_module()],
3145 [c_cv_have_broken_perl_load_module],
3149 #define PERL_NO_GET_CONTEXT
3156 load_module (PERL_LOADMOD_NOIMPORT,
3157 newSVpv ("Collectd::Plugin::FooBar", 24),
3160 [c_cv_have_broken_perl_load_module="no"],
3161 [c_cv_have_broken_perl_load_module="yes"]
3165 CFLAGS="$SAVE_CFLAGS"
3166 LDFLAGS="$SAVE_LDFLAGS"
3168 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3169 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3171 if test "x$with_libperl" = "xyes"
3173 SAVE_CFLAGS="$CFLAGS"
3174 SAVE_LDFLAGS="$LDFLAGS"
3175 CFLAGS="$CFLAGS $PERL_CFLAGS"
3176 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3179 [struct mgvtbl.svt_local],
3180 [have_struct_mgvtbl_svt_local="yes"],
3181 [have_struct_mgvtbl_svt_local="no"],
3188 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3190 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3191 [Define if Perl's struct mgvtbl has member svt_local.])
3194 CFLAGS="$SAVE_CFLAGS"
3195 LDFLAGS="$SAVE_LDFLAGS"
3200 with_pg_config="pg_config"
3201 with_libpq_includedir=""
3202 with_libpq_libdir=""
3203 with_libpq_cppflags=""
3204 with_libpq_ldflags=""
3205 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3208 if test "x$withval" = "xno"
3211 else if test "x$withval" = "xyes"
3215 if test -f "$withval" && test -x "$withval";
3217 with_pg_config="$withval"
3218 else if test -x "$withval/bin/pg_config"
3220 with_pg_config="$withval/bin/pg_config"
3228 if test "x$with_libpq" = "xyes"
3230 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3233 if test $pg_config_status -eq 0
3235 if test -n "$with_libpq_includedir"; then
3236 for dir in $with_libpq_includedir; do
3237 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3241 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3244 SAVE_CPPFLAGS="$CPPFLAGS"
3245 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3247 AC_CHECK_HEADERS(libpq-fe.h, [],
3248 [with_libpq="no (libpq-fe.h not found)"], [])
3250 CPPFLAGS="$SAVE_CPPFLAGS"
3252 if test "x$with_libpq" = "xyes"
3254 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3257 if test $pg_config_status -eq 0
3259 if test -n "$with_libpq_libdir"; then
3260 for dir in $with_libpq_libdir; do
3261 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3265 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3268 SAVE_LDFLAGS="$LDFLAGS"
3269 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3271 AC_CHECK_LIB(pq, PQconnectdb,
3273 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3275 AC_CHECK_LIB(pq, PQserverVersion,
3277 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3279 LDFLAGS="$SAVE_LDFLAGS"
3281 if test "x$with_libpq" = "xyes"
3283 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3284 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3285 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3286 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3288 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3291 # --with-libpthread {{{
3292 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3293 [ if test "x$withval" != "xno" \
3294 && test "x$withval" != "xyes"
3296 LDFLAGS="$LDFLAGS -L$withval/lib"
3297 CPPFLAGS="$CPPFLAGS -I$withval/include"
3298 with_libpthread="yes"
3300 if test "x$withval" = "xno"
3302 with_libpthread="no (disabled)"
3305 ], [with_libpthread="yes"])
3306 if test "x$with_libpthread" = "xyes"
3308 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3311 if test "x$with_libpthread" = "xyes"
3313 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3315 if test "x$with_libpthread" = "xyes"
3321 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3322 [Wether or not to use pthread (POSIX threads) library])
3323 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3328 with_python_path="$PATH"
3329 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3331 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3333 with_python="$withval"
3334 else if test -x "$withval"
3336 with_python_prog="$withval"
3337 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3339 else if test -d "$withval"
3341 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3344 AC_MSG_WARN([Argument not recognized: $withval])
3346 ], [with_python="yes"])
3349 SAVE_CPPFLAGS="$CPPFLAGS"
3350 SAVE_LDFLAGS="$LDFLAGS"
3353 PATH="$with_python_path"
3355 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3357 AC_MSG_CHECKING([for python])
3358 with_python_prog="`which python 2>/dev/null`"
3359 if test "x$with_python_prog" = "x"
3361 AC_MSG_RESULT([not found])
3362 with_python="no (interpreter not found)"
3364 AC_MSG_RESULT([$with_python_prog])
3368 if test "x$with_python" = "xyes"
3370 AC_MSG_CHECKING([for Python CPPFLAGS])
3371 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3372 python_config_status=$?
3374 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3376 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3379 AC_MSG_RESULT([$python_include_path])
3383 if test "x$with_python" = "xyes"
3385 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3386 AC_CHECK_HEADERS(Python.h,
3387 [with_python="yes"],
3388 [with_python="no ('Python.h' not found)"])
3391 if test "x$with_python" = "xyes"
3393 AC_MSG_CHECKING([for Python LDFLAGS])
3394 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`
3395 python_config_status=$?
3397 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3399 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3402 AC_MSG_RESULT([$python_library_path])
3406 if test "x$with_python" = "xyes"
3408 AC_MSG_CHECKING([for Python LIBS])
3409 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`
3410 python_config_status=$?
3412 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3414 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3417 AC_MSG_RESULT([$python_library_flags])
3421 if test "x$with_python" = "xyes"
3423 LDFLAGS="-L$python_library_path $LDFLAGS"
3424 LIBS="$python_library_flags $LIBS"
3426 AC_CHECK_FUNC(PyObject_CallFunction,
3427 [with_python="yes"],
3428 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3432 CPPFLAGS="$SAVE_CPPFLAGS"
3433 LDFLAGS="$SAVE_LDFLAGS"
3436 if test "x$with_python" = "xyes"
3438 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3439 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3440 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3441 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3442 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3443 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3447 # --with-librabbitmq {{{
3448 with_librabbitmq_cppflags=""
3449 with_librabbitmq_ldflags=""
3450 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3452 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3454 with_librabbitmq_cppflags="-I$withval/include"
3455 with_librabbitmq_ldflags="-L$withval/lib"
3456 with_librabbitmq="yes"
3458 with_librabbitmq="$withval"
3462 with_librabbitmq="yes"
3464 SAVE_CPPFLAGS="$CPPFLAGS"
3465 SAVE_LDFLAGS="$LDFLAGS"
3466 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3467 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3468 if test "x$with_librabbitmq" = "xyes"
3470 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3472 if test "x$with_librabbitmq" = "xyes"
3474 # librabbitmq up to version 0.9.1 provides "library_errno", later
3475 # versions use "library_error". The library does not provide a version
3476 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3477 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3480 # include <stdlib.h>
3486 # include <stdint.h>
3489 # include <inttypes.h>
3494 if test "x$with_librabbitmq" = "xyes"
3496 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3498 if test "x$with_librabbitmq" = "xyes"
3500 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3501 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3502 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3503 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3504 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3505 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3506 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3508 CPPFLAGS="$SAVE_CPPFLAGS"
3509 LDFLAGS="$SAVE_LDFLAGS"
3510 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3513 # --with-librouteros {{{
3514 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3516 if test "x$withval" = "xyes"
3518 with_librouteros="yes"
3519 else if test "x$withval" = "xno"
3521 with_librouteros="no"
3523 with_librouteros="yes"
3524 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3525 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3528 [with_librouteros="yes"])
3530 SAVE_CPPFLAGS="$CPPFLAGS"
3531 SAVE_LDFLAGS="$LDFLAGS"
3533 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3534 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3536 if test "x$with_librouteros" = "xyes"
3538 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3540 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3542 AC_CHECK_HEADERS(routeros_api.h,
3543 [with_librouteros="yes"],
3544 [with_librouteros="no (routeros_api.h not found)"])
3546 if test "x$with_librouteros" = "xyes"
3548 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3550 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3552 AC_CHECK_LIB(routeros, ros_interface,
3553 [with_librouteros="yes"],
3554 [with_librouteros="no (symbol 'ros_interface' not found)"])
3557 CPPFLAGS="$SAVE_CPPFLAGS"
3558 LDFLAGS="$SAVE_LDFLAGS"
3560 if test "x$with_librouteros" = "xyes"
3562 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3563 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3564 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3565 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3567 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3571 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3574 librrd_threadsafe="yes"
3575 librrd_rrdc_update="no"
3576 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3577 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3579 librrd_cflags="-I$withval/include"
3580 librrd_ldflags="-L$withval/lib"
3583 with_librrd="$withval"
3585 ], [with_librrd="yes"])
3586 if test "x$with_librrd" = "xyes"
3588 SAVE_CPPFLAGS="$CPPFLAGS"
3589 SAVE_LDFLAGS="$LDFLAGS"
3591 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3592 LDFLAGS="$LDFLAGS $librrd_ldflags"
3594 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3596 CPPFLAGS="$SAVE_CPPFLAGS"
3597 LDFLAGS="$SAVE_LDFLAGS"
3599 if test "x$with_librrd" = "xyes"
3601 SAVE_CPPFLAGS="$CPPFLAGS"
3602 SAVE_LDFLAGS="$LDFLAGS"
3604 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3605 LDFLAGS="$LDFLAGS $librrd_ldflags"
3607 AC_CHECK_LIB(rrd_th, rrd_update_r,
3609 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3611 [librrd_threadsafe="no"
3612 AC_CHECK_LIB(rrd, rrd_update,
3614 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3616 [with_librrd="no (symbol 'rrd_update' not found)"],
3621 if test "x$librrd_threadsafe" = "xyes"
3623 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3625 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3628 CPPFLAGS="$SAVE_CPPFLAGS"
3629 LDFLAGS="$SAVE_LDFLAGS"
3631 if test "x$with_librrd" = "xyes"
3633 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3634 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3635 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3636 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3638 if test "x$librrd_threadsafe" = "xyes"
3640 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3644 # --with-libsensors {{{
3645 with_sensors_cflags=""
3646 with_sensors_ldflags=""
3647 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3649 if test "x$withval" = "xno"
3651 with_libsensors="no"
3653 with_libsensors="yes"
3654 if test "x$withval" != "xyes"
3656 with_sensors_cflags="-I$withval/include"
3657 with_sensors_ldflags="-L$withval/lib"
3658 with_libsensors="yes"
3663 if test "x$ac_system" = "xLinux"
3665 with_libsensors="yes"
3667 with_libsensors="no (Linux only library)"
3670 if test "x$with_libsensors" = "xyes"
3672 SAVE_CPPFLAGS="$CPPFLAGS"
3673 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3675 # AC_CHECK_HEADERS(sensors/sensors.h,
3677 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3679 # [with_libsensors="no (sensors/sensors.h not found)"])
3680 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3682 CPPFLAGS="$SAVE_CPPFLAGS"
3684 if test "x$with_libsensors" = "xyes"
3686 SAVE_CPPFLAGS="$CPPFLAGS"
3687 SAVE_LDFLAGS="$LDFLAGS"
3688 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3689 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3691 AC_CHECK_LIB(sensors, sensors_init,
3693 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3695 [with_libsensors="no (libsensors not found)"])
3697 CPPFLAGS="$SAVE_CPPFLAGS"
3698 LDFLAGS="$SAVE_LDFLAGS"
3700 if test "x$with_libsensors" = "xyes"
3702 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3703 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3704 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3705 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3707 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3710 # --with-libstatgrab {{{
3711 with_libstatgrab_cflags=""
3712 with_libstatgrab_ldflags=""
3713 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3715 if test "x$withval" != "xno" \
3716 && test "x$withval" != "xyes"
3718 with_libstatgrab_cflags="-I$withval/include"
3719 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3720 with_libstatgrab="yes"
3721 with_libstatgrab_pkg_config="no"
3723 with_libstatgrab="$withval"
3724 with_libstatgrab_pkg_config="yes"
3728 with_libstatgrab="yes"
3729 with_libstatgrab_pkg_config="yes"
3732 if test "x$with_libstatgrab" = "xyes" \
3733 && test "x$with_libstatgrab_pkg_config" = "xyes"
3735 if test "x$PKG_CONFIG" != "x"
3737 AC_MSG_CHECKING([pkg-config for libstatgrab])
3739 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3742 with_libstatgrab_pkg_config="no"
3743 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3744 temp_result="not found"
3746 AC_MSG_RESULT([$temp_result])
3748 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3749 with_libstatgrab_pkg_config="no"
3750 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3754 if test "x$with_libstatgrab" = "xyes" \
3755 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3756 && test "x$with_libstatgrab_cflags" = "x"
3758 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3759 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3762 with_libstatgrab_cflags="$temp_result"
3764 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3765 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3767 AC_MSG_RESULT([$temp_result])
3770 if test "x$with_libstatgrab" = "xyes" \
3771 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3772 && test "x$with_libstatgrab_ldflags" = "x"
3774 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3775 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3778 with_libstatgrab_ldflags="$temp_result"
3780 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3781 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3783 AC_MSG_RESULT([$temp_result])
3786 if test "x$with_libstatgrab" = "xyes"
3788 SAVE_CPPFLAGS="$CPPFLAGS"
3789 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3791 AC_CHECK_HEADERS(statgrab.h,
3792 [with_libstatgrab="yes"],
3793 [with_libstatgrab="no (statgrab.h not found)"])
3795 CPPFLAGS="$SAVE_CPPFLAGS"
3798 if test "x$with_libstatgrab" = "xyes"
3800 SAVE_CFLAGS="$CFLAGS"
3801 SAVE_LDFLAGS="$LDFLAGS"
3803 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3804 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3806 AC_CHECK_LIB(statgrab, sg_init,
3807 [with_libstatgrab="yes"],
3808 [with_libstatgrab="no (symbol sg_init not found)"])
3810 CFLAGS="$SAVE_CFLAGS"
3811 LDFLAGS="$SAVE_LDFLAGS"
3814 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3815 if test "x$with_libstatgrab" = "xyes"
3817 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3818 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3819 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3820 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3821 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3825 # --with-libtokyotyrant {{{
3826 with_libtokyotyrant_cppflags=""
3827 with_libtokyotyrant_ldflags=""
3828 with_libtokyotyrant_libs=""
3829 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3831 if test "x$withval" = "xno"
3833 with_libtokyotyrant="no"
3834 else if test "x$withval" = "xyes"
3836 with_libtokyotyrant="yes"
3838 with_libtokyotyrant_cppflags="-I$withval/include"
3839 with_libtokyotyrant_ldflags="-L$withval/include"
3840 with_libtokyotyrant_libs="-ltokyotyrant"
3841 with_libtokyotyrant="yes"
3845 with_libtokyotyrant="yes"
3848 if test "x$with_libtokyotyrant" = "xyes"
3850 if $PKG_CONFIG --exists tokyotyrant
3852 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3853 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3854 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3858 SAVE_CPPFLAGS="$CPPFLAGS"
3859 SAVE_LDFLAGS="$LDFLAGS"
3860 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3861 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3863 if test "x$with_libtokyotyrant" = "xyes"
3865 AC_CHECK_HEADERS(tcrdb.h,
3867 AC_DEFINE(HAVE_TCRDB_H, 1,
3868 [Define to 1 if you have the <tcrdb.h> header file.])
3869 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3872 if test "x$with_libtokyotyrant" = "xyes"
3874 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3876 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3877 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3879 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3880 [$with_libtokyotyrant_libs])
3883 CPPFLAGS="$SAVE_CPPFLAGS"
3884 LDFLAGS="$SAVE_LDFLAGS"
3886 if test "x$with_libtokyotyrant" = "xyes"
3888 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3889 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3890 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3891 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3892 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3893 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3895 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3898 # --with-libupsclient {{{
3899 with_libupsclient_config=""
3900 with_libupsclient_cflags=""
3901 with_libupsclient_libs=""
3902 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3904 if test "x$withval" = "xno"
3906 with_libupsclient="no"
3907 else if test "x$withval" = "xyes"
3909 with_libupsclient="use_pkgconfig"
3911 if test -x "$withval"
3913 with_libupsclient_config="$withval"
3914 with_libupsclient="use_libupsclient_config"
3915 else if test -x "$withval/bin/libupsclient-config"
3917 with_libupsclient_config="$withval/bin/libupsclient-config"
3918 with_libupsclient="use_libupsclient_config"
3920 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3921 with_libupsclient_cflags="-I$withval/include"
3922 with_libupsclient_libs="-L$withval/lib -lupsclient"
3923 with_libupsclient="yes"
3927 [with_libupsclient="use_pkgconfig"])
3929 # configure using libupsclient-config
3930 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3932 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3933 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3936 with_libupsclient="no ($with_libupsclient_config failed)"
3938 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3941 with_libupsclient="no ($with_libupsclient_config failed)"
3944 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3946 with_libupsclient="yes"
3949 # configure using pkg-config
3950 if test "x$with_libupsclient" = "xuse_pkgconfig"
3952 if test "x$PKG_CONFIG" = "x"
3954 with_libupsclient="no (Don't have pkg-config)"
3957 if test "x$with_libupsclient" = "xuse_pkgconfig"
3959 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3960 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3963 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3966 if test "x$with_libupsclient" = "xuse_pkgconfig"
3968 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3971 with_libupsclient="no ($PKG_CONFIG failed)"
3973 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3976 with_libupsclient="no ($PKG_CONFIG failed)"
3979 if test "x$with_libupsclient" = "xuse_pkgconfig"
3981 with_libupsclient="yes"
3984 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3985 # the actual checks.
3986 if test "x$with_libupsclient" = "xyes"
3988 SAVE_CPPFLAGS="$CPPFLAGS"
3989 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3991 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3993 CPPFLAGS="$SAVE_CPPFLAGS"
3995 if test "x$with_libupsclient" = "xyes"
3997 SAVE_CPPFLAGS="$CPPFLAGS"
3998 SAVE_LDFLAGS="$LDFLAGS"
4000 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4001 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
4003 AC_CHECK_LIB(upsclient, upscli_connect,
4004 [with_libupsclient="yes"],
4005 [with_libupsclient="no (symbol upscli_connect not found)"])
4007 CPPFLAGS="$SAVE_CPPFLAGS"
4008 LDFLAGS="$SAVE_LDFLAGS"
4010 if test "x$with_libupsclient" = "xyes"
4012 SAVE_CPPFLAGS="$CPPFLAGS"
4013 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4015 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4016 [#include <stdlib.h>
4018 #include <upsclient.h>])
4020 CPPFLAGS="$SAVE_CPPFLAGS"
4022 if test "x$with_libupsclient" = "xyes"
4024 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4025 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4026 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4027 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4031 # --with-libxmms {{{
4032 with_xmms_config="xmms-config"
4035 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4037 if test "x$withval" != "xno" \
4038 && test "x$withval" != "xyes"
4040 if test -f "$withval" && test -x "$withval";
4042 with_xmms_config="$withval"
4043 else if test -x "$withval/bin/xmms-config"
4045 with_xmms_config="$withval/bin/xmms-config"
4048 else if test "x$withval" = "xno"
4058 if test "x$with_libxmms" = "xyes"
4060 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4061 xmms_config_status=$?
4063 if test $xmms_config_status -ne 0
4068 if test "x$with_libxmms" = "xyes"
4070 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4071 xmms_config_status=$?
4073 if test $xmms_config_status -ne 0
4078 if test "x$with_libxmms" = "xyes"
4080 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4082 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4083 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4084 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4085 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4092 with_libxmms_numeric=0
4093 if test "x$with_libxmms" = "xyes"
4095 with_libxmms_numeric=1
4097 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4098 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4101 # --with-libyajl {{{
4102 with_libyajl_cppflags=""
4103 with_libyajl_ldflags=""
4104 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4106 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4108 with_libyajl_cppflags="-I$withval/include"
4109 with_libyajl_ldflags="-L$withval/lib"
4112 with_libyajl="$withval"
4118 if test "x$with_libyajl" = "xyes"
4120 SAVE_CPPFLAGS="$CPPFLAGS"
4121 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4123 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4124 AC_CHECK_HEADERS(yajl/yajl_version.h)
4126 CPPFLAGS="$SAVE_CPPFLAGS"
4128 if test "x$with_libyajl" = "xyes"
4130 SAVE_CPPFLAGS="$CPPFLAGS"
4131 SAVE_LDFLAGS="$LDFLAGS"
4132 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4133 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4135 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4137 CPPFLAGS="$SAVE_CPPFLAGS"
4138 LDFLAGS="$SAVE_LDFLAGS"
4140 if test "x$with_libyajl" = "xyes"
4142 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4143 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4144 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4145 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4146 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4147 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4148 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4150 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4153 # --with-libvarnish {{{
4154 with_libvarnish_cppflags=""
4155 with_libvarnish_cflags=""
4156 with_libvarnish_libs=""
4157 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4159 if test "x$withval" = "xno"
4161 with_libvarnish="no"
4162 else if test "x$withval" = "xyes"
4164 with_libvarnish="use_pkgconfig"
4165 else if test -d "$with_libvarnish/lib"
4167 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4168 with_libvarnish_cflags="-I$withval/include"
4169 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4170 with_libvarnish="yes"
4173 [with_libvarnish="use_pkgconfig"])
4175 # configure using pkg-config
4176 if test "x$with_libvarnish" = "xuse_pkgconfig"
4178 if test "x$PKG_CONFIG" = "x"
4180 with_libvarnish="no (Don't have pkg-config)"
4183 if test "x$with_libvarnish" = "xuse_pkgconfig"
4185 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4186 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4189 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4192 if test "x$with_libvarnish" = "xuse_pkgconfig"
4194 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4197 with_libvarnish="no ($PKG_CONFIG failed)"
4199 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4202 with_libvarnish="no ($PKG_CONFIG failed)"
4205 if test "x$with_libvarnish" = "xuse_pkgconfig"
4207 with_libvarnish="yes"
4210 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4211 # the actual checks.
4212 if test "x$with_libvarnish" = "xyes"
4214 SAVE_CPPFLAGS="$CPPFLAGS"
4215 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4216 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4218 CPPFLAGS="$SAVE_CPPFLAGS"
4220 if test "x$with_libvarnish" = "xyes"
4222 SAVE_CPPFLAGS="$CPPFLAGS"
4223 #SAVE_LDFLAGS="$LDFLAGS"
4225 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4226 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4228 AC_CHECK_HEADERS(varnish/vsc.h,
4229 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4230 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4232 CPPFLAGS="$SAVE_CPPFLAGS"
4233 #LDFLAGS="$SAVE_LDFLAGS"
4235 if test "x$with_libvarnish" = "xyes"
4237 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4238 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4239 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4240 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4244 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4245 with_libxml2="no (pkg-config isn't available)"
4246 with_libxml2_cflags=""
4247 with_libxml2_ldflags=""
4248 with_libvirt="no (pkg-config isn't available)"
4249 with_libvirt_cflags=""
4250 with_libvirt_ldflags=""
4251 if test "x$PKG_CONFIG" != "x"
4253 pkg-config --exists 'libxml-2.0' 2>/dev/null
4258 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4261 pkg-config --exists libvirt 2>/dev/null
4266 with_libvirt="no (pkg-config doesn't know libvirt)"
4269 if test "x$with_libxml2" = "xyes"
4271 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4276 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4282 if test "x$with_libxml2" = "xyes"
4284 SAVE_CPPFLAGS="$CPPFLAGS"
4285 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4287 AC_CHECK_HEADERS(libxml/parser.h, [],
4288 [with_libxml2="no (libxml/parser.h not found)"])
4290 CPPFLAGS="$SAVE_CPPFLAGS"
4292 if test "x$with_libxml2" = "xyes"
4294 SAVE_CFLAGS="$CFLAGS"
4295 SAVE_LDFLAGS="$LDFLAGS"
4297 CFLAGS="$CFLAGS $with_libxml2_cflags"
4298 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4300 AC_CHECK_LIB(xml2, xmlXPathEval,
4301 [with_libxml2="yes"],
4302 [with_libxml2="no (symbol xmlXPathEval not found)"])
4304 CFLAGS="$SAVE_CFLAGS"
4305 LDFLAGS="$SAVE_LDFLAGS"
4307 dnl Add the right compiler flags and libraries.
4308 if test "x$with_libxml2" = "xyes"; then
4309 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4310 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4311 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4312 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4314 if test "x$with_libvirt" = "xyes"
4316 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4321 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4327 if test "x$with_libvirt" = "xyes"
4329 SAVE_CPPFLAGS="$CPPFLAGS"
4330 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4332 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4333 [with_libvirt="no (libvirt/libvirt.h not found)"])
4335 CPPFLAGS="$SAVE_CPPFLAGS"
4337 if test "x$with_libvirt" = "xyes"
4339 SAVE_CFLAGS="$CFLAGS"
4340 SAVE_LDFLAGS="$LDFLAGS"
4342 CFLAGS="$CFLAGS $with_libvirt_cflags"
4343 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4345 AC_CHECK_LIB(virt, virDomainBlockStats,
4346 [with_libvirt="yes"],
4347 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4349 CFLAGS="$SAVE_CFLAGS"
4350 LDFLAGS="$SAVE_LDFLAGS"
4352 dnl Add the right compiler flags and libraries.
4353 if test "x$with_libvirt" = "xyes"; then
4354 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4355 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4356 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4357 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4361 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4362 with_libopenipmipthread="yes"
4363 with_libopenipmipthread_cflags=""
4364 with_libopenipmipthread_libs=""
4366 AC_MSG_CHECKING([for pkg-config])
4368 if test "x$PKG_CONFIG" = "x"
4370 with_libopenipmipthread="no"
4373 temp_result="$PKG_CONFIG"
4375 AC_MSG_RESULT([$temp_result])
4377 if test "x$with_libopenipmipthread" = "xyes"
4379 AC_MSG_CHECKING([for libOpenIPMIpthread])
4380 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4383 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4385 AC_MSG_RESULT([$with_libopenipmipthread])
4388 if test "x$with_libopenipmipthread" = "xyes"
4390 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4391 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4394 with_libopenipmipthread_cflags="$temp_result"
4396 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4397 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4399 AC_MSG_RESULT([$temp_result])
4402 if test "x$with_libopenipmipthread" = "xyes"
4404 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4405 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4408 with_libopenipmipthread_ldflags="$temp_result"
4410 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4411 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4413 AC_MSG_RESULT([$temp_result])
4416 if test "x$with_libopenipmipthread" = "xyes"
4418 SAVE_CPPFLAGS="$CPPFLAGS"
4419 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4421 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4422 [with_libopenipmipthread="yes"],
4423 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4424 [#include <OpenIPMI/ipmiif.h>
4425 #include <OpenIPMI/ipmi_err.h>
4426 #include <OpenIPMI/ipmi_posix.h>
4427 #include <OpenIPMI/ipmi_conn.h>
4430 CPPFLAGS="$SAVE_CPPFLAGS"
4433 if test "x$with_libopenipmipthread" = "xyes"
4435 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4436 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4437 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4438 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4442 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4443 [with_libnotify="yes"],
4444 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4447 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4450 # Check for enabled/disabled features
4453 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4454 # ------------------------------------------------------------
4456 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4461 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4466 m4_define([EnDis],[disabled])dnl
4467 m4_define([YesNo],[no])dnl
4473 m4_define([EnDis],[enabled])dnl
4474 m4_define([YesNo],[yes])dnl
4477 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4481 m4_if([$3], [feature], [],
4485 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4491 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4493 enable_$1='[YesNo]'dnl
4495 if test "x$enable_$1" = "xno"
4499 if test "x$enable_$1" = "xyes"
4503 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4508 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4509 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4511 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4513 # AC_PLUGIN(name, default, info)
4514 # ------------------------------------------------------------
4521 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4523 if test "x$enableval" = "xyes"
4526 else if test "x$enableval" = "xforce"
4531 enable_plugin="no (disabled on command line)"
4535 if test "x$enable_all_plugins" = "xauto"
4537 if test "x$2" = "xyes"
4544 enable_plugin="$enable_all_plugins"
4547 if test "x$enable_plugin" = "xyes"
4549 if test "x$2" = "xyes" || test "x$force" = "xyes"
4551 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4552 if test "x$2" != "xyes"
4554 dependency_warning="yes"
4556 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4557 dependency_error="yes"
4558 enable_plugin="no (dependency error)"
4561 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4562 enable_$1="$enable_plugin"
4564 )# AC_PLUGIN(name, default, info)
4566 m4_divert_once([HELP_ENABLE], [
4567 collectd features:])
4568 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4569 AC_COLLECTD([debug], [enable], [feature], [debugging])
4570 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4571 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4573 dependency_warning="no"
4574 dependency_error="no"
4579 plugin_conntrack="no"
4580 plugin_contextswitch="no"
4583 plugin_curl_json="no"
4584 plugin_curl_xml="no"
4590 plugin_interface="no"
4597 plugin_multimeter="no"
4601 plugin_processes="no"
4602 plugin_protocols="no"
4606 plugin_tcpconns="no"
4613 plugin_wireless="no"
4617 if test "x$ac_system" = "xLinux"
4619 plugin_battery="yes"
4620 plugin_conntrack="yes"
4621 plugin_contextswitch="yes"
4623 plugin_cpufreq="yes"
4625 plugin_entropy="yes"
4626 plugin_fscache="yes"
4627 plugin_interface="yes"
4633 plugin_processes="yes"
4634 plugin_protocols="yes"
4637 plugin_tcpconns="yes"
4638 plugin_thermal="yes"
4641 plugin_vserver="yes"
4642 plugin_wireless="yes"
4644 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4650 if test "x$ac_system" = "xOpenBSD"
4652 plugin_tcpconns="yes"
4656 if test "x$with_libiokit" = "xyes"
4658 plugin_battery="yes"
4664 if test "x$ac_system" = "xAIX"
4666 plugin_tcpconns="yes"
4669 if test "x$with_perfstat" = "xyes"
4672 plugin_contextswitch="yes"
4676 plugin_interface="yes"
4681 if test "x$with_procinfo" = "xyes"
4683 plugin_processes="yes"
4687 if test "x$with_kstat" = "xyes"
4691 plugin_zfs_arc="yes"
4694 if test "x$with_devinfo$with_kstat" = "xyesyes"
4698 plugin_interface="yes"
4704 if test "x$with_libstatgrab" = "xyes"
4708 plugin_interface="yes"
4715 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4718 if test "x$have_strptime" = "xyes"
4724 if test "x$with_libopenipmipthread" = "xyes"
4729 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4731 plugin_curl_json="yes"
4734 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4736 plugin_curl_xml="yes"
4739 if test "x$have_processor_info" = "xyes"
4743 if test "x$have_sysctl" = "xyes"
4748 if test "x$ac_system" = "xDarwin"
4753 if test "x$have_sysctlbyname" = "xyes"
4755 plugin_contextswitch="yes"
4758 plugin_tcpconns="yes"
4761 # Df plugin: Check if we know how to determine mount points first.
4762 #if test "x$have_listmntent" = "xyes"; then
4765 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4769 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4773 #if test "x$have_getmntent" = "xseq"
4777 if test "x$c_cv_have_one_getmntent" = "xyes"
4782 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4783 if test "x$plugin_df" = "xyes"
4786 if test "x$have_statfs" = "xyes"
4790 if test "x$have_statvfs" = "xyes"
4796 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
4798 plugin_ethstat="yes"
4801 if test "x$have_getifaddrs" = "xyes"
4803 plugin_interface="yes"
4806 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4808 plugin_libvirt="yes"
4811 if test "x$have_getloadavg" = "xyes"
4816 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4821 # Mac OS X memory interface
4822 if test "x$have_host_statistics" = "xyes"
4827 if test "x$have_termios_h" = "xyes"
4829 plugin_multimeter="yes"
4833 if test "x$have_thread_info" = "xyes"
4835 plugin_processes="yes"
4838 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4840 plugin_processes="yes"
4843 if test "x$with_kvm_getswapinfo" = "xyes"
4848 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4853 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4855 plugin_tcpconns="yes"
4858 if test "x$have_getutent" = "xyes"
4862 if test "x$have_getutxent" = "xyes"
4867 m4_divert_once([HELP_ENABLE], [
4870 AC_ARG_ENABLE([all-plugins],
4871 AC_HELP_STRING([--enable-all-plugins],
4872 [enable all plugins (auto by def)]),
4874 if test "x$enableval" = "xyes"
4876 enable_all_plugins="yes"
4877 else if test "x$enableval" = "xauto"
4879 enable_all_plugins="auto"
4881 enable_all_plugins="no"
4884 [enable_all_plugins="auto"])
4886 m4_divert_once([HELP_ENABLE], [])
4888 AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
4889 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4890 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4891 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4892 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4893 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4894 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4895 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4896 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4897 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4898 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4899 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4900 AC_PLUGIN([csv], [yes], [CSV output plugin])
4901 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4902 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4903 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4904 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4905 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4906 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4907 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4908 AC_PLUGIN([email], [yes], [EMail statistics])
4909 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4910 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
4911 AC_PLUGIN([exec], [yes], [Execution of external programs])
4912 AC_PLUGIN([filecount], [yes], [Count files in directories])
4913 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4914 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4915 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4916 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4917 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4918 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4919 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4920 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4921 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4922 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4923 AC_PLUGIN([load], [$plugin_load], [System load])
4924 AC_PLUGIN([logfile], [yes], [File logging plugin])
4925 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4926 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4927 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4928 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4929 AC_PLUGIN([match_regex], [yes], [The regex match])
4930 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4931 AC_PLUGIN([match_value], [yes], [The value match])
4932 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4933 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
4934 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4935 AC_PLUGIN([memcached], [yes], [memcached statistics])
4936 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4937 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4938 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4939 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4940 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4941 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4942 AC_PLUGIN([network], [yes], [Network communication plugin])
4943 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4944 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4945 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4946 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4947 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4948 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
4949 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4950 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4951 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4952 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4953 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4954 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4955 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
4956 # FIXME: Check for libevent, too.
4957 AC_PLUGIN([pinba], [$have_protobuf_c_h], [Pinba statistics])
4958 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4959 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4960 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4961 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4962 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4963 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4964 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
4965 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4966 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4967 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4968 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4969 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4970 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4971 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4972 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4973 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4974 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4975 AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files])
4976 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4977 AC_PLUGIN([target_notification], [yes], [The notification target])
4978 AC_PLUGIN([target_replace], [yes], [The replace target])
4979 AC_PLUGIN([target_scale],[yes], [The scale target])
4980 AC_PLUGIN([target_set], [yes], [The set target])
4981 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
4982 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4983 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4984 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4985 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4986 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
4987 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4988 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4989 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4990 AC_PLUGIN([users], [$plugin_users], [User statistics])
4991 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4992 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
4993 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4994 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4995 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4996 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
4997 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4998 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
4999 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
5000 AC_PLUGIN([write_riemann], [$have_protobuf_c_h], [Riemann output plugin])
5001 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
5002 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
5004 dnl Default configuration file
5005 # Load either syslog or logfile
5006 LOAD_PLUGIN_SYSLOG=""
5007 LOAD_PLUGIN_LOGFILE=""
5009 AC_MSG_CHECKING([which default log plugin to load])
5010 default_log_plugin="none"
5011 if test "x$enable_syslog" = "xyes"
5013 default_log_plugin="syslog"
5015 LOAD_PLUGIN_SYSLOG="##"
5018 if test "x$enable_logfile" = "xyes"
5020 if test "x$default_log_plugin" = "xnone"
5022 default_log_plugin="logfile"
5024 LOAD_PLUGIN_LOGFILE="#"
5027 LOAD_PLUGIN_LOGFILE="##"
5029 AC_MSG_RESULT([$default_log_plugin])
5031 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5032 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5034 DEFAULT_LOG_LEVEL="info"
5035 if test "x$enable_debug" = "xyes"
5037 DEFAULT_LOG_LEVEL="debug"
5039 AC_SUBST(DEFAULT_LOG_LEVEL)
5041 # Load only one of rrdtool, network, csv in the default config.
5042 LOAD_PLUGIN_RRDTOOL=""
5043 LOAD_PLUGIN_NETWORK=""
5046 AC_MSG_CHECKING([which default write plugin to load])
5047 default_write_plugin="none"
5048 if test "x$enable_rrdtool" = "xyes"
5050 default_write_plugin="rrdtool"
5052 LOAD_PLUGIN_RRDTOOL="##"
5055 if test "x$enable_network" = "xyes"
5057 if test "x$default_write_plugin" = "xnone"
5059 default_write_plugin="network"
5061 LOAD_PLUGIN_NETWORK="#"
5064 LOAD_PLUGIN_NETWORK="##"
5067 if test "x$enable_csv" = "xyes"
5069 if test "x$default_write_plugin" = "xnone"
5071 default_write_plugin="csv"
5076 LOAD_PLUGIN_CSV="##"
5078 AC_MSG_RESULT([$default_write_plugin])
5080 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5081 AC_SUBST(LOAD_PLUGIN_NETWORK)
5082 AC_SUBST(LOAD_PLUGIN_CSV)
5085 if test "x$ac_system" = "xLinux" \
5086 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5088 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5091 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5093 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5097 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5099 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5101 PERL_BINDINGS_OPTIONS="$withval"
5102 with_perl_bindings="yes"
5104 PERL_BINDINGS_OPTIONS=""
5105 with_perl_bindings="$withval"
5109 PERL_BINDINGS_OPTIONS=""
5110 if test -n "$perl_interpreter"
5112 with_perl_bindings="yes"
5114 with_perl_bindings="no (no perl interpreter found)"
5117 if test "x$with_perl_bindings" = "xyes"
5119 PERL_BINDINGS="perl"
5123 AC_SUBST(PERL_BINDINGS)
5124 AC_SUBST(PERL_BINDINGS_OPTIONS)
5126 dnl libcollectdclient
5127 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5128 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5129 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5131 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5133 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5135 AC_SUBST(LCC_VERSION_MAJOR)
5136 AC_SUBST(LCC_VERSION_MINOR)
5137 AC_SUBST(LCC_VERSION_PATCH)
5138 AC_SUBST(LCC_VERSION_EXTRA)
5139 AC_SUBST(LCC_VERSION_STRING)
5141 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5143 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
5145 if test "x$with_librrd" = "xyes" \
5146 && test "x$librrd_threadsafe" != "xyes"
5148 with_librrd="yes (warning: librrd is not thread-safe)"
5151 if test "x$with_libperl" = "xyes"
5153 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5155 enable_perl="no (needs libperl)"
5158 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5160 enable_perl="no (libperl doesn't support ithreads)"
5163 if test "x$with_perl_bindings" = "xyes" \
5164 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5166 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5173 libcurl . . . . . . . $with_libcurl
5174 libdbi . . . . . . . $with_libdbi
5175 libcredis . . . . . . $with_libcredis
5176 libesmtp . . . . . . $with_libesmtp
5177 libganglia . . . . . $with_libganglia
5178 libgcrypt . . . . . . $with_libgcrypt
5179 libiokit . . . . . . $with_libiokit
5180 libiptc . . . . . . . $with_libiptc
5181 libjvm . . . . . . . $with_java
5182 libkstat . . . . . . $with_kstat
5183 libkvm . . . . . . . $with_libkvm
5184 libmemcached . . . . $with_libmemcached
5185 libmodbus . . . . . . $with_libmodbus
5186 libmysql . . . . . . $with_libmysql
5187 libnetapp . . . . . . $with_libnetapp
5188 libnetlink . . . . . $with_libnetlink
5189 libnetsnmp . . . . . $with_libnetsnmp
5190 libnotify . . . . . . $with_libnotify
5191 liboconfig . . . . . $with_liboconfig
5192 libopenipmi . . . . . $with_libopenipmipthread
5193 liboping . . . . . . $with_liboping
5194 libpcap . . . . . . . $with_libpcap
5195 libperfstat . . . . . $with_perfstat
5196 libperl . . . . . . . $with_libperl
5197 libpq . . . . . . . . $with_libpq
5198 libpthread . . . . . $with_libpthread
5199 librabbitmq . . . . . $with_librabbitmq
5200 librouteros . . . . . $with_librouteros
5201 librrd . . . . . . . $with_librrd
5202 libsensors . . . . . $with_libsensors
5203 libstatgrab . . . . . $with_libstatgrab
5204 libtokyotyrant . . . $with_libtokyotyrant
5205 libupsclient . . . . $with_libupsclient
5206 libvarnish . . . . . $with_libvarnish
5207 libvirt . . . . . . . $with_libvirt
5208 libxml2 . . . . . . . $with_libxml2
5209 libxmms . . . . . . . $with_libxmms
5210 libyajl . . . . . . . $with_libyajl
5211 libevent . . . . . . $with_libevent
5212 protobuf-c . . . . . $have_protoc_c
5213 oracle . . . . . . . $with_oracle
5214 python . . . . . . . $with_python
5217 daemon mode . . . . . $enable_daemon
5218 debug . . . . . . . . $enable_debug
5221 perl . . . . . . . . $with_perl_bindings
5224 aggregation . . . . . $enable_aggregation
5225 amqp . . . . . . . $enable_amqp
5226 apache . . . . . . . $enable_apache
5227 apcups . . . . . . . $enable_apcups
5228 apple_sensors . . . . $enable_apple_sensors
5229 ascent . . . . . . . $enable_ascent
5230 battery . . . . . . . $enable_battery
5231 bind . . . . . . . . $enable_bind
5232 conntrack . . . . . . $enable_conntrack
5233 contextswitch . . . . $enable_contextswitch
5234 cpu . . . . . . . . . $enable_cpu
5235 cpufreq . . . . . . . $enable_cpufreq
5236 csv . . . . . . . . . $enable_csv
5237 curl . . . . . . . . $enable_curl
5238 curl_json . . . . . . $enable_curl_json
5239 curl_xml . . . . . . $enable_curl_xml
5240 dbi . . . . . . . . . $enable_dbi
5241 df . . . . . . . . . $enable_df
5242 disk . . . . . . . . $enable_disk
5243 dns . . . . . . . . . $enable_dns
5244 email . . . . . . . . $enable_email
5245 entropy . . . . . . . $enable_entropy
5246 ethstat . . . . . . . $enable_ethstat
5247 exec . . . . . . . . $enable_exec
5248 filecount . . . . . . $enable_filecount
5249 fscache . . . . . . . $enable_fscache
5250 gmond . . . . . . . . $enable_gmond
5251 hddtemp . . . . . . . $enable_hddtemp
5252 interface . . . . . . $enable_interface
5253 ipmi . . . . . . . . $enable_ipmi
5254 iptables . . . . . . $enable_iptables
5255 ipvs . . . . . . . . $enable_ipvs
5256 irq . . . . . . . . . $enable_irq
5257 java . . . . . . . . $enable_java
5258 libvirt . . . . . . . $enable_libvirt
5259 load . . . . . . . . $enable_load
5260 logfile . . . . . . . $enable_logfile
5261 lpar... . . . . . . . $enable_lpar
5262 madwifi . . . . . . . $enable_madwifi
5263 match_empty_counter . $enable_match_empty_counter
5264 match_hashed . . . . $enable_match_hashed
5265 match_regex . . . . . $enable_match_regex
5266 match_timediff . . . $enable_match_timediff
5267 match_value . . . . . $enable_match_value
5268 mbmon . . . . . . . . $enable_mbmon
5269 md . . . . . . . . . $enable_md
5270 memcachec . . . . . . $enable_memcachec
5271 memcached . . . . . . $enable_memcached
5272 memory . . . . . . . $enable_memory
5273 modbus . . . . . . . $enable_modbus
5274 multimeter . . . . . $enable_multimeter
5275 mysql . . . . . . . . $enable_mysql
5276 netapp . . . . . . . $enable_netapp
5277 netlink . . . . . . . $enable_netlink
5278 network . . . . . . . $enable_network
5279 nfs . . . . . . . . . $enable_nfs
5280 nginx . . . . . . . . $enable_nginx
5281 notify_desktop . . . $enable_notify_desktop
5282 notify_email . . . . $enable_notify_email
5283 ntpd . . . . . . . . $enable_ntpd
5284 numa . . . . . . . . $enable_numa
5285 nut . . . . . . . . . $enable_nut
5286 olsrd . . . . . . . . $enable_olsrd
5287 onewire . . . . . . . $enable_onewire
5288 openvpn . . . . . . . $enable_openvpn
5289 oracle . . . . . . . $enable_oracle
5290 perl . . . . . . . . $enable_perl
5291 pf . . . . . . . . . $enable_pf
5292 pinba . . . . . . . . $enable_pinba
5293 ping . . . . . . . . $enable_ping
5294 postgresql . . . . . $enable_postgresql
5295 powerdns . . . . . . $enable_powerdns
5296 processes . . . . . . $enable_processes
5297 protocols . . . . . . $enable_protocols
5298 python . . . . . . . $enable_python
5299 redis . . . . . . . . $enable_redis
5300 routeros . . . . . . $enable_routeros
5301 rrdcached . . . . . . $enable_rrdcached
5302 rrdtool . . . . . . . $enable_rrdtool
5303 sensors . . . . . . . $enable_sensors
5304 serial . . . . . . . $enable_serial
5305 snmp . . . . . . . . $enable_snmp
5306 swap . . . . . . . . $enable_swap
5307 syslog . . . . . . . $enable_syslog
5308 table . . . . . . . . $enable_table
5309 tail . . . . . . . . $enable_tail
5310 tail_csv . . . . . . $enable_tail_csv
5311 tape . . . . . . . . $enable_tape
5312 target_notification . $enable_target_notification
5313 target_replace . . . $enable_target_replace
5314 target_scale . . . . $enable_target_scale
5315 target_set . . . . . $enable_target_set
5316 target_v5upgrade . . $enable_target_v5upgrade
5317 tcpconns . . . . . . $enable_tcpconns
5318 teamspeak2 . . . . . $enable_teamspeak2
5319 ted . . . . . . . . . $enable_ted
5320 thermal . . . . . . . $enable_thermal
5321 threshold . . . . . . $enable_threshold
5322 tokyotyrant . . . . . $enable_tokyotyrant
5323 unixsock . . . . . . $enable_unixsock
5324 uptime . . . . . . . $enable_uptime
5325 users . . . . . . . . $enable_users
5326 uuid . . . . . . . . $enable_uuid
5327 varnish . . . . . . . $enable_varnish
5328 vmem . . . . . . . . $enable_vmem
5329 vserver . . . . . . . $enable_vserver
5330 wireless . . . . . . $enable_wireless
5331 write_graphite . . . $enable_write_graphite
5332 write_http . . . . . $enable_write_http
5333 write_mongodb . . . . $enable_write_mongodb
5334 write_redis . . . . . $enable_write_redis
5335 write_riemann . . . . $enable_write_riemann
5336 xmms . . . . . . . . $enable_xmms
5337 zfs_arc . . . . . . . $enable_zfs_arc
5341 if test "x$dependency_error" = "xyes"; then
5342 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5345 if test "x$dependency_warning" = "xyes"; then
5346 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5349 # vim: set fdm=marker :