1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([collectd],[m4_esyscmd(./version-gen.sh)])
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 foreign])
28 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 AC_PREFIX_DEFAULT("/opt/collectd")
36 # Checks for programs.
44 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
52 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
53 AC_CHECK_HEADERS([google/protobuf-c/protobuf-c.h],
54 [have_protobuf_c_h="yes"],
55 [have_protobuf_c_h="no"])
56 if test "x$have_protoc_c" = "xyes" && test "x$have_protobuf_c_h" != "xyes"
58 have_protoc_c="no (unable to find <google/protobuf-c/protobuf-c.h>)"
60 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
62 AC_MSG_CHECKING([for kernel type ($host_os)])
65 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
69 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
73 AC_DEFINE([KERNEL_DARWIN], 1, [True if program is to be compiled for a Darwin kernel])
77 AC_DEFINE([KERNEL_OPENBSD], 1, [True if program is to be compiled for an OpenBSD kernel])
81 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
85 AC_DEFINE([KERNEL_FREEBSD], 1, [True if program is to be compiled for a FreeBSD kernel])
91 AC_MSG_RESULT([$ac_system])
93 AM_CONDITIONAL([BUILD_LINUX],[test "x$x$ac_system" = "xLinux"])
94 AM_CONDITIONAL([BUILD_SOLARIS],[test "x$x$ac_system" = "xSolaris"])
95 AM_CONDITIONAL([BUILD_DARWIN],[test "x$x$ac_system" = "xDarwin"])
96 AM_CONDITIONAL([BUILD_OPENBSD],[test "x$x$ac_system" = "xOpenBSD"])
97 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
98 AM_CONDITIONAL([BUILD_FREEBSD],[test "x$x$ac_system" = "xFreeBSD"])
100 if test "x$ac_system" = "xLinux"
102 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
103 if test -z "$KERNEL_DIR"
105 KERNEL_DIR="/lib/modules/`uname -r`/source"
108 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
109 AC_SUBST(KERNEL_CFLAGS)
112 if test "x$ac_system" = "xSolaris"
114 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
115 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
117 if test "x$ac_system" = "xAIX"
119 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
122 # Where to install .pc files.
123 pkgconfigdir="${libdir}/pkgconfig"
124 AC_SUBST(pkgconfigdir)
126 # Check for standards compliance mode
127 AC_ARG_ENABLE(standards,
128 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
129 [enable_standards="$enableval"],
130 [enable_standards="no"])
131 if test "x$enable_standards" = "xyes"
133 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
134 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
135 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
136 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
137 if test "x$GCC" = "xyes"
139 CFLAGS="$CFLAGS -std=c99"
142 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
145 # Checks for header files.
152 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)
155 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
160 # include <sys/types.h>
163 AC_CHECK_HEADERS(netinet/in.h, [], [],
168 # include <sys/types.h>
170 #if HAVE_NETINET_IN_SYSTM_H
171 # include <netinet/in_systm.h>
174 AC_CHECK_HEADERS(netinet/ip.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>
188 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
193 # include <sys/types.h>
195 #if HAVE_NETINET_IN_SYSTM_H
196 # include <netinet/in_systm.h>
198 #if HAVE_NETINET_IN_H
199 # include <netinet/in.h>
201 #if HAVE_NETINET_IP_H
202 # include <netinet/ip.h>
205 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
210 # include <sys/types.h>
212 #if HAVE_NETINET_IN_SYSTM_H
213 # include <netinet/in_systm.h>
215 #if HAVE_NETINET_IN_H
216 # include <netinet/in.h>
218 #if HAVE_NETINET_IP_H
219 # include <netinet/ip.h>
222 AC_CHECK_HEADERS(netinet/ip6.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>
236 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
241 # include <sys/types.h>
243 #if HAVE_NETINET_IN_SYSTM_H
244 # include <netinet/in_systm.h>
246 #if HAVE_NETINET_IN_H
247 # include <netinet/in.h>
249 #if HAVE_NETINET_IP6_H
250 # include <netinet/ip6.h>
253 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
258 # include <sys/types.h>
260 #if HAVE_NETINET_IN_SYSTM_H
261 # include <netinet/in_systm.h>
263 #if HAVE_NETINET_IN_H
264 # include <netinet/in.h>
266 #if HAVE_NETINET_IP_H
267 # include <netinet/ip.h>
270 AC_CHECK_HEADERS(netinet/udp.h, [], [],
275 # include <sys/types.h>
277 #if HAVE_NETINET_IN_SYSTM_H
278 # include <netinet/in_systm.h>
280 #if HAVE_NETINET_IN_H
281 # include <netinet/in.h>
283 #if HAVE_NETINET_IP_H
284 # include <netinet/ip.h>
289 AC_CHECK_HEADERS(sys/dkstat.h)
290 if test "x$ac_system" = "xDarwin"
292 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)
293 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
294 # For the battery plugin
295 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
297 #if HAVE_IOKIT_IOKITLIB_H
298 # include <IOKit/IOKitLib.h>
300 #if HAVE_IOKIT_IOTYPES_H
301 # include <IOKit/IOTypes.h>
307 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
310 # include <sys/types.h>
313 # include <sys/param.h>
317 AC_MSG_CHECKING([for sysctl kern.cp_times])
318 if test -x /sbin/sysctl
320 /sbin/sysctl kern.cp_times 2>/dev/null
324 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
325 [Define if sysctl supports kern.cp_times])
334 AC_CHECK_HEADERS(linux/major.h)
336 # For md module (Linux only)
337 if test "x$ac_system" = "xLinux"
339 AC_CHECK_HEADERS(linux/raid/md_u.h,
340 [have_linux_raid_md_u_h="yes"],
341 [have_linux_raid_md_u_h="no"],
343 #include <sys/ioctl.h>
344 #include <linux/major.h>
345 #include <linux/types.h>
348 have_linux_raid_md_u_h="no"
351 # For the swap module
352 have_linux_wireless_h="no"
353 if test "x$ac_system" = "xLinux"
355 AC_CHECK_HEADERS(linux/wireless.h,
356 [have_linux_wireless_h="yes"],
357 [have_linux_wireless_h="no"],
360 #include <sys/ioctl.h>
361 #include <sys/socket.h>
365 # For the swap module
366 have_sys_swap_h="yes"
367 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
369 #undef _FILE_OFFSET_BITS
370 #undef _LARGEFILE64_SOURCE
372 # include <sys/types.h>
375 # include <sys/param.h>
379 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
382 if test "x$GCC" = "xyes"
384 hint_64="CFLAGS='-m64'"
386 hint_64="CFLAGS='-xarch=v9'"
388 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
392 # For the processes plugin
394 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
396 # For interface plugin
397 AC_CHECK_HEADERS(ifaddrs.h)
398 AC_CHECK_HEADERS(net/if.h, [], [],
401 # include <sys/types.h>
403 #if HAVE_SYS_SOCKET_H
404 # include <sys/socket.h>
407 AC_CHECK_HEADERS(linux/if.h, [], [],
410 # include <sys/types.h>
412 #if HAVE_SYS_SOCKET_H
413 # include <sys/socket.h>
416 AC_CHECK_HEADERS(linux/inet_diag.h, [], [],
419 # include <sys/types.h>
421 #if HAVE_SYS_SOCKET_H
422 # include <sys/socket.h>
424 #if HAVE_LINUX_INET_DIAG_H
425 # include <linux/inet_diag.h>
428 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
431 # include <sys/types.h>
433 #if HAVE_SYS_SOCKET_H
434 # include <sys/socket.h>
437 # include <linux/if.h>
442 AC_CHECK_HEADERS(linux/sockios.h,
443 [have_linux_sockios_h="yes"],
444 [have_linux_sockios_h="no"],
447 # include <sys/ioctl.h>
453 AC_CHECK_HEADERS(linux/ethtool.h,
454 [have_linux_ethtool_h="yes"],
455 [have_linux_ethtool_h="no"],
458 # include <sys/ioctl.h>
463 #if HAVE_LINUX_SOCKIOS_H
464 # include <linux/sockios.h>
469 have_linux_ip_vs_h="no"
470 have_net_ip_vs_h="no"
472 ip_vs_h_needs_kernel_cflags="no"
473 if test "x$ac_system" = "xLinux"
475 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
476 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
477 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
479 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
481 SAVE_CFLAGS="$CFLAGS"
482 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
484 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
486 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
487 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
488 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
490 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
492 ip_vs_h_needs_kernel_cflags="yes"
495 CFLAGS="$SAVE_CFLAGS"
498 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
501 AC_CHECK_HEADERS(sys/ucred.h, [], [],
504 # include <sys/types.h>
507 # include <sys/param.h>
511 # For mount interface
512 AC_CHECK_HEADERS(sys/mount.h, [], [],
515 # include <sys/types.h>
518 # include <sys/param.h>
522 # For the email plugin
523 AC_CHECK_HEADERS(linux/un.h, [], [],
525 #if HAVE_SYS_SOCKET_H
526 # include <sys/socket.h>
530 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 sys/vmmeter.h kvm.h wordexp.h locale.h)
533 AC_CHECK_HEADERS(arpa/nameser.h)
534 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
536 #if HAVE_ARPA_NAMESER_H
537 # include <arpa/nameser.h>
541 AC_CHECK_HEADERS(net/if_arp.h, [], [],
542 [#if HAVE_SYS_SOCKET_H
543 # include <sys/socket.h>
546 AC_CHECK_HEADERS(net/ppp_defs.h)
547 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
548 [#if HAVE_NET_PPP_DEFS_H
549 # include <net/ppp_defs.h>
552 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
557 # include <sys/types.h>
559 #if HAVE_SYS_SOCKET_H
560 # include <sys/socket.h>
565 #if HAVE_NETINET_IN_H
566 # include <netinet/in.h>
570 AC_CHECK_HEADERS(netinet/ip_compat.h)
572 have_net_pfvar_h="no"
573 AC_CHECK_HEADERS(net/pfvar.h,
574 [have_net_pfvar_h="yes"],
575 [have_net_pfvar_h="no"],
578 # include <sys/ioctl.h>
580 #if HAVE_SYS_SOCKET_H
581 # include <sys/socket.h>
588 # For the multimeter plugin
590 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
593 # Checks for typedefs, structures, and compiler characteristics.
602 # Checks for library functions.
604 AC_PROG_GCC_TRADITIONAL
605 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname setlocale)
609 SAVE_CFLAGS="$CFLAGS"
610 # Emulate behavior of src/Makefile.am
611 if test "x$GCC" = "xyes"
613 CFLAGS="$CFLAGS -Wall -Werror"
616 AC_CACHE_CHECK([for strtok_r],
617 [c_cv_have_strtok_r_default],
626 char buffer[] = "foo,bar,baz";
633 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
636 printf ("token = %s;\n", token);
640 [c_cv_have_strtok_r_default="yes"],
641 [c_cv_have_strtok_r_default="no"]
645 if test "x$c_cv_have_strtok_r_default" = "xno"
647 CFLAGS="$CFLAGS -D_REENTRANT=1"
649 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
650 [c_cv_have_strtok_r_reentrant],
659 char buffer[] = "foo,bar,baz";
666 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
669 printf ("token = %s;\n", token);
673 [c_cv_have_strtok_r_reentrant="yes"],
674 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
679 CFLAGS="$SAVE_CFLAGS"
680 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
682 CFLAGS="$CFLAGS -D_REENTRANT=1"
685 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
687 socket_needs_socket="no"
688 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
689 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
691 clock_gettime_needs_rt="no"
692 clock_gettime_needs_posix4="no"
693 have_clock_gettime="no"
694 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
695 if test "x$have_clock_gettime" = "xno"
697 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
698 have_clock_gettime="yes"])
700 if test "x$have_clock_gettime" = "xno"
702 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
703 have_clock_gettime="yes"])
705 if test "x$have_clock_gettime" = "xyes"
707 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
709 AC_MSG_WARN(cannot find clock_gettime)
712 nanosleep_needs_rt="no"
713 nanosleep_needs_posix4="no"
714 AC_CHECK_FUNCS(nanosleep,
716 AC_CHECK_LIB(rt, nanosleep,
717 [nanosleep_needs_rt="yes"],
718 AC_CHECK_LIB(posix4, nanosleep,
719 [nanosleep_needs_posix4="yes"],
720 AC_MSG_ERROR(cannot find nanosleep))))
722 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
723 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
725 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
726 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
727 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
728 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
729 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
730 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
731 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
732 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
733 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
734 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
735 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
736 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
738 # Check for strptime {{{
739 if test "x$GCC" = "xyes"
741 SAVE_CFLAGS="$CFLAGS"
742 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
745 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
746 if test "x$have_strptime" = "xyes"
748 AC_CACHE_CHECK([whether strptime is exported by default],
749 [c_cv_have_strptime_default],
750 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
756 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
759 [c_cv_have_strptime_default="yes"],
760 [c_cv_have_strptime_default="no"]))
762 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
764 AC_CACHE_CHECK([whether strptime needs standards mode],
765 [c_cv_have_strptime_standards],
766 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
768 #ifndef _ISOC99_SOURCE
769 # define _ISOC99_SOURCE 1
771 #ifndef _POSIX_C_SOURCE
772 # define _POSIX_C_SOURCE 200112L
774 #ifndef _XOPEN_SOURCE
775 # define _XOPEN_SOURCE 500
781 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
784 [c_cv_have_strptime_standards="yes"],
785 [c_cv_have_strptime_standards="no"]))
787 if test "x$c_cv_have_strptime_standards" = "xyes"
789 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
795 if test "x$GCC" = "xyes"
797 CFLAGS="$SAVE_CFLAGS"
799 # }}} Check for strptime
801 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
802 if test "x$have_swapctl" = "xyes"; then
803 AC_CACHE_CHECK([whether swapctl takes two arguments],
804 [c_cv_have_swapctl_two_args],
805 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
807 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
808 # undef _FILE_OFFSET_BITS
809 # undef _LARGEFILE64_SOURCE
811 #include <sys/stat.h>
812 #include <sys/param.h>
813 #include <sys/swap.h>
817 int num = swapctl(0, NULL);
820 [c_cv_have_swapctl_two_args="yes"],
821 [c_cv_have_swapctl_two_args="no"]
824 AC_CACHE_CHECK([whether swapctl takes three arguments],
825 [c_cv_have_swapctl_three_args],
829 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
830 # undef _FILE_OFFSET_BITS
831 # undef _LARGEFILE64_SOURCE
833 #include <sys/stat.h>
834 #include <sys/param.h>
835 #include <sys/swap.h>
839 int num = swapctl(0, NULL, 0);
842 [c_cv_have_swapctl_three_args="yes"],
843 [c_cv_have_swapctl_three_args="no"]
847 # Check for different versions of `swapctl' here..
848 if test "x$have_swapctl" = "xyes"; then
849 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
850 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
851 [Define if the function swapctl exists and takes two arguments.])
853 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
854 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
855 [Define if the function swapctl exists and takes three arguments.])
860 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
862 if test "x$withval" = "xno"; then
864 else if test "x$withval" = "xyes"; then
871 if test "x$nan_type" = "xnone"; then
872 AC_CACHE_CHECK([whether NAN is defined by default],
873 [c_cv_have_nan_default],
874 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
878 static double foo = NAN;
887 [c_cv_have_nan_default="yes"],
888 [c_cv_have_nan_default="no"]
891 if test "x$c_cv_have_nan_default" = "xyes"
896 if test "x$nan_type" = "xnone"; then
897 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
898 [c_cv_have_nan_isoc],
899 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
902 #define __USE_ISOC99 1
904 static double foo = NAN;
913 [c_cv_have_nan_isoc="yes"],
914 [c_cv_have_nan_isoc="no"]
917 if test "x$c_cv_have_nan_isoc" = "xyes"
922 if test "x$nan_type" = "xnone"; then
923 SAVE_LDFLAGS=$LDFLAGS
924 LDFLAGS="$LDFLAGS -lm"
925 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
926 [c_cv_have_nan_zero],
927 AC_RUN_IFELSE([AC_LANG_PROGRAM(
934 #define NAN (0.0 / 0.0)
936 # define isnan(f) ((f) != (f))
938 static double foo = NAN;
947 [c_cv_have_nan_zero="yes"],
948 [c_cv_have_nan_zero="no"]
951 LDFLAGS=$SAVE_LDFLAGS
952 if test "x$c_cv_have_nan_zero" = "xyes"
958 if test "x$nan_type" = "xdefault"; then
959 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
960 [Define if NAN is defined by default and can initialize static variables.])
961 else if test "x$nan_type" = "xisoc99"; then
962 AC_DEFINE(NAN_STATIC_ISOC, 1,
963 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
964 else if test "x$nan_type" = "xzero"; then
965 AC_DEFINE(NAN_ZERO_ZERO, 1,
966 [Define if NAN can be defined as (0.0 / 0.0)])
968 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
971 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
973 if test "x$withval" = "xnothing"; then
974 fp_layout_type="nothing"
975 else if test "x$withval" = "xendianflip"; then
976 fp_layout_type="endianflip"
977 else if test "x$withval" = "xintswap"; then
978 fp_layout_type="intswap"
980 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
983 [fp_layout_type="unknown"])
985 if test "x$fp_layout_type" = "xunknown"; then
986 AC_CACHE_CHECK([if doubles are stored in x86 representation],
987 [c_cv_fp_layout_need_nothing],
988 AC_RUN_IFELSE([AC_LANG_PROGRAM(
997 # include <inttypes.h>
1000 # include <stdbool.h>
1010 memcpy ((void *) &i0, (void *) &d, 8);
1013 memcpy ((void *) c, (void *) &i1, 8);
1015 if ((c[0] == 0x2f) && (c[1] == 0x25)
1016 && (c[2] == 0xc0) && (c[3] == 0xc7)
1017 && (c[4] == 0x43) && (c[5] == 0x2b)
1018 && (c[6] == 0x1f) && (c[7] == 0x5b))
1024 [c_cv_fp_layout_need_nothing="yes"],
1025 [c_cv_fp_layout_need_nothing="no"]
1028 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
1029 fp_layout_type="nothing"
1032 if test "x$fp_layout_type" = "xunknown"; then
1033 AC_CACHE_CHECK([if endianflip converts to x86 representation],
1034 [c_cv_fp_layout_need_endianflip],
1035 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1041 # include <stdint.h>
1044 # include <inttypes.h>
1047 # include <stdbool.h>
1049 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
1050 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
1051 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1052 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
1053 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
1054 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1055 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1056 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1065 memcpy ((void *) &i0, (void *) &d, 8);
1067 i1 = endianflip (i0);
1068 memcpy ((void *) c, (void *) &i1, 8);
1070 if ((c[0] == 0x2f) && (c[1] == 0x25)
1071 && (c[2] == 0xc0) && (c[3] == 0xc7)
1072 && (c[4] == 0x43) && (c[5] == 0x2b)
1073 && (c[6] == 0x1f) && (c[7] == 0x5b))
1079 [c_cv_fp_layout_need_endianflip="yes"],
1080 [c_cv_fp_layout_need_endianflip="no"]
1083 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1084 fp_layout_type="endianflip"
1087 if test "x$fp_layout_type" = "xunknown"; then
1088 AC_CACHE_CHECK([if intswap converts to x86 representation],
1089 [c_cv_fp_layout_need_intswap],
1090 AC_RUN_IFELSE([AC_LANG_PROGRAM(
1096 # include <stdint.h>
1099 # include <inttypes.h>
1102 # include <stdbool.h>
1104 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1105 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1114 memcpy ((void *) &i0, (void *) &d, 8);
1117 memcpy ((void *) c, (void *) &i1, 8);
1119 if ((c[0] == 0x2f) && (c[1] == 0x25)
1120 && (c[2] == 0xc0) && (c[3] == 0xc7)
1121 && (c[4] == 0x43) && (c[5] == 0x2b)
1122 && (c[6] == 0x1f) && (c[7] == 0x5b))
1128 [c_cv_fp_layout_need_intswap="yes"],
1129 [c_cv_fp_layout_need_intswap="no"]
1132 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1133 fp_layout_type="intswap"
1137 if test "x$fp_layout_type" = "xnothing"; then
1138 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1139 [Define if doubles are stored in x86 representation.])
1140 else if test "x$fp_layout_type" = "xendianflip"; then
1141 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1142 [Define if endianflip is needed to convert to x86 representation.])
1143 else if test "x$fp_layout_type" = "xintswap"; then
1144 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1145 [Define if intswap is needed to convert to x86 representation.])
1147 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1150 # --with-useragent {{{
1151 AC_ARG_WITH(useragent, [AS_HELP_STRING([--with-useragent@<:@=AGENT@:>@], [User agent to use on http requests])],
1153 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1155 AC_DEFINE_UNQUOTED(COLLECTD_USERAGENT, ["$withval"], [User agent for http requests])
1162 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1163 have_getvfsstat="no"
1164 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1165 have_listmntent="no"
1166 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1169 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1170 if test "x$have_getmntent" = "xno"; then
1171 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1173 if test "x$have_getmntent" = "xno"; then
1174 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1176 if test "x$have_getmntent" = "xno"; then
1177 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1180 if test "x$have_getmntent" = "xc"; then
1181 AC_CACHE_CHECK([whether getmntent takes one argument],
1182 [c_cv_have_one_getmntent],
1186 #include "$srcdir/src/utils_mount.h"
1191 fh = setmntent ("/etc/mtab", "r");
1192 me = getmntent (fh);
1193 return(me->mnt_passno);
1196 [c_cv_have_one_getmntent="yes"],
1197 [c_cv_have_one_getmntent="no"]
1200 AC_CACHE_CHECK([whether getmntent takes two arguments],
1201 [c_cv_have_two_getmntent],
1205 #include "$srcdir/src/utils_mount.h"
1211 fh = fopen ("/etc/mnttab", "r");
1212 status = getmntent (fh, &mt);
1216 [c_cv_have_two_getmntent="yes"],
1217 [c_cv_have_two_getmntent="no"]
1222 # Check for different versions of `getmntent' here..
1224 if test "x$have_getmntent" = "xc"; then
1225 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1226 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1227 [Define if the function getmntent exists and takes one argument.])
1229 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1230 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1231 [Define if the function getmntent exists and takes two arguments.])
1234 if test "x$have_getmntent" = "xsun"; then
1235 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1236 [Define if the function getmntent exists. It's the version from libsun.])
1238 if test "x$have_getmntent" = "xseq"; then
1239 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1240 [Define if the function getmntent exists. It's the version from libseq.])
1242 if test "x$have_getmntent" = "xgen"; then
1243 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1244 [Define if the function getmntent exists. It's the version from libgen.])
1248 AC_CACHE_CHECK([if have htonll defined],
1250 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1252 #include <sys/types.h>
1253 #include <netinet/in.h>
1255 # include <inttypes.h>
1262 [c_cv_have_htonll="yes"],
1263 [c_cv_have_htonll="no"]
1266 if test "x$c_cv_have_htonll" = "xyes"
1268 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1271 # Check for structures
1272 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1273 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1276 #include <sys/types.h>
1277 #include <sys/socket.h>
1280 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1281 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1284 #include <sys/types.h>
1285 #include <sys/socket.h>
1286 #include <linux/if.h>
1287 #include <linux/netdevice.h>
1289 AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states],
1290 [AC_DEFINE(HAVE_STRUCT_LINUX_INET_DIAG_REQ, 1, [Define if struct inet_diag_req exists and is usable.])],
1293 #include <linux/inet_diag.h>
1297 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1300 #include <netinet/in.h>
1304 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1306 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1307 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1308 have_struct_kinfo_proc_freebsd="yes"
1311 have_struct_kinfo_proc_freebsd="no"
1315 #include <sys/param.h>
1316 #include <sys/sysctl.h>
1317 #include <sys/user.h>
1320 AC_CHECK_MEMBERS([struct kinfo_proc.p_pid, struct kinfo_proc.p_vm_rssize],
1322 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1323 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1324 have_struct_kinfo_proc_openbsd="yes"
1327 have_struct_kinfo_proc_openbsd="no"
1330 #include <sys/param.h>
1331 #include <sys/sysctl.h>
1335 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1336 [#define _BSD_SOURCE
1337 #define _DEFAULT_SOURCE
1339 # include <stdint.h>
1341 #if HAVE_SYS_TYPES_H
1342 # include <sys/types.h>
1344 #if HAVE_NETINET_IN_SYSTM_H
1345 # include <netinet/in_systm.h>
1347 #if HAVE_NETINET_IN_H
1348 # include <netinet/in.h>
1350 #if HAVE_NETINET_IP_H
1351 # include <netinet/ip.h>
1353 #if HAVE_NETINET_UDP_H
1354 # include <netinet/udp.h>
1357 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1358 [#define _BSD_SOURCE
1359 #define _DEFAULT_SOURCE
1361 # include <stdint.h>
1363 #if HAVE_SYS_TYPES_H
1364 # include <sys/types.h>
1366 #if HAVE_NETINET_IN_SYSTM_H
1367 # include <netinet/in_systm.h>
1369 #if HAVE_NETINET_IN_H
1370 # include <netinet/in.h>
1372 #if HAVE_NETINET_IP_H
1373 # include <netinet/ip.h>
1375 #if HAVE_NETINET_UDP_H
1376 # include <netinet/udp.h>
1380 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1390 # Checks for libraries begin here
1393 with_libresolv="yes"
1394 AC_CHECK_LIB(resolv, res_search,
1396 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1398 [with_libresolv="no"])
1399 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1401 dnl Check for HAL (hardware abstraction library)
1403 AC_CHECK_LIB(hal,libhal_device_property_exists,
1404 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1406 if test "x$with_libhal" = "xyes"; then
1407 if test "x$PKG_CONFIG" != "x"; then
1408 BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`"
1409 BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`"
1410 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1411 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1415 m4_divert_once([HELP_WITH], [
1416 collectd additional packages:])
1418 if test "x$ac_system" = "xAIX"
1423 with_perfstat="no (AIX only)"
1424 with_procinfo="no (AIX only)"
1427 if test "x$with_perfstat" = "xyes"
1429 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1430 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1432 if test "x$with_perfstat" = "xyes"
1434 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1435 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1436 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1437 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1439 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1442 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1444 # Processes plugin under AIX.
1445 if test "x$with_procinfo" = "xyes"
1447 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1449 if test "x$with_procinfo" = "xyes"
1451 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1454 if test "x$ac_system" = "xSolaris"
1459 with_kstat="no (Solaris only)"
1460 with_devinfo="no (Solaris only)"
1463 if test "x$with_kstat" = "xyes"
1465 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1467 if test "x$with_kstat" = "xyes"
1469 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1470 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1472 if test "x$with_kstat" = "xyes"
1474 AC_DEFINE(HAVE_LIBKSTAT, 1,
1475 [Define to 1 if you have the 'kstat' library (-lkstat)])
1477 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1478 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1481 if test "x$ac_system" = "xDarwin"
1487 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1490 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1491 if test "x$with_kvm_getprocs" = "xyes"
1493 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1494 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1497 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1499 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1500 if test "x$with_kvm_getswapinfo" = "xyes"
1502 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1503 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1506 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1508 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1509 if test "x$with_kvm_nlist" = "xyes"
1511 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1512 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1513 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1516 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1518 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1519 if test "x$with_kvm_openfiles" = "xyes"
1521 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1522 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1525 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1527 # --with-libaquaero5 {{{
1528 AC_ARG_WITH(libaquaero5, [AS_HELP_STRING([--with-libaquaero5@<:@=PREFIX@:>@], [Path to aquatools-ng source code.])],
1530 if test "x$withval" = "xyes"
1532 with_libaquaero5="yes"
1533 else if test "x$withval" = "xno"
1535 with_libaquaero5="no"
1537 with_libaquaero5="yes"
1538 LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS -I$withval/src"
1539 LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS -L$withval/obj"
1542 [with_libaquaero5="yes"])
1544 SAVE_CPPFLAGS="$CPPFLAGS"
1545 SAVE_LDFLAGS="$LDFLAGS"
1547 CPPFLAGS="$CPPFLAGS $LIBAQUAERO5_CFLAGS"
1548 LDFLAGS="$LDFLAGS $LIBAQUAERO5_LDFLAGS"
1550 if test "x$with_libaquaero5" = "xyes"
1552 if test "x$LIBAQUAERO5_CFLAGS" != "x"
1554 AC_MSG_NOTICE([libaquaero5 CPPFLAGS: $LIBAQUAERO5_CFLAGS])
1556 AC_CHECK_HEADERS(libaquaero5.h,
1557 [with_libaquaero5="yes"],
1558 [with_libaquaero5="no (libaquaero5.h not found)"])
1560 if test "x$with_libaquaero5" = "xyes"
1562 if test "x$LIBAQUAERO5_LDFLAGS" != "x"
1564 AC_MSG_NOTICE([libaquaero5 LDFLAGS: $LIBAQUAERO5_LDFLAGS])
1566 AC_CHECK_LIB(aquaero5, libaquaero5_poll,
1567 [with_libaquaero5="yes"],
1568 [with_libaquaero5="no (symbol 'libaquaero5_poll' not found)"])
1571 CPPFLAGS="$SAVE_CPPFLAGS"
1572 LDFLAGS="$SAVE_LDFLAGS"
1574 if test "x$with_libaquaero5" = "xyes"
1576 BUILD_WITH_LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS"
1577 BUILD_WITH_LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS"
1578 AC_SUBST(BUILD_WITH_LIBAQUAERO5_CFLAGS)
1579 AC_SUBST(BUILD_WITH_LIBAQUAERO5_LDFLAGS)
1581 AM_CONDITIONAL(BUILD_WITH_LIBAQUAERO5, test "x$with_libaquaero5" = "xyes")
1584 # --with-libhiredis {{{
1585 AC_ARG_WITH(libhiredis, [AS_HELP_STRING([--with-libhiredis@<:@=PREFIX@:>@],
1586 [Path to libhiredis.])],
1588 if test "x$withval" = "xyes"
1590 with_libhiredis="yes"
1591 else if test "x$withval" = "xno"
1593 with_libhiredis="no"
1595 with_libhiredis="yes"
1596 LIBHIREDIS_CPPFLAGS="$LIBHIREDIS_CPPFLAGS -I$withval/include"
1597 LIBHIREDIS_LDFLAGS="$LIBHIREDIS_LDFLAGS -L$withval/lib"
1600 [with_libhiredis="yes"])
1602 SAVE_CPPFLAGS="$CPPFLAGS"
1603 SAVE_LDFLAGS="$LDFLAGS"
1605 CPPFLAGS="$CPPFLAGS $LIBHIREDIS_CPPFLAGS"
1606 LDFLAGS="$LDFLAGS $LIBHIREDIS_LDFLAGS"
1608 if test "x$with_libhiredis" = "xyes"
1610 if test "x$LIBHIREDIS_CPPFLAGS" != "x"
1612 AC_MSG_NOTICE([libhiredis CPPFLAGS: $LIBHIREDIS_CPPFLAGS])
1614 AC_CHECK_HEADERS(hiredis/hiredis.h,
1615 [with_libhiredis="yes"],
1616 [with_libhiredis="no (hiredis.h not found)"])
1618 if test "x$with_libhiredis" = "xyes"
1620 if test "x$LIBHIREDIS_LDFLAGS" != "x"
1622 AC_MSG_NOTICE([libhiredis LDFLAGS: $LIBHIREDIS_LDFLAGS])
1624 AC_CHECK_LIB(hiredis, redisCommand,
1625 [with_libhiredis="yes"],
1626 [with_libhiredis="no (symbol 'redisCommand' not found)"])
1630 CPPFLAGS="$SAVE_CPPFLAGS"
1631 LDFLAGS="$SAVE_LDFLAGS"
1633 if test "x$with_libhiredis" = "xyes"
1635 BUILD_WITH_LIBHIREDIS_CPPFLAGS="$LIBHIREDIS_CPPFLAGS"
1636 BUILD_WITH_LIBHIREDIS_LDFLAGS="$LIBHIREDIS_LDFLAGS"
1637 AC_SUBST(BUILD_WITH_LIBHIREDIS_CPPFLAGS)
1638 AC_SUBST(BUILD_WITH_LIBHIREDIS_LDFLAGS)
1640 AM_CONDITIONAL(BUILD_WITH_LIBHIREDIS, test "x$with_libhiredis" = "xyes")
1643 # --with-libcurl {{{
1644 with_curl_config="curl-config"
1647 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1649 if test "x$withval" = "xno"
1652 else if test "x$withval" = "xyes"
1656 if test -f "$withval" && test -x "$withval"
1658 with_curl_config="$withval"
1660 else if test -x "$withval/bin/curl-config"
1662 with_curl_config="$withval/bin/curl-config"
1671 if test "x$with_libcurl" = "xyes"
1673 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1674 curl_config_status=$?
1676 if test $curl_config_status -ne 0
1678 with_libcurl="no ($with_curl_config failed)"
1680 SAVE_CPPFLAGS="$CPPFLAGS"
1681 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1683 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1685 CPPFLAGS="$SAVE_CPPFLAGS"
1688 if test "x$with_libcurl" = "xyes"
1690 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1691 curl_config_status=$?
1693 if test $curl_config_status -ne 0
1695 with_libcurl="no ($with_curl_config failed)"
1697 AC_CHECK_LIB(curl, curl_easy_init,
1698 [with_libcurl="yes"],
1699 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1701 AC_CHECK_DECL(CURLOPT_USERNAME,
1702 [have_curlopt_username="yes"],
1703 [have_curlopt_username="no"],
1704 [[#include <curl/curl.h>]])
1705 AC_CHECK_DECL(CURLOPT_TIMEOUT_MS,
1706 [have_curlopt_timeout="yes"],
1707 [have_curlopt_timeout="no"],
1708 [[#include <curl/curl.h>]])
1711 if test "x$with_libcurl" = "xyes"
1713 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1714 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1715 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1716 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1718 if test "x$have_curlopt_username" = "xyes"
1720 AC_DEFINE(HAVE_CURLOPT_USERNAME, 1, [Define if libcurl supports CURLOPT_USERNAME option.])
1723 if test "x$have_curlopt_timeout" = "xyes"
1725 AC_DEFINE(HAVE_CURLOPT_TIMEOUT_MS, 1, [Define if libcurl supports CURLOPT_TIMEOUT_MS option.])
1728 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1732 with_libdbi_cppflags=""
1733 with_libdbi_ldflags=""
1734 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1736 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1738 with_libdbi_cppflags="-I$withval/include"
1739 with_libdbi_ldflags="-L$withval/lib"
1742 with_libdbi="$withval"
1748 if test "x$with_libdbi" = "xyes"
1750 SAVE_CPPFLAGS="$CPPFLAGS"
1751 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1753 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1755 CPPFLAGS="$SAVE_CPPFLAGS"
1757 if test "x$with_libdbi" = "xyes"
1759 SAVE_CPPFLAGS="$CPPFLAGS"
1760 SAVE_LDFLAGS="$LDFLAGS"
1761 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1762 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1764 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1766 CPPFLAGS="$SAVE_CPPFLAGS"
1767 LDFLAGS="$SAVE_LDFLAGS"
1769 if test "x$with_libdbi" = "xyes"
1771 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1772 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1773 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1774 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1775 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1776 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1778 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1781 # --with-libesmtp {{{
1782 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1784 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1786 LDFLAGS="$LDFLAGS -L$withval/lib"
1787 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1790 with_libesmtp="$withval"
1796 if test "x$with_libesmtp" = "xyes"
1798 AC_CHECK_LIB(esmtp, smtp_create_session,
1800 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1801 ], [with_libesmtp="no (libesmtp not found)"])
1803 if test "x$with_libesmtp" = "xyes"
1805 AC_CHECK_HEADERS(libesmtp.h,
1807 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1808 ], [with_libesmtp="no (libesmtp.h not found)"])
1810 if test "x$with_libesmtp" = "xyes"
1816 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1817 [Wether or not to use the esmtp library])
1818 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1821 # --with-libganglia {{{
1822 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1824 if test -f "$withval" && test -x "$withval"
1826 with_libganglia_config="$withval"
1827 with_libganglia="yes"
1828 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1830 with_libganglia_config="$withval/bin/ganglia-config"
1831 with_libganglia="yes"
1832 else if test -d "$withval"
1834 GANGLIA_CPPFLAGS="-I$withval/include"
1835 GANGLIA_LDFLAGS="-L$withval/lib"
1836 with_libganglia="yes"
1838 with_libganglia_config="ganglia-config"
1839 with_libganglia="$withval"
1843 with_libganglia_config="ganglia-config"
1844 with_libganglia="yes"
1847 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1849 if test "x$GANGLIA_CPPFLAGS" = "x"
1851 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1854 if test "x$GANGLIA_LDFLAGS" = "x"
1856 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1859 if test "x$GANGLIA_LIBS" = "x"
1861 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1865 SAVE_CPPFLAGS="$CPPFLAGS"
1866 SAVE_LDFLAGS="$LDFLAGS"
1867 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1868 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1870 if test "x$with_libganglia" = "xyes"
1872 AC_CHECK_HEADERS(gm_protocol.h,
1874 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1875 [Define to 1 if you have the <gm_protocol.h> header file.])
1876 ], [with_libganglia="no (gm_protocol.h not found)"])
1879 if test "x$with_libganglia" = "xyes"
1881 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1883 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1884 [Define to 1 if you have the ganglia library (-lganglia).])
1885 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1888 CPPFLAGS="$SAVE_CPPFLAGS"
1889 LDFLAGS="$SAVE_LDFLAGS"
1891 AC_SUBST(GANGLIA_CPPFLAGS)
1892 AC_SUBST(GANGLIA_LDFLAGS)
1893 AC_SUBST(GANGLIA_LIBS)
1894 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1897 # --with-libgcrypt {{{
1898 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1899 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1900 GCRYPT_LIBS="$GCRYPT_LIBS"
1901 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1903 if test -f "$withval" && test -x "$withval"
1905 with_libgcrypt_config="$withval"
1906 with_libgcrypt="yes"
1907 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1909 with_libgcrypt_config="$withval/bin/gcrypt-config"
1910 with_libgcrypt="yes"
1911 else if test -d "$withval"
1913 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1914 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1915 with_libgcrypt="yes"
1917 with_libgcrypt_config="gcrypt-config"
1918 with_libgcrypt="$withval"
1922 with_libgcrypt_config="libgcrypt-config"
1923 with_libgcrypt="yes"
1926 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1928 if test "x$GCRYPT_CPPFLAGS" = "x"
1930 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1933 if test "x$GCRYPT_LDFLAGS" = "x"
1935 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1936 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1939 if test "x$GCRYPT_LIBS" = "x"
1941 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1945 SAVE_CPPFLAGS="$CPPFLAGS"
1946 SAVE_LDFLAGS="$LDFLAGS"
1947 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1948 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1950 if test "x$with_libgcrypt" = "xyes"
1952 if test "x$GCRYPT_CPPFLAGS" != "x"
1954 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1956 AC_CHECK_HEADERS(gcrypt.h,
1957 [with_libgcrypt="yes"],
1958 [with_libgcrypt="no (gcrypt.h not found)"])
1961 if test "x$with_libgcrypt" = "xyes"
1963 if test "x$GCRYPT_LDFLAGS" != "x"
1965 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1967 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1968 [with_libgcrypt="yes"],
1969 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1971 if test "$with_libgcrypt" != "no"; then
1972 m4_ifdef([AM_PATH_LIBGCRYPT],[AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")])
1973 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
1974 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
1978 CPPFLAGS="$SAVE_CPPFLAGS"
1979 LDFLAGS="$SAVE_LDFLAGS"
1981 if test "x$with_libgcrypt" = "xyes"
1983 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1986 AC_SUBST(GCRYPT_CPPFLAGS)
1987 AC_SUBST(GCRYPT_LDFLAGS)
1988 AC_SUBST(GCRYPT_LIBS)
1989 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1992 # --with-libiptc {{{
1993 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1995 if test "x$withval" = "xyes"
1997 with_libiptc="pkgconfig"
1998 else if test "x$withval" = "xno"
2003 with_libiptc_cflags="-I$withval/include"
2004 with_libiptc_libs="-L$withval/lib"
2008 if test "x$ac_system" = "xLinux"
2010 with_libiptc="pkgconfig"
2012 with_libiptc="no (Linux only)"
2016 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
2018 with_libiptc="no (Don't have pkg-config)"
2021 if test "x$with_libiptc" = "xpkgconfig"
2023 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
2026 with_libiptc="no (pkg-config doesn't know libiptc)"
2029 if test "x$with_libiptc" = "xpkgconfig"
2031 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
2034 with_libiptc="no ($PKG_CONFIG failed)"
2036 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
2039 with_libiptc="no ($PKG_CONFIG failed)"
2043 SAVE_CPPFLAGS="$CPPFLAGS"
2044 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
2046 # check whether the header file for libiptc is available.
2047 if test "x$with_libiptc" = "xpkgconfig"
2049 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
2050 [with_libiptc="no (header file missing)"])
2052 # If the header file is available, check for the required type declaractions.
2053 # They may be missing in old versions of libiptc. In that case, they will be
2054 # declared in the iptables plugin.
2055 if test "x$with_libiptc" = "xpkgconfig"
2057 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
2059 # Check for the iptc_init symbol in the library.
2060 # This could be in iptc or ip4tc
2061 if test "x$with_libiptc" = "xpkgconfig"
2064 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
2065 [with_libiptc="pkgconfig"],
2066 [with_libiptc="no"],
2067 [$with_libiptc_libs])
2070 if test "x$with_libiptc" = "xpkgconfig"
2075 CPPFLAGS="$SAVE_CPPFLAGS"
2077 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
2078 if test "x$with_libiptc" = "xyes"
2080 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
2081 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
2082 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
2083 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
2088 with_java_home="$JAVA_HOME"
2089 if test "x$with_java_home" = "x"
2091 with_java_home="/usr/lib/jvm"
2093 with_java_vmtype="client"
2098 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
2100 if test "x$withval" = "xno"
2103 else if test "x$withval" = "xyes"
2107 with_java_home="$withval"
2112 if test "x$with_java" = "xyes"
2114 if test -d "$with_java_home"
2116 AC_MSG_CHECKING([for jni.h])
2117 TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2118 if test "x$TMPVAR" != "x"
2120 AC_MSG_RESULT([found in $TMPVAR])
2121 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2123 AC_MSG_RESULT([not found])
2126 AC_MSG_CHECKING([for jni_md.h])
2127 TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2128 if test "x$TMPVAR" != "x"
2130 AC_MSG_RESULT([found in $TMPVAR])
2131 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2133 AC_MSG_RESULT([not found])
2136 AC_MSG_CHECKING([for libjvm.so])
2137 TMPVAR=`find -L "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2138 if test "x$TMPVAR" != "x"
2140 AC_MSG_RESULT([found in $TMPVAR])
2141 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
2143 AC_MSG_RESULT([not found])
2146 if test "x$JAVAC" = "x"
2148 AC_MSG_CHECKING([for javac])
2149 TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2150 if test "x$TMPVAR" != "x"
2153 AC_MSG_RESULT([$JAVAC])
2155 AC_MSG_RESULT([not found])
2158 if test "x$JAR" = "x"
2160 AC_MSG_CHECKING([for jar])
2161 TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2162 if test "x$TMPVAR" != "x"
2165 AC_MSG_RESULT([$JAR])
2167 AC_MSG_RESULT([not found])
2170 else if test "x$with_java_home" != "x"
2172 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2176 if test "x$JAVA_CPPFLAGS" != "x"
2178 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2180 if test "x$JAVA_CFLAGS" != "x"
2182 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2184 if test "x$JAVA_LDFLAGS" != "x"
2186 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2188 if test "x$JAVAC" = "x"
2190 with_javac_path="$PATH"
2191 if test "x$with_java_home" != "x"
2193 with_javac_path="$with_java_home:with_javac_path"
2194 if test -d "$with_java_home/bin"
2196 with_javac_path="$with_java_home/bin:with_javac_path"
2200 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2202 if test "x$JAVAC" = "x"
2204 with_java="no (javac not found)"
2206 if test "x$JAR" = "x"
2208 with_jar_path="$PATH"
2209 if test "x$with_java_home" != "x"
2211 with_jar_path="$with_java_home:$with_jar_path"
2212 if test -d "$with_java_home/bin"
2214 with_jar_path="$with_java_home/bin:$with_jar_path"
2218 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2220 if test "x$JAR" = "x"
2222 with_java="no (jar not found)"
2225 SAVE_CPPFLAGS="$CPPFLAGS"
2226 SAVE_CFLAGS="$CFLAGS"
2227 SAVE_LDFLAGS="$LDFLAGS"
2228 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2229 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2230 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2232 if test "x$with_java" = "xyes"
2234 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2236 if test "x$with_java" = "xyes"
2238 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2240 [with_java="no (libjvm not found)"],
2243 if test "x$with_java" = "xyes"
2245 JAVA_LIBS="$JAVA_LIBS -ljvm"
2246 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2249 CPPFLAGS="$SAVE_CPPFLAGS"
2250 CFLAGS="$SAVE_CFLAGS"
2251 LDFLAGS="$SAVE_LDFLAGS"
2253 AC_SUBST(JAVA_CPPFLAGS)
2254 AC_SUBST(JAVA_CFLAGS)
2255 AC_SUBST(JAVA_LDFLAGS)
2257 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2260 # --with-libldap {{{
2261 AC_ARG_WITH(libldap, [AS_HELP_STRING([--with-libldap@<:@=PREFIX@:>@], [Path to libldap.])],
2263 if test "x$withval" = "xyes"
2266 else if test "x$withval" = "xno"
2271 LIBLDAP_CPPFLAGS="$LIBLDAP_CPPFLAGS -I$withval/include"
2272 LIBLDAP_LDFLAGS="$LIBLDAP_LDFLAGS -L$withval/lib"
2275 [with_libldap="yes"])
2277 SAVE_CPPFLAGS="$CPPFLAGS"
2278 SAVE_LDFLAGS="$LDFLAGS"
2280 CPPFLAGS="$CPPFLAGS $LIBLDAP_CPPFLAGS"
2281 LDFLAGS="$LDFLAGS $LIBLDAP_LDFLAGS"
2283 if test "x$with_libldap" = "xyes"
2285 if test "x$LIBLDAP_CPPFLAGS" != "x"
2287 AC_MSG_NOTICE([libldap CPPFLAGS: $LIBLDAP_CPPFLAGS])
2289 AC_CHECK_HEADERS(ldap.h,
2290 [with_libldap="yes"],
2291 [with_libldap="no ('ldap.h' not found)"])
2293 if test "x$with_libldap" = "xyes"
2295 if test "x$LIBLDAP_LDFLAGS" != "x"
2297 AC_MSG_NOTICE([libldap LDFLAGS: $LIBLDAP_LDFLAGS])
2299 AC_CHECK_LIB(ldap, ldap_initialize,
2300 [with_libldap="yes"],
2301 [with_libldap="no (symbol 'ldap_initialize' not found)"])
2305 CPPFLAGS="$SAVE_CPPFLAGS"
2306 LDFLAGS="$SAVE_LDFLAGS"
2308 if test "x$with_libldap" = "xyes"
2310 BUILD_WITH_LIBLDAP_CPPFLAGS="$LIBLDAP_CPPFLAGS"
2311 BUILD_WITH_LIBLDAP_LDFLAGS="$LIBLDAP_LDFLAGS"
2312 AC_SUBST(BUILD_WITH_LIBLDAP_CPPFLAGS)
2313 AC_SUBST(BUILD_WITH_LIBLDAP_LDFLAGS)
2315 AM_CONDITIONAL(BUILD_WITH_LIBLDAP, test "x$with_libldap" = "xyes")
2318 # --with-liblvm2app {{{
2319 with_liblvm2app_cppflags=""
2320 with_liblvm2app_ldflags=""
2321 AC_ARG_WITH(liblvm2app, [AS_HELP_STRING([--with-liblvm2app@<:@=PREFIX@:>@], [Path to liblvm2app.])],
2323 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2325 with_liblvm2app_cppflags="-I$withval/include"
2326 with_liblvm2app_ldflags="-L$withval/lib"
2327 with_liblvm2app="yes"
2329 with_liblvm2app="$withval"
2333 with_liblvm2app="yes"
2335 if test "x$with_liblvm2app" = "xyes"
2337 SAVE_CPPFLAGS="$CPPFLAGS"
2338 CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags"
2340 AC_CHECK_HEADERS(lvm2app.h, [with_liblvm2app="yes"], [with_liblvm2app="no (lvm2app.h not found)"])
2342 CPPFLAGS="$SAVE_CPPFLAGS"
2345 if test "x$with_liblvm2app" = "xyes"
2347 SAVE_CPPFLAGS="$CPPFLAGS"
2348 SAVE_LDFLAGS="$LDFLAGS"
2349 CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags"
2350 LDFLAGS="$LDFLAGS $with_liblvm2app_ldflags"
2352 AC_CHECK_LIB(lvm2app, lvm_lv_get_property, [with_liblvm2app="yes"], [with_liblvm2app="no (Symbol 'lvm_lv_get_property' not found)"])
2354 CPPFLAGS="$SAVE_CPPFLAGS"
2355 LDFLAGS="$SAVE_LDFLAGS"
2357 if test "x$with_liblvm2app" = "xyes"
2359 BUILD_WITH_LIBLVM2APP_CPPFLAGS="$with_liblvm2app_cppflags"
2360 BUILD_WITH_LIBLVM2APP_LDFLAGS="$with_liblvm2app_ldflags"
2361 BUILD_WITH_LIBLVM2APP_LIBS="-llvm2app"
2362 AC_SUBST(BUILD_WITH_LIBLVM2APP_CPPFLAGS)
2363 AC_SUBST(BUILD_WITH_LIBLVM2APP_LDFLAGS)
2364 AC_SUBST(BUILD_WITH_LIBLVM2APP_LIBS)
2365 AC_DEFINE(HAVE_LIBLVM2APP, 1, [Define if liblvm2app is present and usable.])
2367 AM_CONDITIONAL(BUILD_WITH_LIBLVM2APP, test "x$with_liblvm2app" = "xyes")
2370 # --with-libmemcached {{{
2371 with_libmemcached_cppflags=""
2372 with_libmemcached_ldflags=""
2373 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2375 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2377 with_libmemcached_cppflags="-I$withval/include"
2378 with_libmemcached_ldflags="-L$withval/lib"
2379 with_libmemcached="yes"
2381 with_libmemcached="$withval"
2385 with_libmemcached="yes"
2387 if test "x$with_libmemcached" = "xyes"
2389 SAVE_CPPFLAGS="$CPPFLAGS"
2390 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2392 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2394 CPPFLAGS="$SAVE_CPPFLAGS"
2396 if test "x$with_libmemcached" = "xyes"
2398 SAVE_CPPFLAGS="$CPPFLAGS"
2399 SAVE_LDFLAGS="$LDFLAGS"
2400 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2401 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2403 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2405 CPPFLAGS="$SAVE_CPPFLAGS"
2406 LDFLAGS="$SAVE_LDFLAGS"
2408 if test "x$with_libmemcached" = "xyes"
2410 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2411 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2412 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2413 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2414 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2415 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2416 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2418 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2421 # --with-libmodbus {{{
2422 with_libmodbus_config=""
2423 with_libmodbus_cflags=""
2424 with_libmodbus_libs=""
2425 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2427 if test "x$withval" = "xno"
2430 else if test "x$withval" = "xyes"
2432 with_libmodbus="use_pkgconfig"
2433 else if test -d "$with_libmodbus/lib"
2435 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2436 with_libmodbus_cflags="-I$withval/include"
2437 with_libmodbus_libs="-L$withval/lib -lmodbus"
2438 with_libmodbus="yes"
2441 [with_libmodbus="use_pkgconfig"])
2443 # configure using pkg-config
2444 if test "x$with_libmodbus" = "xuse_pkgconfig"
2446 if test "x$PKG_CONFIG" = "x"
2448 with_libmodbus="no (Don't have pkg-config)"
2451 if test "x$with_libmodbus" = "xuse_pkgconfig"
2453 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2454 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2457 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2460 if test "x$with_libmodbus" = "xuse_pkgconfig"
2462 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2465 with_libmodbus="no ($PKG_CONFIG failed)"
2467 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2470 with_libmodbus="no ($PKG_CONFIG failed)"
2473 if test "x$with_libmodbus" = "xuse_pkgconfig"
2475 with_libmodbus="yes"
2478 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2479 # the actual checks.
2480 if test "x$with_libmodbus" = "xyes"
2482 SAVE_CPPFLAGS="$CPPFLAGS"
2483 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2485 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2487 CPPFLAGS="$SAVE_CPPFLAGS"
2489 if test "x$with_libmodbus" = "xyes"
2491 SAVE_CPPFLAGS="$CPPFLAGS"
2492 SAVE_LDFLAGS="$LDFLAGS"
2494 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2495 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2497 AC_CHECK_LIB(modbus, modbus_connect,
2498 [with_libmodbus="yes"],
2499 [with_libmodbus="no (symbol modbus_connect not found)"])
2501 CPPFLAGS="$SAVE_CPPFLAGS"
2502 LDFLAGS="$SAVE_LDFLAGS"
2504 if test "x$with_libmodbus" = "xyes"
2506 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2507 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2508 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2509 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2513 # --with-libmongoc {{{
2514 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2516 if test "x$withval" = "xyes"
2518 with_libmongoc="yes"
2519 else if test "x$withval" = "xno"
2523 with_libmongoc="yes"
2524 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2525 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2528 [with_libmongoc="yes"])
2530 SAVE_CPPFLAGS="$CPPFLAGS"
2531 SAVE_LDFLAGS="$LDFLAGS"
2533 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2534 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2536 if test "x$with_libmongoc" = "xyes"
2538 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2540 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2542 AC_CHECK_HEADERS(mongo.h,
2543 [with_libmongoc="yes"],
2544 [with_libmongoc="no ('mongo.h' not found)"],
2546 # define MONGO_HAVE_STDINT 1
2548 # define MONGO_USE_LONG_LONG_INT 1
2552 if test "x$with_libmongoc" = "xyes"
2554 if test "x$LIBMONGOC_LDFLAGS" != "x"
2556 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2558 AC_CHECK_LIB(mongoc, mongo_run_command,
2559 [with_libmongoc="yes"],
2560 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2563 CPPFLAGS="$SAVE_CPPFLAGS"
2564 LDFLAGS="$SAVE_LDFLAGS"
2566 if test "x$with_libmongoc" = "xyes"
2568 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2569 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2570 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2571 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2573 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2576 # --with-libmysql {{{
2577 with_mysql_config="mysql_config"
2578 with_mysql_cflags=""
2580 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2582 if test "x$withval" = "xno"
2585 else if test "x$withval" = "xyes"
2589 if test -f "$withval" && test -x "$withval";
2591 with_mysql_config="$withval"
2592 else if test -x "$withval/bin/mysql_config"
2594 with_mysql_config="$withval/bin/mysql_config"
2602 if test "x$with_libmysql" = "xyes"
2604 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2605 mysql_config_status=$?
2607 if test $mysql_config_status -ne 0
2609 with_libmysql="no ($with_mysql_config failed)"
2611 SAVE_CPPFLAGS="$CPPFLAGS"
2612 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2615 have_mysql_mysql_h="no"
2616 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2618 if test "x$have_mysql_h" = "xno"
2620 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2623 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2625 with_libmysql="no (mysql.h not found)"
2628 CPPFLAGS="$SAVE_CPPFLAGS"
2631 if test "x$with_libmysql" = "xyes"
2633 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2634 mysql_config_status=$?
2636 if test $mysql_config_status -ne 0
2638 with_libmysql="no ($with_mysql_config failed)"
2640 AC_CHECK_LIB(mysqlclient, mysql_init,
2641 [with_libmysql="yes"],
2642 [with_libmysql="no (symbol 'mysql_init' not found)"],
2645 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2646 [with_libmysql="yes"],
2647 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2651 if test "x$with_libmysql" = "xyes"
2653 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2654 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2655 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2656 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2658 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2662 with_libmnl_cflags=""
2664 AC_ARG_WITH(libmnl, [AS_HELP_STRING([--with-libmnl@<:@=PREFIX@:>@], [Path to libmnl.])],
2666 echo "libmnl: withval = $withval"
2667 if test "x$withval" = "xyes"
2670 else if test "x$withval" = "xno"
2674 if test -d "$withval/include"
2676 with_libmnl_cflags="-I$withval/include"
2677 with_libmnl_libs="-L$withval/lib -lmnl"
2680 AC_MSG_ERROR("no such directory: $withval/include")
2685 if test "x$ac_system" = "xLinux"
2689 with_libmnl="no (Linux only library)"
2692 if test "x$PKG_CONFIG" = "x"
2694 with_libmnl="no (Don't have pkg-config)"
2696 if test "x$with_libmnl" = "xyes"
2698 if $PKG_CONFIG --exists libmnl 2>/dev/null; then
2699 with_libmnl_cflags="$with_libmnl_ldflags `$PKG_CONFIG --cflags libmnl`"
2700 with_libmnl_libs="$with_libmnl_libs `$PKG_CONFIG --libs libmnl`"
2703 AC_CHECK_HEADERS(libmnl.h libmnl/libmnl.h,
2709 #include <sys/types.h>
2710 #include <asm/types.h>
2711 #include <sys/socket.h>
2712 #include <linux/netlink.h>
2713 #include <linux/rtnetlink.h>])
2714 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2716 #include <sys/types.h>
2717 #include <asm/types.h>
2718 #include <sys/socket.h>])
2720 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2723 #include <sys/types.h>
2724 #include <asm/types.h>
2725 #include <sys/socket.h>
2726 #include <linux/netlink.h>
2727 #include <linux/rtnetlink.h>
2730 int retval = TCA_STATS2;
2734 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2736 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2739 #include <sys/types.h>
2740 #include <asm/types.h>
2741 #include <sys/socket.h>
2742 #include <linux/netlink.h>
2743 #include <linux/rtnetlink.h>
2746 int retval = TCA_STATS;
2750 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2752 if test "x$with_libmnl" = "xyes"
2754 AC_CHECK_MEMBERS([struct rtnl_link_stats64.tx_window_errors],
2755 [AC_DEFINE(HAVE_RTNL_LINK_STATS64, 1, [Define if struct rtnl_link_stats64 exists and is usable.])],
2758 #include <linux/if_link.h>
2761 if test "x$with_libmnl" = "xyes"
2763 AC_CHECK_LIB(mnl, mnl_nlmsg_get_payload,
2764 [with_libmnl="yes"],
2765 [with_libmnl="no (symbol 'mnl_nlmsg_get_payload' not found)"],
2766 [$with_libmnl_libs])
2768 if test "x$with_libmnl" = "xyes"
2770 AC_DEFINE(HAVE_LIBMNL, 1, [Define if libmnl is present and usable.])
2771 BUILD_WITH_LIBMNL_CFLAGS="$with_libmnl_cflags"
2772 BUILD_WITH_LIBMNL_LIBS="$with_libmnl_libs"
2773 AC_SUBST(BUILD_WITH_LIBMNL_CFLAGS)
2774 AC_SUBST(BUILD_WITH_LIBMNL_LIBS)
2776 AM_CONDITIONAL(BUILD_WITH_LIBMNL, test "x$with_libmnl" = "xyes")
2779 # --with-libnetapp {{{
2780 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2781 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2782 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2783 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2784 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2785 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2786 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2788 if test -d "$withval"
2790 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2791 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2792 with_libnetapp="yes"
2794 with_libnetapp="$withval"
2798 with_libnetapp="yes"
2801 SAVE_CPPFLAGS="$CPPFLAGS"
2802 SAVE_LDFLAGS="$LDFLAGS"
2803 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2804 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2806 if test "x$with_libnetapp" = "xyes"
2808 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2810 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2812 AC_CHECK_HEADERS(netapp_api.h,
2813 [with_libnetapp="yes"],
2814 [with_libnetapp="no (netapp_api.h not found)"])
2817 if test "x$with_libnetapp" = "xyes"
2819 if test "x$LIBNETAPP_LDFLAGS" != "x"
2821 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2824 if test "x$LIBNETAPP_LIBS" = "x"
2826 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2828 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2830 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2831 [with_libnetapp="yes"],
2832 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2834 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2837 CPPFLAGS="$SAVE_CPPFLAGS"
2838 LDFLAGS="$SAVE_LDFLAGS"
2840 if test "x$with_libnetapp" = "xyes"
2842 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2845 AC_SUBST(LIBNETAPP_CPPFLAGS)
2846 AC_SUBST(LIBNETAPP_LDFLAGS)
2847 AC_SUBST(LIBNETAPP_LIBS)
2848 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2851 # --with-libnetsnmp {{{
2852 with_snmp_config="net-snmp-config"
2855 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2857 if test "x$withval" = "xno"
2859 with_libnetsnmp="no"
2860 else if test "x$withval" = "xyes"
2862 with_libnetsnmp="yes"
2864 if test -x "$withval"
2866 with_snmp_config="$withval"
2867 with_libnetsnmp="yes"
2869 with_snmp_config="$withval/bin/net-snmp-config"
2870 with_libnetsnmp="yes"
2874 [with_libnetsnmp="yes"])
2875 if test "x$with_libnetsnmp" = "xyes"
2877 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2878 snmp_config_status=$?
2880 if test $snmp_config_status -ne 0
2882 with_libnetsnmp="no ($with_snmp_config failed)"
2884 SAVE_CPPFLAGS="$CPPFLAGS"
2885 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2887 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2889 CPPFLAGS="$SAVE_CPPFLAGS"
2892 if test "x$with_libnetsnmp" = "xyes"
2894 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2895 snmp_config_status=$?
2897 if test $snmp_config_status -ne 0
2899 with_libnetsnmp="no ($with_snmp_config failed)"
2901 AC_CHECK_LIB(netsnmp, init_snmp,
2902 [with_libnetsnmp="yes"],
2903 [with_libnetsnmp="no (libnetsnmp not found)"],
2907 if test "x$with_libnetsnmp" = "xyes"
2909 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2910 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2911 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2912 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2914 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2917 # --with-liboconfig {{{
2918 with_own_liboconfig="no"
2919 liboconfig_LDFLAGS="$LDFLAGS"
2920 liboconfig_CPPFLAGS="$CPPFLAGS"
2921 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2923 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2925 if test -d "$withval/lib"
2927 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2929 if test -d "$withval/include"
2931 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2934 if test "x$withval" = "xno"
2936 AC_MSG_ERROR("liboconfig is required")
2940 with_liboconfig="yes"
2943 save_LDFLAGS="$LDFLAGS"
2944 save_CPPFLAGS="$CPPFLAGS"
2945 LDFLAGS="$liboconfig_LDFLAGS"
2946 CPPFLAGS="$liboconfig_CPPFLAGS"
2947 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2949 with_liboconfig="yes"
2950 with_own_liboconfig="no"
2953 with_liboconfig="yes"
2954 with_own_liboconfig="yes"
2955 LDFLAGS="$save_LDFLAGS"
2956 CPPFLAGS="$save_CPPFLAGS"
2959 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2960 if test "x$with_own_liboconfig" = "xyes"
2962 with_liboconfig="yes (shipped version)"
2966 # --with-liboping {{{
2967 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2969 if test "x$withval" = "xyes"
2972 else if test "x$withval" = "xno"
2977 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2978 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2981 [with_liboping="yes"])
2983 SAVE_CPPFLAGS="$CPPFLAGS"
2984 SAVE_LDFLAGS="$LDFLAGS"
2986 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2987 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2989 if test "x$with_liboping" = "xyes"
2991 if test "x$LIBOPING_CPPFLAGS" != "x"
2993 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2995 AC_CHECK_HEADERS(oping.h,
2996 [with_liboping="yes"],
2997 [with_liboping="no (oping.h not found)"])
2999 if test "x$with_liboping" = "xyes"
3001 if test "x$LIBOPING_LDFLAGS" != "x"
3003 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
3005 AC_CHECK_LIB(oping, ping_construct,
3006 [with_liboping="yes"],
3007 [with_liboping="no (symbol 'ping_construct' not found)"])
3010 CPPFLAGS="$SAVE_CPPFLAGS"
3011 LDFLAGS="$SAVE_LDFLAGS"
3013 if test "x$with_liboping" = "xyes"
3015 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
3016 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
3017 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
3018 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
3020 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
3024 with_oracle_cppflags=""
3026 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
3028 if test "x$withval" = "xyes"
3030 if test "x$ORACLE_HOME" = "x"
3032 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
3035 else if test "x$withval" = "xno"
3040 ORACLE_HOME="$withval"
3044 if test "x$ORACLE_HOME" = "x"
3046 with_oracle="no (ORACLE_HOME is not set)"
3051 if test "x$ORACLE_HOME" != "x"
3053 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
3055 if test -e "$ORACLE_HOME/lib/ldflags"
3057 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
3059 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
3060 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
3062 if test "x$with_oracle" = "xyes"
3064 SAVE_CPPFLAGS="$CPPFLAGS"
3065 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
3067 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
3069 CPPFLAGS="$SAVE_CPPFLAGS"
3071 if test "x$with_oracle" = "xyes"
3073 SAVE_CPPFLAGS="$CPPFLAGS"
3075 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
3076 LIBS="$LIBS $with_oracle_libs"
3078 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
3080 CPPFLAGS="$SAVE_CPPFLAGS"
3083 if test "x$with_oracle" = "xyes"
3085 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
3086 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
3087 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
3088 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
3092 # --with-libowcapi {{{
3093 with_libowcapi_cppflags=""
3094 with_libowcapi_libs="-lowcapi"
3095 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
3097 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3099 with_libowcapi_cppflags="-I$withval/include"
3100 with_libowcapi_libs="-L$withval/lib -lowcapi"
3101 with_libowcapi="yes"
3103 with_libowcapi="$withval"
3107 with_libowcapi="yes"
3109 if test "x$with_libowcapi" = "xyes"
3111 SAVE_CPPFLAGS="$CPPFLAGS"
3112 CPPFLAGS="$with_libowcapi_cppflags"
3114 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
3116 CPPFLAGS="$SAVE_CPPFLAGS"
3118 if test "x$with_libowcapi" = "xyes"
3120 SAVE_LDFLAGS="$LDFLAGS"
3121 SAVE_CPPFLAGS="$CPPFLAGS"
3122 LDFLAGS="$with_libowcapi_libs"
3123 CPPFLAGS="$with_libowcapi_cppflags"
3125 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
3127 LDFLAGS="$SAVE_LDFLAGS"
3128 CPPFLAGS="$SAVE_CPPFLAGS"
3130 if test "x$with_libowcapi" = "xyes"
3132 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
3133 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
3134 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
3135 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
3139 # --with-libpcap {{{
3140 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
3142 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3144 LDFLAGS="$LDFLAGS -L$withval/lib"
3145 CPPFLAGS="$CPPFLAGS -I$withval/include"
3148 with_libpcap="$withval"
3154 if test "x$with_libpcap" = "xyes"
3156 AC_CHECK_LIB(pcap, pcap_open_live,
3158 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
3159 ], [with_libpcap="no (libpcap not found)"])
3161 if test "x$with_libpcap" = "xyes"
3163 AC_CHECK_HEADERS(pcap.h,,
3164 [with_libpcap="no (pcap.h not found)"])
3166 if test "x$with_libpcap" = "xyes"
3168 AC_CHECK_HEADERS(pcap-bpf.h,,
3169 [with_libpcap="no (pcap-bpf.h not found)"])
3171 if test "x$with_libpcap" = "xyes"
3173 AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP],
3174 [c_cv_libpcap_have_pcap_error_iface_not_up],
3175 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
3180 int val = PCAP_ERROR_IFACE_NOT_UP;
3184 [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
3185 [c_cv_libpcap_have_pcap_error_iface_not_up="no"]))
3187 if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes"
3189 with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)"
3191 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3194 # --with-libperl {{{
3195 perl_interpreter="perl"
3196 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3198 if test -f "$withval" && test -x "$withval"
3200 perl_interpreter="$withval"
3202 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3204 LDFLAGS="$LDFLAGS -L$withval/lib"
3205 CPPFLAGS="$CPPFLAGS -I$withval/include"
3206 perl_interpreter="$withval/bin/perl"
3209 with_libperl="$withval"
3216 AC_MSG_CHECKING([for perl])
3217 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3218 if test -x "$perl_interpreter"
3220 AC_MSG_RESULT([yes ($perl_interpreter)])
3226 AC_SUBST(PERL, "$perl_interpreter")
3228 if test "x$with_libperl" = "xyes" \
3229 && test -n "$perl_interpreter"
3231 SAVE_CFLAGS="$CFLAGS"
3233 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3234 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3235 PERL_LIBS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3236 CFLAGS="$CFLAGS $PERL_CFLAGS"
3237 LIBS="$LIBS $PERL_LIBS"
3239 AC_CACHE_CHECK([for libperl],
3240 [c_cv_have_libperl],
3241 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3243 #define PERL_NO_GET_CONTEXT
3250 load_module (PERL_LOADMOD_NOIMPORT,
3251 newSVpv ("Collectd::Plugin::FooBar", 24),
3255 [c_cv_have_libperl="yes"],
3256 [c_cv_have_libperl="no"]
3260 if test "x$c_cv_have_libperl" = "xyes"
3262 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3263 AC_SUBST(PERL_CFLAGS)
3269 CFLAGS="$SAVE_CFLAGS"
3271 else if test -z "$perl_interpreter"; then
3272 with_libperl="no (no perl interpreter found)"
3273 c_cv_have_libperl="no"
3275 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3277 if test "x$with_libperl" = "xyes"
3279 SAVE_CFLAGS="$CFLAGS"
3281 CFLAGS="$CFLAGS $PERL_CFLAGS"
3282 LIBS="$LIBS $PERL_LIBS"
3284 AC_CACHE_CHECK([if perl supports ithreads],
3285 [c_cv_have_perl_ithreads],
3286 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3292 #if !defined(USE_ITHREADS)
3293 # error "Perl does not support ithreads!"
3294 #endif /* !defined(USE_ITHREADS) */
3298 [c_cv_have_perl_ithreads="yes"],
3299 [c_cv_have_perl_ithreads="no"]
3303 if test "x$c_cv_have_perl_ithreads" = "xyes"
3305 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3308 CFLAGS="$SAVE_CFLAGS"
3312 if test "x$with_libperl" = "xyes"
3314 SAVE_CFLAGS="$CFLAGS"
3316 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3317 # (see issues #41 and #42)
3318 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3319 LIBS="$LIBS $PERL_LIBS"
3321 AC_CACHE_CHECK([for broken Perl_load_module()],
3322 [c_cv_have_broken_perl_load_module],
3323 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3325 #define PERL_NO_GET_CONTEXT
3332 load_module (PERL_LOADMOD_NOIMPORT,
3333 newSVpv ("Collectd::Plugin::FooBar", 24),
3337 [c_cv_have_broken_perl_load_module="no"],
3338 [c_cv_have_broken_perl_load_module="yes"]
3342 CFLAGS="$SAVE_CFLAGS"
3345 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3346 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3348 if test "x$with_libperl" = "xyes"
3350 SAVE_CFLAGS="$CFLAGS"
3352 CFLAGS="$CFLAGS $PERL_CFLAGS"
3353 LIBS="$LIBS $PERL_LIBS"
3356 [struct mgvtbl.svt_local],
3357 [have_struct_mgvtbl_svt_local="yes"],
3358 [have_struct_mgvtbl_svt_local="no"],
3365 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3367 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3368 [Define if Perl's struct mgvtbl has member svt_local.])
3371 CFLAGS="$SAVE_CFLAGS"
3377 with_pg_config="pg_config"
3378 with_libpq_includedir=""
3379 with_libpq_libdir=""
3380 with_libpq_cppflags=""
3381 with_libpq_ldflags=""
3382 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3385 if test "x$withval" = "xno"
3388 else if test "x$withval" = "xyes"
3392 if test -f "$withval" && test -x "$withval";
3394 with_pg_config="$withval"
3395 else if test -x "$withval/bin/pg_config"
3397 with_pg_config="$withval/bin/pg_config"
3405 if test "x$with_libpq" = "xyes"
3407 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3410 if test $pg_config_status -eq 0
3412 if test -n "$with_libpq_includedir"; then
3413 for dir in $with_libpq_includedir; do
3414 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3418 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3421 SAVE_CPPFLAGS="$CPPFLAGS"
3422 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3424 AC_CHECK_HEADERS(libpq-fe.h, [],
3425 [with_libpq="no (libpq-fe.h not found)"], [])
3427 CPPFLAGS="$SAVE_CPPFLAGS"
3429 if test "x$with_libpq" = "xyes"
3431 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3434 if test $pg_config_status -eq 0
3436 if test -n "$with_libpq_libdir"; then
3437 for dir in $with_libpq_libdir; do
3438 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3442 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3445 SAVE_LDFLAGS="$LDFLAGS"
3446 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3448 AC_CHECK_LIB(pq, PQconnectdb,
3450 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3452 AC_CHECK_LIB(pq, PQserverVersion,
3454 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3456 LDFLAGS="$SAVE_LDFLAGS"
3458 if test "x$with_libpq" = "xyes"
3460 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3461 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3462 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3463 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3465 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3468 # --with-libpthread {{{
3469 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3470 [ if test "x$withval" != "xno" \
3471 && test "x$withval" != "xyes"
3473 LDFLAGS="$LDFLAGS -L$withval/lib"
3474 CPPFLAGS="$CPPFLAGS -I$withval/include"
3475 with_libpthread="yes"
3477 if test "x$withval" = "xno"
3479 with_libpthread="no (disabled)"
3482 ], [with_libpthread="yes"])
3483 if test "x$with_libpthread" = "xyes"
3485 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3488 if test "x$with_libpthread" = "xyes"
3490 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3492 if test "x$with_libpthread" = "xyes"
3498 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3499 [Wether or not to use pthread (POSIX threads) library])
3500 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3505 with_python_path="$PATH"
3506 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3508 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3510 with_python="$withval"
3511 else if test -x "$withval"
3513 with_python_prog="$withval"
3514 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3516 else if test -d "$withval"
3518 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3521 AC_MSG_WARN([Argument not recognized: $withval])
3523 ], [with_python="yes"])
3526 SAVE_CPPFLAGS="$CPPFLAGS"
3527 SAVE_LDFLAGS="$LDFLAGS"
3530 PATH="$with_python_path"
3532 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3534 AC_MSG_CHECKING([for python])
3535 with_python_prog="`which python 2>/dev/null`"
3536 if test "x$with_python_prog" = "x"
3538 AC_MSG_RESULT([not found])
3539 with_python="no (interpreter not found)"
3541 AC_MSG_RESULT([$with_python_prog])
3545 if test "x$with_python" = "xyes"
3547 AC_MSG_CHECKING([for Python CPPFLAGS])
3548 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3549 python_config_status=$?
3551 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3553 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3556 AC_MSG_RESULT([$python_include_path])
3560 if test "x$with_python" = "xyes"
3562 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3563 AC_CHECK_HEADERS(Python.h,
3564 [with_python="yes"],
3565 [with_python="no ('Python.h' not found)"])
3568 if test "x$with_python" = "xyes"
3570 AC_MSG_CHECKING([for Python LDFLAGS])
3571 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`
3572 python_config_status=$?
3574 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3576 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3579 AC_MSG_RESULT([$python_library_path])
3583 if test "x$with_python" = "xyes"
3585 AC_MSG_CHECKING([for Python LIBS])
3586 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`
3587 python_config_status=$?
3589 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3591 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3594 AC_MSG_RESULT([$python_library_flags])
3598 if test "x$with_python" = "xyes"
3600 LDFLAGS="-L$python_library_path $LDFLAGS"
3601 LIBS="$python_library_flags $LIBS"
3603 AC_CHECK_FUNC(PyObject_CallFunction,
3604 [with_python="yes"],
3605 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3609 CPPFLAGS="$SAVE_CPPFLAGS"
3610 LDFLAGS="$SAVE_LDFLAGS"
3613 if test "x$with_python" = "xyes"
3615 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3616 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3617 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3618 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3619 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3620 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3624 # --with-librabbitmq {{{
3625 with_librabbitmq_cppflags=""
3626 with_librabbitmq_ldflags=""
3627 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3629 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3631 with_librabbitmq_cppflags="-I$withval/include"
3632 with_librabbitmq_ldflags="-L$withval/lib"
3633 with_librabbitmq="yes"
3635 with_librabbitmq="$withval"
3639 with_librabbitmq="yes"
3641 SAVE_CPPFLAGS="$CPPFLAGS"
3642 SAVE_LDFLAGS="$LDFLAGS"
3643 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3644 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3645 if test "x$with_librabbitmq" = "xyes"
3647 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3649 if test "x$with_librabbitmq" = "xyes"
3651 # librabbitmq up to version 0.9.1 provides "library_errno", later
3652 # versions use "library_error". The library does not provide a version
3653 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3654 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3657 # include <stdlib.h>
3663 # include <stdint.h>
3666 # include <inttypes.h>
3671 if test "x$with_librabbitmq" = "xyes"
3673 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3675 if test "x$with_librabbitmq" = "xyes"
3677 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3678 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3679 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3680 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3681 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3682 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3683 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3685 CPPFLAGS="$SAVE_CPPFLAGS"
3686 LDFLAGS="$SAVE_LDFLAGS"
3687 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3689 with_amqp_tcp_socket="no"
3690 if test "x$with_librabbitmq" = "xyes"
3692 SAVE_CPPFLAGS="$CPPFLAGS"
3693 SAVE_LDFLAGS="$LDFLAGS"
3695 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3696 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3699 AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h)
3700 AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"])
3701 if test "x$with_amqp_tcp_socket" = "xyes"
3703 AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1,
3704 [Define if librabbitmq provides the new TCP socket interface.])
3707 AC_CHECK_DECLS(amqp_socket_close,
3708 [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"],
3711 #ifdef HAVE_AMQP_TCP_SOCKET_H
3712 # include <amqp_tcp_socket.h>
3714 #ifdef HAVE_AMQP_SOCKET_H
3715 # include <amqp_socket.h>
3719 CPPFLAGS="$SAVE_CPPFLAGS"
3720 LDFLAGS="$SAVE_LDFLAGS"
3725 # --with-librdkafka {{{
3726 AC_ARG_WITH(librdkafka, [AS_HELP_STRING([--with-librdkafka@<:@=PREFIX@:>@], [Path to librdkafka.])],
3728 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3730 with_librdkafka_cppflags="-I$withval/include"
3731 with_librdkafka_ldflags="-L$withval/lib"
3732 with_librdkafka="yes"
3734 with_librdkafka="$withval"
3738 with_librdkafka="yes"
3740 SAVE_CPPFLAGS="$CPPFLAGS"
3741 SAVE_LDFLAGS="$LDFLAGS"
3743 if test "x$with_librdkafka" = "xyes"
3745 AC_CHECK_HEADERS(librdkafka/rdkafka.h, [with_librdkafka="yes"], [with_librdkafka="no (librdkafka/rdkafka.h not found)"])
3748 if test "x$with_librdkafka" = "xyes"
3750 AC_CHECK_LIB(rdkafka, rd_kafka_new, [with_librdkafka="yes"], [with_librdkafka="no (Symbol 'rd_kafka_new' not found)"])
3751 AC_CHECK_LIB(rdkafka, rd_kafka_conf_set_log_cb, [with_librdkafka_log_cb="yes"], [with_librdkafka_log_cb="no"])
3752 AC_CHECK_LIB(rdkafka, rd_kafka_set_logger, [with_librdkafka_logger="yes"], [with_librdkafka_logger="no"])
3754 if test "x$with_librdkafka" = "xyes"
3756 BUILD_WITH_LIBRDKAFKA_CPPFLAGS="$with_librdkafka_cppflags"
3757 BUILD_WITH_LIBRDKAFKA_LDFLAGS="$with_librdkafka_ldflags"
3758 BUILD_WITH_LIBRDKAFKA_LIBS="-lrdkafka"
3759 AC_SUBST(BUILD_WITH_LIBRDKAFKA_CPPFLAGS)
3760 AC_SUBST(BUILD_WITH_LIBRDKAFKA_LDFLAGS)
3761 AC_SUBST(BUILD_WITH_LIBRDKAFKA_LIBS)
3762 AC_DEFINE(HAVE_LIBRDKAFKA, 1, [Define if librdkafka is present and usable.])
3763 if test "x$with_librdkafka_log_cb" = "xyes"
3765 AC_DEFINE(HAVE_LIBRDKAFKA_LOG_CB, 1, [Define if librdkafka log facility is present and usable.])
3767 if test "x$with_librdkafka_logger" = "xyes"
3769 AC_DEFINE(HAVE_LIBRDKAFKA_LOGGER, 1, [Define if librdkafka log facility is present and usable.])
3772 CPPFLAGS="$SAVE_CPPFLAGS"
3773 LDFLAGS="$SAVE_LDFLAGS"
3774 AM_CONDITIONAL(BUILD_WITH_LIBRDKAFKA, test "x$with_librdkafka" = "xyes")
3778 # --with-librouteros {{{
3779 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3781 if test "x$withval" = "xyes"
3783 with_librouteros="yes"
3784 else if test "x$withval" = "xno"
3786 with_librouteros="no"
3788 with_librouteros="yes"
3789 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3790 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3793 [with_librouteros="yes"])
3795 SAVE_CPPFLAGS="$CPPFLAGS"
3796 SAVE_LDFLAGS="$LDFLAGS"
3798 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3799 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3801 if test "x$with_librouteros" = "xyes"
3803 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3805 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3807 AC_CHECK_HEADERS(routeros_api.h,
3808 [with_librouteros="yes"],
3809 [with_librouteros="no (routeros_api.h not found)"])
3811 if test "x$with_librouteros" = "xyes"
3813 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3815 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3817 AC_CHECK_LIB(routeros, ros_interface,
3818 [with_librouteros="yes"],
3819 [with_librouteros="no (symbol 'ros_interface' not found)"])
3822 CPPFLAGS="$SAVE_CPPFLAGS"
3823 LDFLAGS="$SAVE_LDFLAGS"
3825 if test "x$with_librouteros" = "xyes"
3827 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3828 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3829 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3830 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3832 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3836 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3839 librrd_threadsafe="yes"
3840 librrd_rrdc_update="no"
3841 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3842 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3844 librrd_cflags="-I$withval/include"
3845 librrd_ldflags="-L$withval/lib"
3848 with_librrd="$withval"
3850 ], [with_librrd="yes"])
3851 if test "x$with_librrd" = "xyes"
3853 SAVE_CPPFLAGS="$CPPFLAGS"
3854 SAVE_LDFLAGS="$LDFLAGS"
3856 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3857 LDFLAGS="$LDFLAGS $librrd_ldflags"
3859 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3861 CPPFLAGS="$SAVE_CPPFLAGS"
3862 LDFLAGS="$SAVE_LDFLAGS"
3864 if test "x$with_librrd" = "xyes"
3866 SAVE_CPPFLAGS="$CPPFLAGS"
3867 SAVE_LDFLAGS="$LDFLAGS"
3869 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3870 LDFLAGS="$LDFLAGS $librrd_ldflags"
3872 AC_CHECK_LIB(rrd_th, rrd_update_r,
3874 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3876 [librrd_threadsafe="no"
3877 AC_CHECK_LIB(rrd, rrd_update,
3879 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3881 [with_librrd="no (symbol 'rrd_update' not found)"],
3886 if test "x$librrd_threadsafe" = "xyes"
3888 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3890 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3893 CPPFLAGS="$SAVE_CPPFLAGS"
3894 LDFLAGS="$SAVE_LDFLAGS"
3896 if test "x$with_librrd" = "xyes"
3898 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3899 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3900 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3901 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3903 if test "x$librrd_threadsafe" = "xyes"
3905 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3909 # --with-libsensors {{{
3910 with_sensors_cflags=""
3911 with_sensors_ldflags=""
3912 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3914 if test "x$withval" = "xno"
3916 with_libsensors="no"
3918 with_libsensors="yes"
3919 if test "x$withval" != "xyes"
3921 with_sensors_cflags="-I$withval/include"
3922 with_sensors_ldflags="-L$withval/lib"
3923 with_libsensors="yes"
3928 if test "x$ac_system" = "xLinux"
3930 with_libsensors="yes"
3932 with_libsensors="no (Linux only library)"
3935 if test "x$with_libsensors" = "xyes"
3937 SAVE_CPPFLAGS="$CPPFLAGS"
3938 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3940 # AC_CHECK_HEADERS(sensors/sensors.h,
3942 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3944 # [with_libsensors="no (sensors/sensors.h not found)"])
3945 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3947 CPPFLAGS="$SAVE_CPPFLAGS"
3949 if test "x$with_libsensors" = "xyes"
3951 SAVE_CPPFLAGS="$CPPFLAGS"
3952 SAVE_LDFLAGS="$LDFLAGS"
3953 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3954 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3956 AC_CHECK_LIB(sensors, sensors_init,
3958 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3960 [with_libsensors="no (libsensors not found)"])
3962 CPPFLAGS="$SAVE_CPPFLAGS"
3963 LDFLAGS="$SAVE_LDFLAGS"
3965 if test "x$with_libsensors" = "xyes"
3967 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3968 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3969 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3970 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3972 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3975 # --with-libsigrok {{{
3976 with_libsigrok_cflags=""
3977 with_libsigrok_ldflags=""
3978 AC_ARG_WITH(libsigrok, [AS_HELP_STRING([--with-libsigrok@<:@=PREFIX@:>@], [Path to libsigrok.])],
3980 if test "x$withval" = "xno"
3984 with_libsigrok="yes"
3985 if test "x$withval" != "xyes"
3987 with_libsigrok_cflags="-I$withval/include"
3988 with_libsigrok_ldflags="-L$withval/lib"
3991 ],[with_libsigrok="yes"])
3993 # libsigrok has a glib dependency
3994 if test "x$with_libsigrok" = "xyes"
3996 m4_ifdef([AM_PATH_GLIB_2_0],
3998 AM_PATH_GLIB_2_0([2.28.0],
3999 [with_libsigrok_cflags="$with_libsigrok_cflags $GLIB_CFLAGS"; with_libsigrok_ldflags="$with_libsigrok_ldflags $GLIB_LIBS"])
4002 with_libsigrok="no (glib not available)"
4008 if test "x$with_libsigrok" = "xyes"
4010 SAVE_CPPFLAGS="$CPPFLAGS"
4011 CPPFLAGS="$CPPFLAGS $with_libsigrok_cflags"
4013 AC_CHECK_HEADERS(libsigrok/libsigrok.h, [], [with_libsigrok="no (libsigrok/libsigrok.h not found)"])
4015 CPPFLAGS="$SAVE_CPPFLAGS"
4019 if test "x$with_libsigrok" = "xyes"
4021 SAVE_CPPFLAGS="$CPPFLAGS"
4022 SAVE_LDFLAGS="$LDFLAGS"
4023 CPPFLAGS="$CPPFLAGS $with_libsigrok_cflags"
4024 LDFLAGS="$LDFLAGS $with_libsigrok_ldflags"
4026 AC_CHECK_LIB(sigrok, sr_init,
4028 AC_DEFINE(HAVE_LIBSIGROK, 1, [Define to 1 if you have the sigrok library (-lsigrok).])
4030 [with_libsigrok="no (libsigrok not found)"])
4032 CPPFLAGS="$SAVE_CPPFLAGS"
4033 LDFLAGS="$SAVE_LDFLAGS"
4035 if test "x$with_libsigrok" = "xyes"
4037 BUILD_WITH_LIBSIGROK_CFLAGS="$with_libsigrok_cflags"
4038 BUILD_WITH_LIBSIGROK_LDFLAGS="$with_libsigrok_ldflags"
4039 AC_SUBST(BUILD_WITH_LIBSIGROK_CFLAGS)
4040 AC_SUBST(BUILD_WITH_LIBSIGROK_LDFLAGS)
4042 AM_CONDITIONAL(BUILD_WITH_LIBSIGROK, test "x$with_libsigrok" = "xyes")
4045 # --with-libstatgrab {{{
4046 with_libstatgrab_cflags=""
4047 with_libstatgrab_ldflags=""
4048 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
4050 if test "x$withval" != "xno" \
4051 && test "x$withval" != "xyes"
4053 with_libstatgrab_cflags="-I$withval/include"
4054 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
4055 with_libstatgrab="yes"
4056 with_libstatgrab_pkg_config="no"
4058 with_libstatgrab="$withval"
4059 with_libstatgrab_pkg_config="yes"
4063 with_libstatgrab="yes"
4064 with_libstatgrab_pkg_config="yes"
4067 if test "x$with_libstatgrab" = "xyes" \
4068 && test "x$with_libstatgrab_pkg_config" = "xyes"
4070 if test "x$PKG_CONFIG" != "x"
4072 AC_MSG_CHECKING([pkg-config for libstatgrab])
4074 $PKG_CONFIG --exists libstatgrab 2>/dev/null
4077 with_libstatgrab_pkg_config="no"
4078 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
4079 temp_result="not found"
4081 AC_MSG_RESULT([$temp_result])
4083 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
4084 with_libstatgrab_pkg_config="no"
4085 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
4089 if test "x$with_libstatgrab" = "xyes" \
4090 && test "x$with_libstatgrab_pkg_config" = "xyes" \
4091 && test "x$with_libstatgrab_cflags" = "x"
4093 AC_MSG_CHECKING([for libstatgrab CFLAGS])
4094 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
4097 with_libstatgrab_cflags="$temp_result"
4099 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
4100 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
4102 AC_MSG_RESULT([$temp_result])
4105 if test "x$with_libstatgrab" = "xyes" \
4106 && test "x$with_libstatgrab_pkg_config" = "xyes" \
4107 && test "x$with_libstatgrab_ldflags" = "x"
4109 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
4110 temp_result="`$PKG_CONFIG --libs libstatgrab`"
4113 with_libstatgrab_ldflags="$temp_result"
4115 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
4116 temp_result="$PKG_CONFIG --libs libstatgrab failed"
4118 AC_MSG_RESULT([$temp_result])
4121 if test "x$with_libstatgrab" = "xyes"
4123 SAVE_CPPFLAGS="$CPPFLAGS"
4124 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
4126 AC_CHECK_HEADERS(statgrab.h,
4127 [with_libstatgrab="yes"],
4128 [with_libstatgrab="no (statgrab.h not found)"])
4130 CPPFLAGS="$SAVE_CPPFLAGS"
4133 if test "x$with_libstatgrab" = "xyes"
4135 SAVE_CFLAGS="$CFLAGS"
4136 SAVE_LDFLAGS="$LDFLAGS"
4138 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
4139 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
4141 AC_CHECK_LIB(statgrab, sg_init,
4142 [with_libstatgrab="yes"],
4143 [with_libstatgrab="no (symbol sg_init not found)"])
4145 CFLAGS="$SAVE_CFLAGS"
4146 LDFLAGS="$SAVE_LDFLAGS"
4149 if test "x$with_libstatgrab" = "xyes"
4151 SAVE_CFLAGS="$CFLAGS"
4154 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
4155 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
4156 LIBS="-lstatgrab $LIBS"
4158 AC_CACHE_CHECK([if libstatgrab >= 0.90],
4159 [c_cv_have_libstatgrab_0_90],
4160 AC_LINK_IFELSE([AC_LANG_PROGRAM(
4163 #include <statgrab.h>
4166 if (sg_init()) return 0;
4169 [c_cv_have_libstatgrab_0_90="no"],
4170 [c_cv_have_libstatgrab_0_90="yes"]
4174 CFLAGS="$SAVE_CFLAGS"
4175 LDFLAGS="$SAVE_LDFLAGS"
4179 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
4180 if test "x$with_libstatgrab" = "xyes"
4182 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
4183 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
4184 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
4185 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
4186 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
4187 if test "x$c_cv_have_libstatgrab_0_90" = "xyes"
4189 AC_DEFINE(HAVE_LIBSTATGRAB_0_90, 1, [Define to 1 if libstatgrab version >= 0.90])
4194 # --with-libtokyotyrant {{{
4195 with_libtokyotyrant_cppflags=""
4196 with_libtokyotyrant_ldflags=""
4197 with_libtokyotyrant_libs=""
4198 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
4200 if test "x$withval" = "xno"
4202 with_libtokyotyrant="no"
4203 else if test "x$withval" = "xyes"
4205 with_libtokyotyrant="yes"
4207 with_libtokyotyrant_cppflags="-I$withval/include"
4208 with_libtokyotyrant_ldflags="-L$withval/include"
4209 with_libtokyotyrant_libs="-ltokyotyrant"
4210 with_libtokyotyrant="yes"
4214 with_libtokyotyrant="yes"
4217 if test "x$with_libtokyotyrant" = "xyes"
4219 if $PKG_CONFIG --exists tokyotyrant
4221 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
4222 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`"
4223 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`"
4227 SAVE_CPPFLAGS="$CPPFLAGS"
4228 SAVE_LDFLAGS="$LDFLAGS"
4229 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
4230 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
4232 if test "x$with_libtokyotyrant" = "xyes"
4234 AC_CHECK_HEADERS(tcrdb.h,
4236 AC_DEFINE(HAVE_TCRDB_H, 1,
4237 [Define to 1 if you have the <tcrdb.h> header file.])
4238 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
4241 if test "x$with_libtokyotyrant" = "xyes"
4243 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
4245 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
4246 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
4248 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
4249 [$with_libtokyotyrant_libs])
4252 CPPFLAGS="$SAVE_CPPFLAGS"
4253 LDFLAGS="$SAVE_LDFLAGS"
4255 if test "x$with_libtokyotyrant" = "xyes"
4257 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
4258 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
4259 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
4260 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
4261 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
4262 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
4264 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
4267 # --with-libudev {{{
4268 with_libudev_cflags=""
4269 with_libudev_ldflags=""
4270 AC_ARG_WITH(libudev, [AS_HELP_STRING([--with-libudev@<:@=PREFIX@:>@], [Path to libudev.])],
4272 if test "x$withval" = "xno"
4277 if test "x$withval" != "xyes"
4279 with_libudev_cflags="-I$withval/include"
4280 with_libudev_ldflags="-L$withval/lib"
4286 if test "x$ac_system" = "xLinux"
4290 with_libudev="no (Linux only library)"
4293 if test "x$with_libudev" = "xyes"
4295 SAVE_CPPFLAGS="$CPPFLAGS"
4296 CPPFLAGS="$CPPFLAGS $with_libudev_cflags"
4298 AC_CHECK_HEADERS(libudev.h, [], [with_libudev="no (libudev.h not found)"])
4300 CPPFLAGS="$SAVE_CPPFLAGS"
4302 if test "x$with_libudev" = "xyes"
4304 SAVE_CPPFLAGS="$CPPFLAGS"
4305 SAVE_LDFLAGS="$LDFLAGS"
4306 CPPFLAGS="$CPPFLAGS $with_libudev_cflags"
4307 LDFLAGS="$LDFLAGS $with_libudev_ldflags"
4309 AC_CHECK_LIB(udev, udev_new,
4311 AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if you have the udev library (-ludev).])
4313 [with_libudev="no (libudev not found)"])
4315 CPPFLAGS="$SAVE_CPPFLAGS"
4316 LDFLAGS="$SAVE_LDFLAGS"
4318 if test "x$with_libudev" = "xyes"
4320 BUILD_WITH_LIBUDEV_CFLAGS="$with_libudev_cflags"
4321 BUILD_WITH_LIBUDEV_LDFLAGS="$with_libudev_ldflags"
4322 AC_SUBST(BUILD_WITH_LIBUDEV_CFLAGS)
4323 AC_SUBST(BUILD_WITH_LIBUDEV_LDFLAGS)
4325 AM_CONDITIONAL(BUILD_WITH_LIBUDEV, test "x$with_libudev" = "xyes")
4328 # --with-libupsclient {{{
4329 with_libupsclient_config=""
4330 with_libupsclient_cflags=""
4331 with_libupsclient_libs=""
4332 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
4334 if test "x$withval" = "xno"
4336 with_libupsclient="no"
4337 else if test "x$withval" = "xyes"
4339 with_libupsclient="use_pkgconfig"
4341 if test -x "$withval"
4343 with_libupsclient_config="$withval"
4344 with_libupsclient="use_libupsclient_config"
4345 else if test -x "$withval/bin/libupsclient-config"
4347 with_libupsclient_config="$withval/bin/libupsclient-config"
4348 with_libupsclient="use_libupsclient_config"
4350 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
4351 with_libupsclient_cflags="-I$withval/include"
4352 with_libupsclient_libs="-L$withval/lib -lupsclient"
4353 with_libupsclient="yes"
4357 [with_libupsclient="use_pkgconfig"])
4359 # configure using libupsclient-config
4360 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4362 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
4363 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
4366 with_libupsclient="no ($with_libupsclient_config failed)"
4368 with_libupsclient_libs="`$with_libupsclient_config --libs`"
4371 with_libupsclient="no ($with_libupsclient_config failed)"
4374 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4376 with_libupsclient="yes"
4379 # configure using pkg-config
4380 if test "x$with_libupsclient" = "xuse_pkgconfig"
4382 if test "x$PKG_CONFIG" = "x"
4384 with_libupsclient="no (Don't have pkg-config)"
4387 if test "x$with_libupsclient" = "xuse_pkgconfig"
4389 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
4390 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
4393 with_libupsclient="no (pkg-config doesn't know libupsclient)"
4396 if test "x$with_libupsclient" = "xuse_pkgconfig"
4398 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
4401 with_libupsclient="no ($PKG_CONFIG failed)"
4403 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
4406 with_libupsclient="no ($PKG_CONFIG failed)"
4409 if test "x$with_libupsclient" = "xuse_pkgconfig"
4411 with_libupsclient="yes"
4414 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
4415 # the actual checks.
4416 if test "x$with_libupsclient" = "xyes"
4418 SAVE_CPPFLAGS="$CPPFLAGS"
4419 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4421 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
4423 CPPFLAGS="$SAVE_CPPFLAGS"
4425 if test "x$with_libupsclient" = "xyes"
4427 SAVE_CPPFLAGS="$CPPFLAGS"
4428 SAVE_LDFLAGS="$LDFLAGS"
4430 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4431 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
4433 AC_CHECK_LIB(upsclient, upscli_connect,
4434 [with_libupsclient="yes"],
4435 [with_libupsclient="no (symbol upscli_connect not found)"])
4437 CPPFLAGS="$SAVE_CPPFLAGS"
4438 LDFLAGS="$SAVE_LDFLAGS"
4440 if test "x$with_libupsclient" = "xyes"
4442 SAVE_CPPFLAGS="$CPPFLAGS"
4443 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4445 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4446 [#include <stdlib.h>
4448 #include <upsclient.h>])
4450 CPPFLAGS="$SAVE_CPPFLAGS"
4452 if test "x$with_libupsclient" = "xyes"
4454 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4455 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4456 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4457 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4461 # --with-libxmms {{{
4462 with_xmms_config="xmms-config"
4465 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4467 if test "x$withval" != "xno" \
4468 && test "x$withval" != "xyes"
4470 if test -f "$withval" && test -x "$withval";
4472 with_xmms_config="$withval"
4473 else if test -x "$withval/bin/xmms-config"
4475 with_xmms_config="$withval/bin/xmms-config"
4478 else if test "x$withval" = "xno"
4488 if test "x$with_libxmms" = "xyes"
4490 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4491 xmms_config_status=$?
4493 if test $xmms_config_status -ne 0
4498 if test "x$with_libxmms" = "xyes"
4500 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4501 xmms_config_status=$?
4503 if test $xmms_config_status -ne 0
4508 if test "x$with_libxmms" = "xyes"
4510 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4512 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4513 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4514 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4515 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4522 with_libxmms_numeric=0
4523 if test "x$with_libxmms" = "xyes"
4525 with_libxmms_numeric=1
4527 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4528 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4531 # --with-libyajl {{{
4532 with_libyajl_cppflags=""
4533 with_libyajl_ldflags=""
4534 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4536 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4538 with_libyajl_cppflags="-I$withval/include"
4539 with_libyajl_ldflags="-L$withval/lib"
4542 with_libyajl="$withval"
4548 if test "x$with_libyajl" = "xyes"
4550 SAVE_CPPFLAGS="$CPPFLAGS"
4551 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4553 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4554 AC_CHECK_HEADERS(yajl/yajl_version.h)
4556 CPPFLAGS="$SAVE_CPPFLAGS"
4558 if test "x$with_libyajl" = "xyes"
4560 SAVE_CPPFLAGS="$CPPFLAGS"
4561 SAVE_LDFLAGS="$LDFLAGS"
4562 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4563 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4565 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4567 CPPFLAGS="$SAVE_CPPFLAGS"
4568 LDFLAGS="$SAVE_LDFLAGS"
4570 if test "x$with_libyajl" = "xyes"
4572 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4573 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4574 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4575 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4576 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4577 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4578 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4580 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4584 with_mic_cflags="-I/opt/intel/mic/sysmgmt/sdk/include"
4585 with_mic_ldpath="-L/opt/intel/mic/sysmgmt/sdk/lib/Linux"
4587 AC_ARG_WITH(mic,[AS_HELP_STRING([--with-mic@<:@=PREFIX@:>@], [Path to Intel MIC Access API.])],
4589 if test "x$withval" = "xno"
4592 else if test "x$withval" = "xyes"
4595 else if test -d "$with_mic/lib"
4597 AC_MSG_NOTICE([Not checking for Intel Mic: Manually configured])
4598 with_mic_cflags="-I$withval/include"
4599 with_mic_ldpath="-L$withval/lib/Linux"
4600 with_mic_libs="-lMicAccessSDK -lscif -lpthread"
4605 if test "x$with_mic" = "xyes"
4607 SAVE_CPPFLAGS="$CPPFLAGS"
4608 CPPFLAGS="$CPPFLAGS $with_mic_cflags"
4609 AC_CHECK_HEADERS(MicAccessApi.h,[],[with_mic="no (MicAccessApi not found)"])
4610 CPPFLAGS="$SAVE_CPPFLAGS"
4612 if test "x$with_mic" = "xyes"
4614 SAVE_CPPFLAGS="$CPPFLAGS"
4615 SAVE_LDFLAGS="$LDFLAGS"
4617 CPPFLAGS="$CPPFLAGS $with_mic_cflags"
4618 LDFLAGS="$LDFLAGS $with_mic_ldpath"
4620 AC_CHECK_LIB(MicAccessSDK, MicInitAPI,
4621 [with_mic_ldpath="$with_mic_ldpath"
4622 with_mic_libs="-lMicAccessSDK -lscif -lpthread"],
4623 [with_mic="no (symbol MicInitAPI not found)"],[-lscif -lpthread])
4625 CPPFLAGS="$SAVE_CPPFLAGS"
4626 LDFLAGS="$SAVE_LDFLAGS"
4629 if test "x$with_mic" = "xyes"
4631 BUILD_WITH_MIC_CPPFLAGS="$with_mic_cflags"
4632 BUILD_WITH_MIC_LIBPATH="$with_mic_ldpath"
4633 BUILD_WITH_MIC_LDADD="$with_mic_libs"
4634 AC_SUBST(BUILD_WITH_MIC_CPPFLAGS)
4635 AC_SUBST(BUILD_WITH_MIC_LIBPATH)
4636 AC_SUBST(BUILD_WITH_MIC_LDADD)
4640 # --with-libvarnish {{{
4641 with_libvarnish_cppflags=""
4642 with_libvarnish_cflags=""
4643 with_libvarnish_libs=""
4644 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4646 if test "x$withval" = "xno"
4648 with_libvarnish="no"
4649 else if test "x$withval" = "xyes"
4651 with_libvarnish="use_pkgconfig"
4652 else if test -d "$with_libvarnish/lib"
4654 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4655 with_libvarnish_cflags="-I$withval/include"
4656 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4657 with_libvarnish="yes"
4660 [with_libvarnish="use_pkgconfig"])
4662 # configure using pkg-config
4663 if test "x$with_libvarnish" = "xuse_pkgconfig"
4665 if test "x$PKG_CONFIG" = "x"
4667 with_libvarnish="no (Don't have pkg-config)"
4670 if test "x$with_libvarnish" = "xuse_pkgconfig"
4672 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4673 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4676 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4679 if test "x$with_libvarnish" = "xuse_pkgconfig"
4681 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4684 with_libvarnish="no ($PKG_CONFIG failed)"
4686 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4689 with_libvarnish="no ($PKG_CONFIG failed)"
4692 if test "x$with_libvarnish" = "xuse_pkgconfig"
4694 with_libvarnish="yes"
4697 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4698 # the actual checks.
4699 if test "x$with_libvarnish" = "xyes"
4701 SAVE_CPPFLAGS="$CPPFLAGS"
4703 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4705 AC_CHECK_HEADERS(varnish/vapi/vsc.h,
4706 [AC_DEFINE([HAVE_VARNISH_V4], [1], [Varnish 4 API support])],
4707 [AC_CHECK_HEADERS(varnish/vsc.h,
4708 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4709 [AC_CHECK_HEADERS(varnish/varnishapi.h,
4710 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])],
4711 [with_libvarnish="no (found none of the varnish header files)"])])])
4713 CPPFLAGS="$SAVE_CPPFLAGS"
4715 if test "x$with_libvarnish" = "xyes"
4717 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4718 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4719 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4720 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4724 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4725 with_libxml2="no (pkg-config isn't available)"
4726 with_libxml2_cflags=""
4727 with_libxml2_ldflags=""
4728 with_libvirt="no (pkg-config isn't available)"
4729 with_libvirt_cflags=""
4730 with_libvirt_ldflags=""
4731 if test "x$PKG_CONFIG" != "x"
4733 $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
4738 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4741 $PKG_CONFIG --exists libvirt 2>/dev/null
4746 with_libvirt="no (pkg-config doesn't know libvirt)"
4749 if test "x$with_libxml2" = "xyes"
4751 with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
4756 with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
4762 if test "x$with_libxml2" = "xyes"
4764 SAVE_CPPFLAGS="$CPPFLAGS"
4765 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4767 AC_CHECK_HEADERS(libxml/parser.h, [],
4768 [with_libxml2="no (libxml/parser.h not found)"])
4770 CPPFLAGS="$SAVE_CPPFLAGS"
4772 if test "x$with_libxml2" = "xyes"
4774 SAVE_CFLAGS="$CFLAGS"
4775 SAVE_LDFLAGS="$LDFLAGS"
4777 CFLAGS="$CFLAGS $with_libxml2_cflags"
4778 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4780 AC_CHECK_LIB(xml2, xmlXPathEval,
4781 [with_libxml2="yes"],
4782 [with_libxml2="no (symbol xmlXPathEval not found)"])
4784 CFLAGS="$SAVE_CFLAGS"
4785 LDFLAGS="$SAVE_LDFLAGS"
4787 dnl Add the right compiler flags and libraries.
4788 if test "x$with_libxml2" = "xyes"; then
4789 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4790 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4791 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4792 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4794 if test "x$with_libvirt" = "xyes"
4796 with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`"
4801 with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`"
4807 if test "x$with_libvirt" = "xyes"
4809 SAVE_CPPFLAGS="$CPPFLAGS"
4810 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4812 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4813 [with_libvirt="no (libvirt/libvirt.h not found)"])
4815 CPPFLAGS="$SAVE_CPPFLAGS"
4817 if test "x$with_libvirt" = "xyes"
4819 SAVE_CFLAGS="$CFLAGS"
4820 SAVE_LDFLAGS="$LDFLAGS"
4822 CFLAGS="$CFLAGS $with_libvirt_cflags"
4823 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4825 AC_CHECK_LIB(virt, virDomainBlockStats,
4826 [with_libvirt="yes"],
4827 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4829 CFLAGS="$SAVE_CFLAGS"
4830 LDFLAGS="$SAVE_LDFLAGS"
4832 dnl Add the right compiler flags and libraries.
4833 if test "x$with_libvirt" = "xyes"; then
4834 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4835 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4836 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4837 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4841 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4842 with_libopenipmipthread="yes"
4843 with_libopenipmipthread_cflags=""
4844 with_libopenipmipthread_libs=""
4846 AC_MSG_CHECKING([for pkg-config])
4848 if test "x$PKG_CONFIG" = "x"
4850 with_libopenipmipthread="no"
4853 temp_result="$PKG_CONFIG"
4855 AC_MSG_RESULT([$temp_result])
4857 if test "x$with_libopenipmipthread" = "xyes"
4859 AC_MSG_CHECKING([for libOpenIPMIpthread])
4860 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4863 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4865 AC_MSG_RESULT([$with_libopenipmipthread])
4868 if test "x$with_libopenipmipthread" = "xyes"
4870 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4871 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4874 with_libopenipmipthread_cflags="$temp_result"
4876 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4877 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4879 AC_MSG_RESULT([$temp_result])
4882 if test "x$with_libopenipmipthread" = "xyes"
4884 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4885 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4888 with_libopenipmipthread_ldflags="$temp_result"
4890 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4891 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4893 AC_MSG_RESULT([$temp_result])
4896 if test "x$with_libopenipmipthread" = "xyes"
4898 SAVE_CPPFLAGS="$CPPFLAGS"
4899 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4901 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4902 [with_libopenipmipthread="yes"],
4903 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4904 [#include <OpenIPMI/ipmiif.h>
4905 #include <OpenIPMI/ipmi_err.h>
4906 #include <OpenIPMI/ipmi_posix.h>
4907 #include <OpenIPMI/ipmi_conn.h>
4910 CPPFLAGS="$SAVE_CPPFLAGS"
4913 if test "x$with_libopenipmipthread" = "xyes"
4915 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4916 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4917 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4918 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4922 # --with-libatasmart {{{
4923 with_libatasmart_cppflags=""
4924 with_libatasmart_ldflags=""
4925 AC_ARG_WITH(libatasmart, [AS_HELP_STRING([--with-libatasmart@<:@=PREFIX@:>@], [Path to libatasmart.])],
4927 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4929 with_libatasmart_cppflags="-I$withval/include"
4930 with_libatasmart_ldflags="-L$withval/lib"
4931 with_libatasmart="yes"
4933 with_libatasmart="$withval"
4937 if test "x$ac_system" = "xLinux"
4939 with_libatasmart="yes"
4941 with_libatasmart="no (Linux only library)"
4944 if test "x$with_libatasmart" = "xyes"
4946 SAVE_CPPFLAGS="$CPPFLAGS"
4947 CPPFLAGS="$CPPFLAGS $with_libatasmart_cppflags"
4949 AC_CHECK_HEADERS(atasmart.h, [with_libatasmart="yes"], [with_libatasmart="no (atasmart.h not found)"])
4951 CPPFLAGS="$SAVE_CPPFLAGS"
4953 if test "x$with_libatasmart" = "xyes"
4955 SAVE_CPPFLAGS="$CPPFLAGS"
4956 SAVE_LDFLAGS="$LDFLAGS"
4957 CPPFLAGS="$CPPFLAGS $with_libatasmart_cppflags"
4958 LDFLAGS="$LDFLAGS $with_libatasmart_ldflags"
4960 AC_CHECK_LIB(atasmart, sk_disk_open, [with_libatasmart="yes"], [with_libatasmart="no (Symbol 'sk_disk_open' not found)"])
4962 CPPFLAGS="$SAVE_CPPFLAGS"
4963 LDFLAGS="$SAVE_LDFLAGS"
4965 if test "x$with_libatasmart" = "xyes"
4967 BUILD_WITH_LIBATASMART_CPPFLAGS="$with_libatasmart_cppflags"
4968 BUILD_WITH_LIBATASMART_LDFLAGS="$with_libatasmart_ldflags"
4969 BUILD_WITH_LIBATASMART_LIBS="-latasmart"
4970 AC_SUBST(BUILD_WITH_LIBATASMART_CPPFLAGS)
4971 AC_SUBST(BUILD_WITH_LIBATASMART_LDFLAGS)
4972 AC_SUBST(BUILD_WITH_LIBATASMART_LIBS)
4973 AC_DEFINE(HAVE_LIBATASMART, 1, [Define if libatasmart is present and usable.])
4975 AM_CONDITIONAL(BUILD_WITH_LIBATASMART, test "x$with_libatasmart" = "xyes")
4978 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4979 [with_libnotify="yes"],
4980 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4983 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4986 # Check for enabled/disabled features
4989 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4990 # ------------------------------------------------------------
4992 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4997 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
5002 m4_define([EnDis],[disabled])dnl
5003 m4_define([YesNo],[no])dnl
5009 m4_define([EnDis],[enabled])dnl
5010 m4_define([YesNo],[yes])dnl
5013 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
5017 m4_if([$3], [feature], [],
5021 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
5027 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
5029 enable_$1='[YesNo]'dnl
5031 if test "x$enable_$1" = "xno"
5035 if test "x$enable_$1" = "xyes"
5039 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
5044 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
5045 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
5047 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
5049 # AC_PLUGIN(name, default, info)
5050 # ------------------------------------------------------------
5057 AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1],[$3]),
5059 if test "x$enableval" = "xyes"
5062 else if test "x$enableval" = "xforce"
5067 enable_plugin="no (disabled on command line)"
5071 if test "x$enable_all_plugins" = "xauto"
5073 if test "x$2" = "xyes"
5080 enable_plugin="$enable_all_plugins"
5083 if test "x$enable_plugin" = "xyes"
5085 if test "x$2" = "xyes" || test "x$force" = "xyes"
5087 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
5088 if test "x$2" != "xyes"
5090 dependency_warning="yes"
5092 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
5093 dependency_error="yes"
5094 enable_plugin="no (dependency error)"
5097 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
5098 enable_$1="$enable_plugin"
5100 )# AC_PLUGIN(name, default, info)
5102 m4_divert_once([HELP_ENABLE], [
5103 collectd features:])
5104 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
5105 AC_COLLECTD([debug], [enable], [feature], [debugging])
5106 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
5107 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
5109 dependency_warning="no"
5110 dependency_error="no"
5113 plugin_barometer="no"
5118 plugin_conntrack="no"
5119 plugin_contextswitch="no"
5122 plugin_curl_json="no"
5123 plugin_curl_xml="no"
5130 plugin_interface="no"
5135 plugin_log_logstash="no"
5137 plugin_multimeter="no"
5141 plugin_processes="no"
5142 plugin_protocols="no"
5146 plugin_tcpconns="no"
5154 plugin_wireless="no"
5156 plugin_zookeeper="no"
5159 if test "x$ac_system" = "xLinux"
5161 plugin_battery="yes"
5162 plugin_conntrack="yes"
5163 plugin_contextswitch="yes"
5164 plugin_cgroups="yes"
5166 plugin_cpufreq="yes"
5169 plugin_entropy="yes"
5170 plugin_fscache="yes"
5171 plugin_interface="yes"
5179 plugin_processes="yes"
5180 plugin_protocols="yes"
5183 plugin_tcpconns="yes"
5184 plugin_thermal="yes"
5187 plugin_vserver="yes"
5188 plugin_wireless="yes"
5189 plugin_zfs_arc="yes"
5191 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
5197 if test "x$ac_system" = "xOpenBSD"
5199 plugin_tcpconns="yes"
5203 if test "x$with_libiokit" = "xyes"
5205 plugin_battery="yes"
5211 if test "x$ac_system" = "xAIX"
5213 plugin_tcpconns="yes"
5219 if test "x$ac_system" = "xFreeBSD"
5221 plugin_zfs_arc="yes"
5225 if test "x$with_perfstat" = "xyes"
5228 plugin_contextswitch="yes"
5232 plugin_interface="yes"
5237 if test "x$with_procinfo" = "xyes"
5239 plugin_processes="yes"
5243 if test "x$with_kstat" = "xyes"
5247 plugin_zfs_arc="yes"
5250 if test "x$with_devinfo$with_kstat" = "xyesyes"
5254 plugin_interface="yes"
5261 if test "x$ac_system" = "xLinux"
5263 AC_CHECK_DECL(i2c_smbus_read_i2c_block_data,
5264 [with_libi2c="yes"],
5265 [with_libi2c="no (symbol i2c_smbus_read_i2c_block_data not found - have you installed libi2c-dev ?)"],
5266 [[#include <stdlib.h>
5267 #include <linux/i2c-dev.h>]])
5270 if test "x$with_libi2c" = "xyes"
5272 plugin_barometer="yes"
5277 if test "x$with_libstatgrab" = "xyes"
5281 plugin_interface="yes"
5288 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
5291 if test "x$have_strptime" = "xyes"
5297 if test "x$with_libopenipmipthread" = "xyes"
5302 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
5304 plugin_curl_json="yes"
5307 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
5309 plugin_curl_xml="yes"
5312 if test "x$with_libyajl" = "xyes"
5317 if test "x$have_processor_info" = "xyes"
5321 if test "x$have_sysctl" = "xyes"
5326 if test "x$ac_system" = "xDarwin"
5331 if test "x$have_sysctlbyname" = "xyes"
5333 plugin_contextswitch="yes"
5336 plugin_tcpconns="yes"
5339 # Df plugin: Check if we know how to determine mount points first.
5340 #if test "x$have_listmntent" = "xyes"; then
5343 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
5347 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
5351 #if test "x$have_getmntent" = "xseq"
5355 if test "x$c_cv_have_one_getmntent" = "xyes"
5360 # Df plugin: Check if we have either `statfs' or `statvfs' second.
5361 if test "x$plugin_df" = "xyes"
5364 if test "x$have_statfs" = "xyes"
5368 if test "x$have_statvfs" = "xyes"
5374 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
5376 plugin_ethstat="yes"
5379 if test "x$have_getifaddrs" = "xyes"
5381 plugin_interface="yes"
5384 if test "x$have_getloadavg" = "xyes"
5389 if test "x$with_libyajl" = "xyes"
5391 plugin_log_logstash="yes"
5394 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
5399 # Mac OS X memory interface
5400 if test "x$have_host_statistics" = "xyes"
5405 if test "x$have_termios_h" = "xyes"
5407 if test "x$ac_system" != "xAIX"
5409 plugin_multimeter="yes"
5414 if test "x$have_thread_info" = "xyes"
5416 plugin_processes="yes"
5419 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
5421 plugin_processes="yes"
5424 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_openbsd" = "xyes"
5426 plugin_processes="yes"
5429 if test "x$with_kvm_getswapinfo" = "xyes"
5434 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
5439 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
5441 plugin_tcpconns="yes"
5444 if test "x$have_getutent" = "xyes"
5448 if test "x$have_getutxent" = "xyes"
5453 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
5459 m4_divert_once([HELP_ENABLE], [
5462 AC_ARG_ENABLE([all-plugins],
5463 AS_HELP_STRING([--enable-all-plugins],[enable all plugins (auto by def)]),
5465 if test "x$enableval" = "xyes"
5467 enable_all_plugins="yes"
5468 else if test "x$enableval" = "xauto"
5470 enable_all_plugins="auto"
5472 enable_all_plugins="no"
5475 [enable_all_plugins="auto"])
5477 m4_divert_once([HELP_ENABLE], [])
5479 AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
5480 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
5481 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
5482 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
5483 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
5484 AC_PLUGIN([aquaero], [$with_libaquaero5], [Aquaero's hardware sensors])
5485 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
5486 AC_PLUGIN([barometer], [$plugin_barometer], [Barometer sensor on I2C])
5487 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
5488 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
5489 AC_PLUGIN([ceph], [$plugin_ceph], [Ceph daemon statistics])
5490 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
5491 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
5492 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
5493 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
5494 AC_PLUGIN([csv], [yes], [CSV output plugin])
5495 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
5496 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
5497 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
5498 AC_PLUGIN([cgroups], [$plugin_cgroups], [CGroups CPU usage accounting])
5499 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
5500 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
5501 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
5502 AC_PLUGIN([drbd], [$plugin_drbd], [DRBD statistics])
5503 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
5504 AC_PLUGIN([email], [yes], [EMail statistics])
5505 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
5506 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
5507 AC_PLUGIN([exec], [yes], [Execution of external programs])
5508 AC_PLUGIN([filecount], [yes], [Count files in directories])
5509 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
5510 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
5511 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
5512 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
5513 AC_PLUGIN([ipc], [$plugin_ipc], [IPC statistics])
5514 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
5515 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
5516 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
5517 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
5518 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
5519 AC_PLUGIN([load], [$plugin_load], [System load])
5520 AC_PLUGIN([logfile], [yes], [File logging plugin])
5521 AC_PLUGIN([log_logstash], [$plugin_log_logstash], [Logstash json_event compatible logging])
5522 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
5523 AC_PLUGIN([lvm], [$with_liblvm2app], [LVM statistics])
5524 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
5525 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
5526 AC_PLUGIN([match_hashed], [yes], [The hashed match])
5527 AC_PLUGIN([match_regex], [yes], [The regex match])
5528 AC_PLUGIN([match_timediff], [yes], [The timediff match])
5529 AC_PLUGIN([match_value], [yes], [The value match])
5530 AC_PLUGIN([mbmon], [yes], [Query mbmond])
5531 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
5532 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
5533 AC_PLUGIN([memcached], [yes], [memcached statistics])
5534 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
5535 AC_PLUGIN([mic], [$with_mic], [Intel Many Integrated Core stats])
5536 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
5537 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
5538 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
5539 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
5540 AC_PLUGIN([netlink], [$with_libmnl], [Enhanced Linux network statistics])
5541 AC_PLUGIN([network], [yes], [Network communication plugin])
5542 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
5543 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
5544 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
5545 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
5546 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
5547 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
5548 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
5549 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
5550 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
5551 AC_PLUGIN([openldap], [$with_libldap], [OpenLDAP statistics])
5552 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
5553 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
5554 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
5555 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
5556 # FIXME: Check for libevent, too.
5557 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
5558 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
5559 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
5560 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
5561 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
5562 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
5563 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
5564 AC_PLUGIN([redis], [$with_libhiredis], [Redis plugin])
5565 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
5566 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
5567 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
5568 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
5569 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
5570 AC_PLUGIN([sigrok], [$with_libsigrok], [sigrok acquisition sources])
5571 AC_PLUGIN([smart], [$with_libatasmart], [SMART statistics])
5572 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
5573 AC_PLUGIN([statsd], [yes], [StatsD plugin])
5574 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
5575 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
5576 AC_PLUGIN([table], [yes], [Parsing of tabular data])
5577 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
5578 AC_PLUGIN([tail_csv], [yes], [Parsing of CSV files])
5579 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
5580 AC_PLUGIN([target_notification], [yes], [The notification target])
5581 AC_PLUGIN([target_replace], [yes], [The replace target])
5582 AC_PLUGIN([target_scale],[yes], [The scale target])
5583 AC_PLUGIN([target_set], [yes], [The set target])
5584 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
5585 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
5586 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
5587 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
5588 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
5589 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
5590 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
5591 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
5592 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
5593 AC_PLUGIN([users], [$plugin_users], [User statistics])
5594 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
5595 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
5596 AC_PLUGIN([virt], [$plugin_virt], [Virtual machine statistics])
5597 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
5598 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
5599 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
5600 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
5601 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
5602 AC_PLUGIN([write_kafka], [$with_librdkafka], [Kafka output plugin])
5603 AC_PLUGIN([write_log], [yes], [Log output plugin])
5604 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
5605 AC_PLUGIN([write_redis], [$with_libhiredis], [Redis output plugin])
5606 AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin])
5607 AC_PLUGIN([write_sensu], [yes], [Sensu output plugin])
5608 AC_PLUGIN([write_tsdb], [yes], [TSDB output plugin])
5609 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
5610 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
5611 AC_PLUGIN([zookeeper], [yes], [Zookeeper statistics])
5613 dnl Default configuration file
5614 # Load either syslog or logfile
5615 LOAD_PLUGIN_SYSLOG=""
5616 LOAD_PLUGIN_LOGFILE=""
5617 LOAD_PLUGIN_LOG_LOGSTASH=""
5619 AC_MSG_CHECKING([which default log plugin to load])
5620 default_log_plugin="none"
5621 if test "x$enable_syslog" = "xyes"
5623 default_log_plugin="syslog"
5625 LOAD_PLUGIN_SYSLOG="##"
5628 if test "x$enable_logfile" = "xyes"
5630 if test "x$default_log_plugin" = "xnone"
5632 default_log_plugin="logfile"
5634 LOAD_PLUGIN_LOGFILE="#"
5637 LOAD_PLUGIN_LOGFILE="##"
5640 if test "x$enable_log_logstash" = "xyes"
5642 LOAD_PLUGIN_LOG_LOGSTASH="#"
5644 LOAD_PLUGIN_LOG_LOGSTASH="##"
5648 AC_MSG_RESULT([$default_log_plugin])
5650 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5651 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5652 AC_SUBST(LOAD_PLUGIN_LOG_LOGSTASH)
5654 DEFAULT_LOG_LEVEL="info"
5655 if test "x$enable_debug" = "xyes"
5657 DEFAULT_LOG_LEVEL="debug"
5659 AC_SUBST(DEFAULT_LOG_LEVEL)
5661 # Load only one of rrdtool, network, csv in the default config.
5662 LOAD_PLUGIN_RRDTOOL=""
5663 LOAD_PLUGIN_NETWORK=""
5666 AC_MSG_CHECKING([which default write plugin to load])
5667 default_write_plugin="none"
5668 if test "x$enable_rrdtool" = "xyes"
5670 default_write_plugin="rrdtool"
5672 LOAD_PLUGIN_RRDTOOL="##"
5675 if test "x$enable_network" = "xyes"
5677 if test "x$default_write_plugin" = "xnone"
5679 default_write_plugin="network"
5681 LOAD_PLUGIN_NETWORK="#"
5684 LOAD_PLUGIN_NETWORK="##"
5687 if test "x$enable_csv" = "xyes"
5689 if test "x$default_write_plugin" = "xnone"
5691 default_write_plugin="csv"
5696 LOAD_PLUGIN_CSV="##"
5698 AC_MSG_RESULT([$default_write_plugin])
5700 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5701 AC_SUBST(LOAD_PLUGIN_NETWORK)
5702 AC_SUBST(LOAD_PLUGIN_CSV)
5705 if test "x$ac_system" = "xLinux" \
5706 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5708 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5711 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5713 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5717 PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
5718 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5720 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5722 PERL_BINDINGS_OPTIONS="$withval"
5723 with_perl_bindings="yes"
5725 with_perl_bindings="$withval"
5729 if test -n "$perl_interpreter"
5731 with_perl_bindings="yes"
5733 with_perl_bindings="no (no perl interpreter found)"
5736 if test "x$with_perl_bindings" = "xyes"
5738 PERL_BINDINGS="perl"
5742 AC_SUBST(PERL_BINDINGS)
5743 AC_SUBST(PERL_BINDINGS_OPTIONS)
5745 dnl libcollectdclient
5746 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5747 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5748 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5750 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5752 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5754 AC_SUBST(LCC_VERSION_MAJOR)
5755 AC_SUBST(LCC_VERSION_MINOR)
5756 AC_SUBST(LCC_VERSION_PATCH)
5757 AC_SUBST(LCC_VERSION_EXTRA)
5758 AC_SUBST(LCC_VERSION_STRING)
5760 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5762 AC_CONFIG_FILES([Makefile src/Makefile src/daemon/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile])
5765 if test "x$with_librrd" = "xyes" \
5766 && test "x$librrd_threadsafe" != "xyes"
5768 with_librrd="yes (warning: librrd is not thread-safe)"
5771 if test "x$with_libperl" = "xyes"
5773 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5775 enable_perl="no (needs libperl)"
5778 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5780 enable_perl="no (libperl doesn't support ithreads)"
5783 if test "x$with_perl_bindings" = "xyes" \
5784 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5786 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5793 intel mic . . . . . . $with_mic
5794 libaquaero5 . . . . . $with_libaquaero5
5795 libatasmart . . . . . $with_libatasmart
5796 libcurl . . . . . . . $with_libcurl
5797 libdbi . . . . . . . $with_libdbi
5798 libesmtp . . . . . . $with_libesmtp
5799 libganglia . . . . . $with_libganglia
5800 libgcrypt . . . . . . $with_libgcrypt
5801 libhal . . . . . . . $with_libhal
5802 libhiredis . . . . . $with_libhiredis
5803 libi2c-dev . . . . . $with_libi2c
5804 libiokit . . . . . . $with_libiokit
5805 libiptc . . . . . . . $with_libiptc
5806 libjvm . . . . . . . $with_java
5807 libkstat . . . . . . $with_kstat
5808 libkvm . . . . . . . $with_libkvm
5809 libldap . . . . . . . $with_libldap
5810 liblvm2app . . . . . $with_liblvm2app
5811 libmemcached . . . . $with_libmemcached
5812 libmnl . . . . . . . $with_libmnl
5813 libmodbus . . . . . . $with_libmodbus
5814 libmongoc . . . . . . $with_libmongoc
5815 libmysql . . . . . . $with_libmysql
5816 libnetapp . . . . . . $with_libnetapp
5817 libnetsnmp . . . . . $with_libnetsnmp
5818 libnotify . . . . . . $with_libnotify
5819 liboconfig . . . . . $with_liboconfig
5820 libopenipmi . . . . . $with_libopenipmipthread
5821 liboping . . . . . . $with_liboping
5822 libowcapi . . . . . . $with_libowcapi
5823 libpcap . . . . . . . $with_libpcap
5824 libperfstat . . . . . $with_perfstat
5825 libperl . . . . . . . $with_libperl
5826 libpq . . . . . . . . $with_libpq
5827 libpthread . . . . . $with_libpthread
5828 librabbitmq . . . . . $with_librabbitmq
5829 librdkafka . . . . . $with_librdkafka
5830 librouteros . . . . . $with_librouteros
5831 librrd . . . . . . . $with_librrd
5832 libsensors . . . . . $with_libsensors
5833 libsigrok . . . . . $with_libsigrok
5834 libstatgrab . . . . . $with_libstatgrab
5835 libtokyotyrant . . . $with_libtokyotyrant
5836 libudev . . . . . . . $with_libudev
5837 libupsclient . . . . $with_libupsclient
5838 libvarnish . . . . . $with_libvarnish
5839 libvirt . . . . . . . $with_libvirt
5840 libxml2 . . . . . . . $with_libxml2
5841 libxmms . . . . . . . $with_libxmms
5842 libyajl . . . . . . . $with_libyajl
5843 oracle . . . . . . . $with_oracle
5844 protobuf-c . . . . . $have_protoc_c
5845 python . . . . . . . $with_python
5848 daemon mode . . . . . $enable_daemon
5849 debug . . . . . . . . $enable_debug
5852 perl . . . . . . . . $with_perl_bindings
5855 aggregation . . . . . $enable_aggregation
5856 amqp . . . . . . . $enable_amqp
5857 apache . . . . . . . $enable_apache
5858 apcups . . . . . . . $enable_apcups
5859 apple_sensors . . . . $enable_apple_sensors
5860 aquaero . . . . . . . $enable_aquaero
5861 ascent . . . . . . . $enable_ascent
5862 barometer . . . . . . $enable_barometer
5863 battery . . . . . . . $enable_battery
5864 bind . . . . . . . . $enable_bind
5865 ceph . . . . . . . . $enable_ceph
5866 cgroups . . . . . . . $enable_cgroups
5867 conntrack . . . . . . $enable_conntrack
5868 contextswitch . . . . $enable_contextswitch
5869 cpu . . . . . . . . . $enable_cpu
5870 cpufreq . . . . . . . $enable_cpufreq
5871 csv . . . . . . . . . $enable_csv
5872 curl . . . . . . . . $enable_curl
5873 curl_json . . . . . . $enable_curl_json
5874 curl_xml . . . . . . $enable_curl_xml
5875 dbi . . . . . . . . . $enable_dbi
5876 df . . . . . . . . . $enable_df
5877 disk . . . . . . . . $enable_disk
5878 dns . . . . . . . . . $enable_dns
5879 drbd . . . . . . . . $enable_drbd
5880 email . . . . . . . . $enable_email
5881 entropy . . . . . . . $enable_entropy
5882 ethstat . . . . . . . $enable_ethstat
5883 exec . . . . . . . . $enable_exec
5884 filecount . . . . . . $enable_filecount
5885 fscache . . . . . . . $enable_fscache
5886 gmond . . . . . . . . $enable_gmond
5887 hddtemp . . . . . . . $enable_hddtemp
5888 interface . . . . . . $enable_interface
5889 ipc . . . . . . . . . $enable_ipc
5890 ipmi . . . . . . . . $enable_ipmi
5891 iptables . . . . . . $enable_iptables
5892 ipvs . . . . . . . . $enable_ipvs
5893 irq . . . . . . . . . $enable_irq
5894 java . . . . . . . . $enable_java
5895 load . . . . . . . . $enable_load
5896 logfile . . . . . . . $enable_logfile
5897 log_logstash . . . . $enable_log_logstash
5898 lpar . . . . . . . . $enable_lpar
5899 lvm . . . . . . . . . $enable_lvm
5900 madwifi . . . . . . . $enable_madwifi
5901 match_empty_counter . $enable_match_empty_counter
5902 match_hashed . . . . $enable_match_hashed
5903 match_regex . . . . . $enable_match_regex
5904 match_timediff . . . $enable_match_timediff
5905 match_value . . . . . $enable_match_value
5906 mbmon . . . . . . . . $enable_mbmon
5907 md . . . . . . . . . $enable_md
5908 memcachec . . . . . . $enable_memcachec
5909 memcached . . . . . . $enable_memcached
5910 memory . . . . . . . $enable_memory
5911 mic . . . . . . . . . $enable_mic
5912 modbus . . . . . . . $enable_modbus
5913 multimeter . . . . . $enable_multimeter
5914 mysql . . . . . . . . $enable_mysql
5915 netapp . . . . . . . $enable_netapp
5916 netlink . . . . . . . $enable_netlink
5917 network . . . . . . . $enable_network
5918 nfs . . . . . . . . . $enable_nfs
5919 nginx . . . . . . . . $enable_nginx
5920 notify_desktop . . . $enable_notify_desktop
5921 notify_email . . . . $enable_notify_email
5922 ntpd . . . . . . . . $enable_ntpd
5923 numa . . . . . . . . $enable_numa
5924 nut . . . . . . . . . $enable_nut
5925 olsrd . . . . . . . . $enable_olsrd
5926 onewire . . . . . . . $enable_onewire
5927 openldap . . . . . . $enable_openldap
5928 openvpn . . . . . . . $enable_openvpn
5929 oracle . . . . . . . $enable_oracle
5930 perl . . . . . . . . $enable_perl
5931 pf . . . . . . . . . $enable_pf
5932 pinba . . . . . . . . $enable_pinba
5933 ping . . . . . . . . $enable_ping
5934 postgresql . . . . . $enable_postgresql
5935 powerdns . . . . . . $enable_powerdns
5936 processes . . . . . . $enable_processes
5937 protocols . . . . . . $enable_protocols
5938 python . . . . . . . $enable_python
5939 redis . . . . . . . . $enable_redis
5940 routeros . . . . . . $enable_routeros
5941 rrdcached . . . . . . $enable_rrdcached
5942 rrdtool . . . . . . . $enable_rrdtool
5943 sensors . . . . . . . $enable_sensors
5944 serial . . . . . . . $enable_serial
5945 sigrok . . . . . . . $enable_sigrok
5946 smart . . . . . . . . $enable_smart
5947 snmp . . . . . . . . $enable_snmp
5948 statsd . . . . . . . $enable_statsd
5949 swap . . . . . . . . $enable_swap
5950 syslog . . . . . . . $enable_syslog
5951 table . . . . . . . . $enable_table
5952 tail_csv . . . . . . $enable_tail_csv
5953 tail . . . . . . . . $enable_tail
5954 tape . . . . . . . . $enable_tape
5955 target_notification . $enable_target_notification
5956 target_replace . . . $enable_target_replace
5957 target_scale . . . . $enable_target_scale
5958 target_set . . . . . $enable_target_set
5959 target_v5upgrade . . $enable_target_v5upgrade
5960 tcpconns . . . . . . $enable_tcpconns
5961 teamspeak2 . . . . . $enable_teamspeak2
5962 ted . . . . . . . . . $enable_ted
5963 thermal . . . . . . . $enable_thermal
5964 threshold . . . . . . $enable_threshold
5965 tokyotyrant . . . . . $enable_tokyotyrant
5966 unixsock . . . . . . $enable_unixsock
5967 uptime . . . . . . . $enable_uptime
5968 users . . . . . . . . $enable_users
5969 uuid . . . . . . . . $enable_uuid
5970 varnish . . . . . . . $enable_varnish
5971 virt . . . . . . . . $enable_virt
5972 vmem . . . . . . . . $enable_vmem
5973 vserver . . . . . . . $enable_vserver
5974 wireless . . . . . . $enable_wireless
5975 write_graphite . . . $enable_write_graphite
5976 write_http . . . . . $enable_write_http
5977 write_kafka . . . . . $enable_write_kafka
5978 write_log . . . . . . $enable_write_log
5979 write_mongodb . . . . $enable_write_mongodb
5980 write_redis . . . . . $enable_write_redis
5981 write_riemann . . . . $enable_write_riemann
5982 write_sensu . . . . . $enable_write_sensu
5983 write_tsdb . . . . . $enable_write_tsdb
5984 xmms . . . . . . . . $enable_xmms
5985 zfs_arc . . . . . . . $enable_zfs_arc
5986 zookeeper . . . . . . $enable_zookeeper
5990 if test "x$dependency_error" = "xyes"; then
5991 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5994 if test "x$dependency_warning" = "xyes"; then
5995 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5998 # vim: set fdm=marker :