1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, [m4_esyscmd(./version-gen.sh)])
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AC_CONFIG_AUX_DIR([libltdl/config])
7 m4_ifdef([LT_PACKAGE_VERSION],
10 LT_CONFIG_LTDL_DIR([libltdl])
12 LTDL_INIT([convenience])
13 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
18 AC_LIBLTDL_CONVENIENCE
22 AC_CONFIG_SUBDIRS(libltdl)
23 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
27 AM_INIT_AUTOMAKE(dist-bzip2)
30 AC_PREFIX_DEFAULT("/opt/collectd")
35 # Checks for programs.
43 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
51 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
52 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
54 AC_MSG_CHECKING([for kernel type ($host_os)])
57 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
61 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
71 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
77 AC_MSG_RESULT([$ac_system])
79 if test "x$ac_system" = "xLinux"
81 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
82 if test -z "$KERNEL_DIR"
84 KERNEL_DIR="/lib/modules/`uname -r`/source"
87 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
88 AC_SUBST(KERNEL_CFLAGS)
91 if test "x$ac_system" = "xSolaris"
93 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
94 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
96 if test "x$ac_system" = "xAIX"
98 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
101 # Where to install .pc files.
102 pkgconfigdir="${libdir}/pkgconfig"
103 AC_SUBST(pkgconfigdir)
105 # Check for standards compliance mode
106 AC_ARG_ENABLE(standards,
107 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
108 [enable_standards="$enableval"],
109 [enable_standards="no"])
110 if test "x$enable_standards" = "xyes"
112 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
113 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
114 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
115 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
116 if test "x$GCC" = "xyes"
118 CFLAGS="$CFLAGS -std=c99"
121 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
124 # Checks for header files.
131 AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
134 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
139 # include <sys/types.h>
142 AC_CHECK_HEADERS(netinet/in.h, [], [],
147 # include <sys/types.h>
149 #if HAVE_NETINET_IN_SYSTM_H
150 # include <netinet/in_systm.h>
153 AC_CHECK_HEADERS(netinet/ip.h, [], [],
158 # include <sys/types.h>
160 #if HAVE_NETINET_IN_SYSTM_H
161 # include <netinet/in_systm.h>
163 #if HAVE_NETINET_IN_H
164 # include <netinet/in.h>
167 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
172 # include <sys/types.h>
174 #if HAVE_NETINET_IN_SYSTM_H
175 # include <netinet/in_systm.h>
177 #if HAVE_NETINET_IN_H
178 # include <netinet/in.h>
180 #if HAVE_NETINET_IP_H
181 # include <netinet/ip.h>
184 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
189 # include <sys/types.h>
191 #if HAVE_NETINET_IN_SYSTM_H
192 # include <netinet/in_systm.h>
194 #if HAVE_NETINET_IN_H
195 # include <netinet/in.h>
197 #if HAVE_NETINET_IP_H
198 # include <netinet/ip.h>
201 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
206 # include <sys/types.h>
208 #if HAVE_NETINET_IN_SYSTM_H
209 # include <netinet/in_systm.h>
211 #if HAVE_NETINET_IN_H
212 # include <netinet/in.h>
215 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
220 # include <sys/types.h>
222 #if HAVE_NETINET_IN_SYSTM_H
223 # include <netinet/in_systm.h>
225 #if HAVE_NETINET_IN_H
226 # include <netinet/in.h>
228 #if HAVE_NETINET_IP6_H
229 # include <netinet/ip6.h>
232 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
237 # include <sys/types.h>
239 #if HAVE_NETINET_IN_SYSTM_H
240 # include <netinet/in_systm.h>
242 #if HAVE_NETINET_IN_H
243 # include <netinet/in.h>
245 #if HAVE_NETINET_IP_H
246 # include <netinet/ip.h>
249 AC_CHECK_HEADERS(netinet/udp.h, [], [],
254 # include <sys/types.h>
256 #if HAVE_NETINET_IN_SYSTM_H
257 # include <netinet/in_systm.h>
259 #if HAVE_NETINET_IN_H
260 # include <netinet/in.h>
262 #if HAVE_NETINET_IP_H
263 # include <netinet/ip.h>
268 AC_CHECK_HEADERS(sys/dkstat.h)
269 if test "x$ac_system" = "xDarwin"
271 AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h)
272 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
274 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
277 # include <sys/types.h>
280 # include <sys/param.h>
284 AC_MSG_CHECKING([for sysctl kern.cp_times])
285 if test -x /sbin/sysctl
287 /sbin/sysctl kern.cp_times 2>/dev/null
291 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
292 [Define if sysctl supports kern.cp_times])
301 AC_CHECK_HEADERS(linux/major.h libgen.h)
303 # For md module (Linux only)
304 if test "x$ac_system" = "xLinux"
306 AC_CHECK_HEADERS(linux/raid/md_u.h,
307 [have_linux_raid_md_u_h="yes"],
308 [have_linux_raid_md_u_h="no"],
310 #include <sys/ioctl.h>
311 #include <linux/major.h>
312 #include <linux/types.h>
315 have_linux_raid_md_u_h="no"
318 # For the battery plugin
319 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
321 #if HAVE_IOKIT_IOKITLIB_H
322 # include <IOKit/IOKitLib.h>
324 #if HAVE_IOKIT_IOTYPES_H
325 # include <IOKit/IOTypes.h>
329 # For the swap module
330 have_linux_wireless_h="no"
331 if test "x$ac_system" = "xLinux"
333 AC_CHECK_HEADERS(linux/wireless.h,
334 [have_linux_wireless_h="yes"],
335 [have_linux_wireless_h="no"],
338 #include <sys/ioctl.h>
339 #include <sys/socket.h>
343 # For the swap module
344 have_sys_swap_h="yes"
345 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
347 #undef _FILE_OFFSET_BITS
348 #undef _LARGEFILE64_SOURCE
350 # include <sys/types.h>
353 # include <sys/param.h>
357 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
360 if test "x$GCC" = "xyes"
362 hint_64="CFLAGS='-m64'"
364 hint_64="CFLAGS='-xarch=v9'"
366 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
370 # For the processes plugin
372 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
374 # For interface plugin
375 AC_CHECK_HEADERS(ifaddrs.h)
376 AC_CHECK_HEADERS(net/if.h, [], [],
379 # include <sys/types.h>
381 #if HAVE_SYS_SOCKET_H
382 # include <sys/socket.h>
385 AC_CHECK_HEADERS(linux/if.h, [], [],
388 # include <sys/types.h>
390 #if HAVE_SYS_SOCKET_H
391 # include <sys/socket.h>
394 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
397 # include <sys/types.h>
399 #if HAVE_SYS_SOCKET_H
400 # include <sys/socket.h>
403 # include <linux/if.h>
408 AC_CHECK_HEADERS(linux/sockios.h,
409 [have_linux_sockios_h="yes"],
410 [have_linux_sockios_h="no"],
413 # include <sys/ioctl.h>
419 AC_CHECK_HEADERS(linux/ethtool.h,
420 [have_linux_ethtool_h="yes"],
421 [have_linux_ethtool_h="no"],
424 # include <sys/ioctl.h>
429 #if HAVE_LINUX_SOCKIOS_H
430 # include <linux/sockios.h>
435 have_linux_ip_vs_h="no"
436 have_net_ip_vs_h="no"
438 ip_vs_h_needs_kernel_cflags="no"
439 if test "x$ac_system" = "xLinux"
441 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
442 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
443 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
445 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
447 SAVE_CFLAGS="$CFLAGS"
448 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
450 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
452 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
453 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
454 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
456 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
458 ip_vs_h_needs_kernel_cflags="yes"
461 CFLAGS="$SAVE_CFLAGS"
464 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
467 AC_CHECK_HEADERS(sys/ucred.h, [], [],
470 # include <sys/types.h>
473 # include <sys/param.h>
477 # For mount interface
478 AC_CHECK_HEADERS(sys/mount.h, [], [],
481 # include <sys/types.h>
484 # include <sys/param.h>
488 # For the email plugin
489 AC_CHECK_HEADERS(linux/un.h, [], [],
491 #if HAVE_SYS_SOCKET_H
492 # include <sys/socket.h>
496 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h wordexp.h)
499 AC_CHECK_HEADERS(arpa/nameser.h)
500 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
502 #if HAVE_ARPA_NAMESER_H
503 # include <arpa/nameser.h>
507 AC_CHECK_HEADERS(net/if_arp.h, [], [],
508 [#if HAVE_SYS_SOCKET_H
509 # include <sys/socket.h>
512 AC_CHECK_HEADERS(net/ppp_defs.h)
513 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
514 [#if HAVE_NET_PPP_DEFS_H
515 # include <net/ppp_defs.h>
518 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
523 # include <sys/types.h>
525 #if HAVE_SYS_SOCKET_H
526 # include <sys/socket.h>
531 #if HAVE_NETINET_IN_H
532 # include <netinet/in.h>
536 AC_CHECK_HEADERS(netinet/ip_compat.h)
538 have_net_pfvar_h="no"
539 AC_CHECK_HEADERS(net/pfvar.h, [have_net_pfvar_h="yes"])
541 # For the multimeter plugin
543 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
546 # Checks for typedefs, structures, and compiler characteristics.
555 # Checks for library functions.
557 AC_PROG_GCC_TRADITIONAL
558 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
562 SAVE_CFLAGS="$CFLAGS"
563 # Emulate behavior of src/Makefile.am
564 if test "x$GCC" = "xyes"
566 CFLAGS="$CFLAGS -Wall -Werror"
569 AC_CACHE_CHECK([for strtok_r],
570 [c_cv_have_strtok_r_default],
579 char buffer[] = "foo,bar,baz";
586 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
589 printf ("token = %s;\n", token);
592 [c_cv_have_strtok_r_default="yes"],
593 [c_cv_have_strtok_r_default="no"]
597 if test "x$c_cv_have_strtok_r_default" = "xno"
599 CFLAGS="$CFLAGS -D_REENTRANT=1"
601 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
602 [c_cv_have_strtok_r_reentrant],
611 char buffer[] = "foo,bar,baz";
618 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
621 printf ("token = %s;\n", token);
624 [c_cv_have_strtok_r_reentrant="yes"],
625 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
630 CFLAGS="$SAVE_CFLAGS"
631 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
633 CFLAGS="$CFLAGS -D_REENTRANT=1"
636 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
638 socket_needs_socket="no"
639 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
640 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
642 clock_gettime_needs_rt="no"
643 clock_gettime_needs_posix4="no"
644 have_clock_gettime="no"
645 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
646 if test "x$have_clock_gettime" = "xno"
648 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
649 have_clock_gettime="yes"])
651 if test "x$have_clock_gettime" = "xno"
653 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
654 have_clock_gettime="yes"])
656 if test "x$have_clock_gettime" = "xyes"
658 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
660 AC_MSG_WARN(cannot find clock_gettime)
663 nanosleep_needs_rt="no"
664 nanosleep_needs_posix4="no"
665 AC_CHECK_FUNCS(nanosleep,
667 AC_CHECK_LIB(rt, nanosleep,
668 [nanosleep_needs_rt="yes"],
669 AC_CHECK_LIB(posix4, nanosleep,
670 [nanosleep_needs_posix4="yes"],
671 AC_MSG_ERROR(cannot find nanosleep))))
673 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
674 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
676 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
677 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
678 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
679 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
680 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
681 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
682 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
683 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
684 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
685 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
686 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
687 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
689 # Check for strptime {{{
690 if test "x$GCC" = "xyes"
692 SAVE_CFLAGS="$CFLAGS"
693 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
696 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
697 if test "x$have_strptime" = "xyes"
699 AC_CACHE_CHECK([whether strptime is exported by default],
700 [c_cv_have_strptime_default],
709 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
711 [c_cv_have_strptime_default="yes"],
712 [c_cv_have_strptime_default="no"]))
714 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
716 AC_CACHE_CHECK([whether strptime needs standards mode],
717 [c_cv_have_strptime_standards],
721 #ifndef _ISOC99_SOURCE
722 # define _ISOC99_SOURCE 1
724 #ifndef _POSIX_C_SOURCE
725 # define _POSIX_C_SOURCE 200112L
727 #ifndef _XOPEN_SOURCE
728 # define _XOPEN_SOURCE 500
735 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
737 [c_cv_have_strptime_standards="yes"],
738 [c_cv_have_strptime_standards="no"]))
740 if test "x$c_cv_have_strptime_standards" = "xyes"
742 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
748 if test "x$GCC" = "xyes"
750 CFLAGS="$SAVE_CFLAGS"
753 # }}} Check for strptime
755 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
756 if test "x$have_swapctl" = "xyes"; then
757 AC_CACHE_CHECK([whether swapctl takes two arguments],
758 [c_cv_have_swapctl_two_args],
760 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
761 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
762 # undef _FILE_OFFSET_BITS
763 # undef _LARGEFILE64_SOURCE
765 #include <sys/stat.h>
766 #include <sys/swap.h>]],
768 int num = swapctl(0, NULL);
771 [c_cv_have_swapctl_two_args="yes"],
772 [c_cv_have_swapctl_two_args="no"]
775 AC_CACHE_CHECK([whether swapctl takes three arguments],
776 [c_cv_have_swapctl_three_args],
778 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
779 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
780 # undef _FILE_OFFSET_BITS
781 # undef _LARGEFILE64_SOURCE
783 #include <sys/stat.h>
784 #include <sys/swap.h>]],
786 int num = swapctl(0, NULL,0);
789 [c_cv_have_swapctl_three_args="yes"],
790 [c_cv_have_swapctl_three_args="no"]
794 # Check for different versions of `swapctl' here..
795 if test "x$have_swapctl" = "xyes"; then
796 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
797 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
798 [Define if the function swapctl exists and takes two arguments.])
800 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
801 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
802 [Define if the function swapctl exists and takes three arguments.])
807 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
809 if test "x$withval" = "xno"; then
811 else if test "x$withval" = "xyes"; then
818 if test "x$nan_type" = "xnone"; then
819 AC_CACHE_CHECK([whether NAN is defined by default],
820 [c_cv_have_nan_default],
826 static double foo = NAN;
834 [c_cv_have_nan_default="yes"],
835 [c_cv_have_nan_default="no"]
838 if test "x$c_cv_have_nan_default" = "xyes"
843 if test "x$nan_type" = "xnone"; then
844 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
845 [c_cv_have_nan_isoc],
850 #define __USE_ISOC99 1
852 static double foo = NAN;
860 [c_cv_have_nan_isoc="yes"],
861 [c_cv_have_nan_isoc="no"]
864 if test "x$c_cv_have_nan_isoc" = "xyes"
869 if test "x$nan_type" = "xnone"; then
870 SAVE_LDFLAGS=$LDFLAGS
871 LDFLAGS="$LDFLAGS -lm"
872 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
873 [c_cv_have_nan_zero],
882 #define NAN (0.0 / 0.0)
884 # define isnan(f) ((f) != (f))
886 static double foo = NAN;
894 [c_cv_have_nan_zero="yes"],
895 [c_cv_have_nan_zero="no"]
898 LDFLAGS=$SAVE_LDFLAGS
899 if test "x$c_cv_have_nan_zero" = "xyes"
905 if test "x$nan_type" = "xdefault"; then
906 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
907 [Define if NAN is defined by default and can initialize static variables.])
908 else if test "x$nan_type" = "xisoc99"; then
909 AC_DEFINE(NAN_STATIC_ISOC, 1,
910 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
911 else if test "x$nan_type" = "xzero"; then
912 AC_DEFINE(NAN_ZERO_ZERO, 1,
913 [Define if NAN can be defined as (0.0 / 0.0)])
915 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
918 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
920 if test "x$withval" = "xnothing"; then
921 fp_layout_type="nothing"
922 else if test "x$withval" = "xendianflip"; then
923 fp_layout_type="endianflip"
924 else if test "x$withval" = "xintswap"; then
925 fp_layout_type="intswap"
927 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
930 [fp_layout_type="unknown"])
932 if test "x$fp_layout_type" = "xunknown"; then
933 AC_CACHE_CHECK([if doubles are stored in x86 representation],
934 [c_cv_fp_layout_need_nothing],
945 # include <inttypes.h>
948 # include <stdbool.h>
958 memcpy ((void *) &i0, (void *) &d, 8);
961 memcpy ((void *) c, (void *) &i1, 8);
963 if ((c[0] == 0x2f) && (c[1] == 0x25)
964 && (c[2] == 0xc0) && (c[3] == 0xc7)
965 && (c[4] == 0x43) && (c[5] == 0x2b)
966 && (c[6] == 0x1f) && (c[7] == 0x5b))
971 [c_cv_fp_layout_need_nothing="yes"],
972 [c_cv_fp_layout_need_nothing="no"]
975 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
976 fp_layout_type="nothing"
979 if test "x$fp_layout_type" = "xunknown"; then
980 AC_CACHE_CHECK([if endianflip converts to x86 representation],
981 [c_cv_fp_layout_need_endianflip],
992 # include <inttypes.h>
995 # include <stdbool.h>
997 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
998 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
999 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1000 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
1001 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
1002 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1003 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1004 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1013 memcpy ((void *) &i0, (void *) &d, 8);
1015 i1 = endianflip (i0);
1016 memcpy ((void *) c, (void *) &i1, 8);
1018 if ((c[0] == 0x2f) && (c[1] == 0x25)
1019 && (c[2] == 0xc0) && (c[3] == 0xc7)
1020 && (c[4] == 0x43) && (c[5] == 0x2b)
1021 && (c[6] == 0x1f) && (c[7] == 0x5b))
1026 [c_cv_fp_layout_need_endianflip="yes"],
1027 [c_cv_fp_layout_need_endianflip="no"]
1030 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1031 fp_layout_type="endianflip"
1034 if test "x$fp_layout_type" = "xunknown"; then
1035 AC_CACHE_CHECK([if intswap converts to x86 representation],
1036 [c_cv_fp_layout_need_intswap],
1044 # include <stdint.h>
1047 # include <inttypes.h>
1050 # include <stdbool.h>
1052 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1053 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1062 memcpy ((void *) &i0, (void *) &d, 8);
1065 memcpy ((void *) c, (void *) &i1, 8);
1067 if ((c[0] == 0x2f) && (c[1] == 0x25)
1068 && (c[2] == 0xc0) && (c[3] == 0xc7)
1069 && (c[4] == 0x43) && (c[5] == 0x2b)
1070 && (c[6] == 0x1f) && (c[7] == 0x5b))
1075 [c_cv_fp_layout_need_intswap="yes"],
1076 [c_cv_fp_layout_need_intswap="no"]
1079 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1080 fp_layout_type="intswap"
1084 if test "x$fp_layout_type" = "xnothing"; then
1085 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1086 [Define if doubles are stored in x86 representation.])
1087 else if test "x$fp_layout_type" = "xendianflip"; then
1088 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1089 [Define if endianflip is needed to convert to x86 representation.])
1090 else if test "x$fp_layout_type" = "xintswap"; then
1091 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1092 [Define if intswap is needed to convert to x86 representation.])
1094 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1098 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1099 have_getvfsstat="no"
1100 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1101 have_listmntent="no"
1102 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1105 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1106 if test "x$have_getmntent" = "xno"; then
1107 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1109 if test "x$have_getmntent" = "xno"; then
1110 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1112 if test "x$have_getmntent" = "xno"; then
1113 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1116 if test "x$have_getmntent" = "xc"; then
1117 AC_CACHE_CHECK([whether getmntent takes one argument],
1118 [c_cv_have_one_getmntent],
1120 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1121 #include "$srcdir/src/utils_mount.h"]],
1125 fh = setmntent ("/etc/mtab", "r");
1126 me = getmntent (fh);
1129 [c_cv_have_one_getmntent="yes"],
1130 [c_cv_have_one_getmntent="no"]
1133 AC_CACHE_CHECK([whether getmntent takes two arguments],
1134 [c_cv_have_two_getmntent],
1136 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1137 #include "$srcdir/src/utils_mount.h"]],
1142 fh = fopen ("/etc/mnttab", "r");
1143 status = getmntent (fh, &mt);
1146 [c_cv_have_two_getmntent="yes"],
1147 [c_cv_have_two_getmntent="no"]
1152 # Check for different versions of `getmntent' here..
1154 if test "x$have_getmntent" = "xc"; then
1155 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1156 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1157 [Define if the function getmntent exists and takes one argument.])
1159 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1160 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1161 [Define if the function getmntent exists and takes two arguments.])
1164 if test "x$have_getmntent" = "xsun"; then
1165 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1166 [Define if the function getmntent exists. It's the version from libsun.])
1168 if test "x$have_getmntent" = "xseq"; then
1169 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1170 [Define if the function getmntent exists. It's the version from libseq.])
1172 if test "x$have_getmntent" = "xgen"; then
1173 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1174 [Define if the function getmntent exists. It's the version from libgen.])
1178 AC_MSG_CHECKING([if have htonll defined])
1183 #include <sys/types.h>
1184 #include <netinet/in.h>
1186 # include <inttypes.h>
1193 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1196 AC_MSG_RESULT([$have_htonll])
1198 # Check for structures
1199 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1200 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1203 #include <sys/types.h>
1204 #include <sys/socket.h>
1207 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1208 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1211 #include <sys/types.h>
1212 #include <sys/socket.h>
1213 #include <linux/if.h>
1214 #include <linux/netdevice.h>
1217 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1220 #include <netinet/in.h>
1224 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1226 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1227 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1228 have_struct_kinfo_proc_freebsd="yes"
1231 have_struct_kinfo_proc_freebsd="no"
1235 #include <sys/param.h>
1236 #include <sys/sysctl.h>
1237 #include <sys/user.h>
1240 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1242 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1243 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1244 have_struct_kinfo_proc_openbsd="yes"
1247 have_struct_kinfo_proc_openbsd="no"
1250 #include <sys/param.h>
1251 #include <sys/sysctl.h>
1255 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1256 [#define _BSD_SOURCE
1258 # include <stdint.h>
1260 #if HAVE_SYS_TYPES_H
1261 # include <sys/types.h>
1263 #if HAVE_NETINET_IN_SYSTM_H
1264 # include <netinet/in_systm.h>
1266 #if HAVE_NETINET_IN_H
1267 # include <netinet/in.h>
1269 #if HAVE_NETINET_IP_H
1270 # include <netinet/ip.h>
1272 #if HAVE_NETINET_UDP_H
1273 # include <netinet/udp.h>
1276 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1277 [#define _BSD_SOURCE
1279 # include <stdint.h>
1281 #if HAVE_SYS_TYPES_H
1282 # include <sys/types.h>
1284 #if HAVE_NETINET_IN_SYSTM_H
1285 # include <netinet/in_systm.h>
1287 #if HAVE_NETINET_IN_H
1288 # include <netinet/in.h>
1290 #if HAVE_NETINET_IP_H
1291 # include <netinet/ip.h>
1293 #if HAVE_NETINET_UDP_H
1294 # include <netinet/udp.h>
1298 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1308 # Checks for libraries begin here
1311 with_libresolv="yes"
1312 AC_CHECK_LIB(resolv, res_search,
1314 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1316 [with_libresolv="no"])
1317 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1319 dnl Check for HAL (hardware abstraction library)
1321 AC_CHECK_LIB(hal,libhal_device_property_exists,
1322 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1324 if test "x$with_libhal" = "xyes"; then
1325 if test "x$PKG_CONFIG" != "x"; then
1326 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1327 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1328 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1329 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1333 m4_divert_once([HELP_WITH], [
1334 collectd additional packages:])
1336 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1338 if test "x$ac_system" = "xAIX"
1343 with_perfstat="no (AIX only)"
1344 with_procinfo="no (AIX only)"
1347 if test "x$with_perfstat" = "xyes"
1349 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1350 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1352 if test "x$with_perfstat" = "xyes"
1354 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1355 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1356 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1357 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1359 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1362 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1364 # Processes plugin under AIX.
1365 if test "x$with_procinfo" = "xyes"
1367 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1369 if test "x$with_procinfo" = "xyes"
1371 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1374 if test "x$ac_system" = "xSolaris"
1379 with_kstat="no (Solaris only)"
1380 with_devinfo="no (Solaris only)"
1383 if test "x$with_kstat" = "xyes"
1385 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1387 if test "x$with_kstat" = "xyes"
1389 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1390 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1392 if test "x$with_kstat" = "xyes"
1394 AC_DEFINE(HAVE_LIBKSTAT, 1,
1395 [Define to 1 if you have the 'kstat' library (-lkstat)])
1397 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1398 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1401 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1408 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1411 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1412 if test "x$with_kvm_getprocs" = "xyes"
1414 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1415 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1418 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1420 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1421 if test "x$with_kvm_getswapinfo" = "xyes"
1423 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1424 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1427 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1429 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1430 if test "x$with_kvm_nlist" = "xyes"
1432 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1433 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1434 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1437 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1439 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1440 if test "x$with_kvm_openfiles" = "xyes"
1442 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1443 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1446 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1448 # --with-libcredis {{{
1449 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1451 if test "x$withval" = "xyes"
1453 with_libcredis="yes"
1454 else if test "x$withval" = "xno"
1458 with_libcredis="yes"
1459 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1460 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1463 [with_libcredis="yes"])
1465 SAVE_CPPFLAGS="$CPPFLAGS"
1466 SAVE_LDFLAGS="$LDFLAGS"
1468 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1469 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1471 if test "x$with_libcredis" = "xyes"
1473 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1475 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1477 AC_CHECK_HEADERS(credis.h,
1478 [with_libcredis="yes"],
1479 [with_libcredis="no (credis.h not found)"])
1481 if test "x$with_libcredis" = "xyes"
1483 if test "x$LIBCREDIS_LDFLAGS" != "x"
1485 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1487 AC_CHECK_LIB(credis, credis_info,
1488 [with_libcredis="yes"],
1489 [with_libcredis="no (symbol 'credis_info' not found)"])
1493 CPPFLAGS="$SAVE_CPPFLAGS"
1494 LDFLAGS="$SAVE_LDFLAGS"
1496 if test "x$with_libcredis" = "xyes"
1498 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1499 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1500 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1501 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1503 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1506 # --with-libcurl {{{
1507 with_curl_config="curl-config"
1510 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1512 if test "x$withval" = "xno"
1515 else if test "x$withval" = "xyes"
1519 if test -f "$withval" && test -x "$withval"
1521 with_curl_config="$withval"
1523 else if test -x "$withval/bin/curl-config"
1525 with_curl_config="$withval/bin/curl-config"
1534 if test "x$with_libcurl" = "xyes"
1536 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1537 curl_config_status=$?
1539 if test $curl_config_status -ne 0
1541 with_libcurl="no ($with_curl_config failed)"
1543 SAVE_CPPFLAGS="$CPPFLAGS"
1544 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1546 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1548 CPPFLAGS="$SAVE_CPPFLAGS"
1551 if test "x$with_libcurl" = "xyes"
1553 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1554 curl_config_status=$?
1556 if test $curl_config_status -ne 0
1558 with_libcurl="no ($with_curl_config failed)"
1560 AC_CHECK_LIB(curl, curl_easy_init,
1561 [with_libcurl="yes"],
1562 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1566 if test "x$with_libcurl" = "xyes"
1568 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1569 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1570 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1571 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1573 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1577 with_libdbi_cppflags=""
1578 with_libdbi_ldflags=""
1579 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1581 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1583 with_libdbi_cppflags="-I$withval/include"
1584 with_libdbi_ldflags="-L$withval/lib"
1587 with_libdbi="$withval"
1593 if test "x$with_libdbi" = "xyes"
1595 SAVE_CPPFLAGS="$CPPFLAGS"
1596 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1598 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1600 CPPFLAGS="$SAVE_CPPFLAGS"
1602 if test "x$with_libdbi" = "xyes"
1604 SAVE_CPPFLAGS="$CPPFLAGS"
1605 SAVE_LDFLAGS="$LDFLAGS"
1606 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1607 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1609 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1611 CPPFLAGS="$SAVE_CPPFLAGS"
1612 LDFLAGS="$SAVE_LDFLAGS"
1614 if test "x$with_libdbi" = "xyes"
1616 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1617 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1618 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1619 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1620 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1621 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1623 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1626 # --with-libesmtp {{{
1627 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1629 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1631 LDFLAGS="$LDFLAGS -L$withval/lib"
1632 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1635 with_libesmtp="$withval"
1641 if test "x$with_libesmtp" = "xyes"
1643 AC_CHECK_LIB(esmtp, smtp_create_session,
1645 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1646 ], [with_libesmtp="no (libesmtp not found)"])
1648 if test "x$with_libesmtp" = "xyes"
1650 AC_CHECK_HEADERS(libesmtp.h,
1652 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1653 ], [with_libesmtp="no (libesmtp.h not found)"])
1655 if test "x$with_libesmtp" = "xyes"
1661 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1662 [Wether or not to use the esmtp library])
1663 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1666 # --with-libganglia {{{
1667 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1669 if test -f "$withval" && test -x "$withval"
1671 with_libganglia_config="$withval"
1672 with_libganglia="yes"
1673 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1675 with_libganglia_config="$withval/bin/ganglia-config"
1676 with_libganglia="yes"
1677 else if test -d "$withval"
1679 GANGLIA_CPPFLAGS="-I$withval/include"
1680 GANGLIA_LDFLAGS="-L$withval/lib"
1681 with_libganglia="yes"
1683 with_libganglia_config="ganglia-config"
1684 with_libganglia="$withval"
1688 with_libganglia_config="ganglia-config"
1689 with_libganglia="yes"
1692 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1694 if test "x$GANGLIA_CPPFLAGS" = "x"
1696 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1699 if test "x$GANGLIA_LDFLAGS" = "x"
1701 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1704 if test "x$GANGLIA_LIBS" = "x"
1706 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1710 SAVE_CPPFLAGS="$CPPFLAGS"
1711 SAVE_LDFLAGS="$LDFLAGS"
1712 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1713 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1715 if test "x$with_libganglia" = "xyes"
1717 AC_CHECK_HEADERS(gm_protocol.h,
1719 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1720 [Define to 1 if you have the <gm_protocol.h> header file.])
1721 ], [with_libganglia="no (gm_protocol.h not found)"])
1724 if test "x$with_libganglia" = "xyes"
1726 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1728 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1729 [Define to 1 if you have the ganglia library (-lganglia).])
1730 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1733 CPPFLAGS="$SAVE_CPPFLAGS"
1734 LDFLAGS="$SAVE_LDFLAGS"
1736 AC_SUBST(GANGLIA_CPPFLAGS)
1737 AC_SUBST(GANGLIA_LDFLAGS)
1738 AC_SUBST(GANGLIA_LIBS)
1739 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1742 # --with-libgcrypt {{{
1743 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1744 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1745 GCRYPT_LIBS="$GCRYPT_LIBS"
1746 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1748 if test -f "$withval" && test -x "$withval"
1750 with_libgcrypt_config="$withval"
1751 with_libgcrypt="yes"
1752 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1754 with_libgcrypt_config="$withval/bin/gcrypt-config"
1755 with_libgcrypt="yes"
1756 else if test -d "$withval"
1758 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1759 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1760 with_libgcrypt="yes"
1762 with_libgcrypt_config="gcrypt-config"
1763 with_libgcrypt="$withval"
1767 with_libgcrypt_config="libgcrypt-config"
1768 with_libgcrypt="yes"
1771 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1773 if test "x$GCRYPT_CPPFLAGS" = "x"
1775 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1778 if test "x$GCRYPT_LDFLAGS" = "x"
1780 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1781 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1784 if test "x$GCRYPT_LIBS" = "x"
1786 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1790 SAVE_CPPFLAGS="$CPPFLAGS"
1791 SAVE_LDFLAGS="$LDFLAGS"
1792 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1793 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1795 if test "x$with_libgcrypt" = "xyes"
1797 if test "x$GCRYPT_CPPFLAGS" != "x"
1799 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1801 AC_CHECK_HEADERS(gcrypt.h,
1802 [with_libgcrypt="yes"],
1803 [with_libgcrypt="no (gcrypt.h not found)"])
1806 if test "x$with_libgcrypt" = "xyes"
1808 if test "x$GCRYPT_LDFLAGS" != "x"
1810 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1812 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1813 [with_libgcrypt="yes"],
1814 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1816 if test "$with_libgcrypt" != "no"; then
1817 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1821 CPPFLAGS="$SAVE_CPPFLAGS"
1822 LDFLAGS="$SAVE_LDFLAGS"
1824 if test "x$with_libgcrypt" = "xyes"
1826 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1829 AC_SUBST(GCRYPT_CPPFLAGS)
1830 AC_SUBST(GCRYPT_LDFLAGS)
1831 AC_SUBST(GCRYPT_LIBS)
1832 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1835 # --with-libiptc {{{
1836 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1838 if test "x$withval" = "xshipped"
1841 else if test "x$withval" = "xyes"
1843 with_libiptc="pkgconfig"
1844 else if test "x$withval" = "xno"
1849 with_libiptc_cflags="-I$withval/include"
1850 with_libiptc_libs="-L$withval/lib"
1854 if test "x$ac_system" = "xLinux"
1856 with_libiptc="pkgconfig"
1858 with_libiptc="no (Linux only)"
1862 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1864 with_libiptc="no (Don't have pkg-config)"
1867 if test "x$with_libiptc" = "xpkgconfig"
1869 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1872 with_libiptc="no (pkg-config doesn't know libiptc)"
1875 if test "x$with_libiptc" = "xpkgconfig"
1877 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1880 with_libiptc="no ($PKG_CONFIG failed)"
1882 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1885 with_libiptc="no ($PKG_CONFIG failed)"
1889 SAVE_CPPFLAGS="$CPPFLAGS"
1890 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1892 # check whether the header file for libiptc is available.
1893 if test "x$with_libiptc" = "xpkgconfig"
1895 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1896 [with_libiptc="no (header file missing)"])
1898 # If the header file is available, check for the required type declaractions.
1899 # They may be missing in old versions of libiptc. In that case, they will be
1900 # declared in the iptables plugin.
1901 if test "x$with_libiptc" = "xpkgconfig"
1903 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1905 # Check for the iptc_init symbol in the library.
1906 # This could be in iptc or ip4tc
1907 if test "x$with_libiptc" = "xpkgconfig"
1909 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1910 [with_libiptc="pkgconfig"],
1911 [with_libiptc="no"],
1912 [$with_libiptc_libs])
1914 if test "x$with_libiptc" = "xpkgconfig"
1919 CPPFLAGS="$SAVE_CPPFLAGS"
1921 if test "x$with_libiptc" = "xown"
1923 with_libiptc_cflags=""
1924 with_libiptc_libs=""
1926 if test "x$with_libiptc" = "xown"
1928 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1930 with_libiptc="no (Linux iptables headers not found)"
1933 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1936 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1937 if test "x$with_libiptc" = "xown"
1939 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1943 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1944 if test "x$with_libiptc" = "xyes"
1946 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1947 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1948 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1949 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1954 with_java_home="$JAVA_HOME"
1955 with_java_vmtype="client"
1960 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1962 if test "x$withval" = "xno"
1965 else if test "x$withval" = "xyes"
1969 with_java_home="$withval"
1974 if test "x$with_java" = "xyes"
1976 if test -d "$with_java_home"
1978 AC_MSG_CHECKING([for jni.h])
1979 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1980 if test "x$TMPDIR" != "x"
1982 AC_MSG_RESULT([found in $TMPDIR])
1983 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1985 AC_MSG_RESULT([not found])
1988 AC_MSG_CHECKING([for jni_md.h])
1989 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1990 if test "x$TMPDIR" != "x"
1992 AC_MSG_RESULT([found in $TMPDIR])
1993 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1995 AC_MSG_RESULT([not found])
1998 AC_MSG_CHECKING([for libjvm.so])
1999 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
2000 if test "x$TMPDIR" != "x"
2002 AC_MSG_RESULT([found in $TMPDIR])
2003 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
2005 AC_MSG_RESULT([not found])
2008 if test "x$JAVAC" = "x"
2010 AC_MSG_CHECKING([for javac])
2011 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
2012 if test "x$TMPDIR" != "x"
2015 AC_MSG_RESULT([$JAVAC])
2017 AC_MSG_RESULT([not found])
2020 if test "x$JAR" = "x"
2022 AC_MSG_CHECKING([for jar])
2023 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
2024 if test "x$TMPDIR" != "x"
2027 AC_MSG_RESULT([$JAR])
2029 AC_MSG_RESULT([not found])
2032 else if test "x$with_java_home" != "x"
2034 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2038 if test "x$JAVA_CPPFLAGS" != "x"
2040 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2042 if test "x$JAVA_CFLAGS" != "x"
2044 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2046 if test "x$JAVA_LDFLAGS" != "x"
2048 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2050 if test "x$JAVAC" = "x"
2052 with_javac_path="$PATH"
2053 if test "x$with_java_home" != "x"
2055 with_javac_path="$with_java_home:with_javac_path"
2056 if test -d "$with_java_home/bin"
2058 with_javac_path="$with_java_home/bin:with_javac_path"
2062 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2064 if test "x$JAVAC" = "x"
2066 with_java="no (javac not found)"
2068 if test "x$JAR" = "x"
2070 with_jar_path="$PATH"
2071 if test "x$with_java_home" != "x"
2073 with_jar_path="$with_java_home:$with_jar_path"
2074 if test -d "$with_java_home/bin"
2076 with_jar_path="$with_java_home/bin:$with_jar_path"
2080 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2082 if test "x$JAR" = "x"
2084 with_java="no (jar not found)"
2087 SAVE_CPPFLAGS="$CPPFLAGS"
2088 SAVE_CFLAGS="$CFLAGS"
2089 SAVE_LDFLAGS="$LDFLAGS"
2090 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2091 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2092 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2094 if test "x$with_java" = "xyes"
2096 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2098 if test "x$with_java" = "xyes"
2100 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2102 [with_java="no (libjvm not found)"],
2105 if test "x$with_java" = "xyes"
2107 JAVA_LIBS="$JAVA_LIBS -ljvm"
2108 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2111 CPPFLAGS="$SAVE_CPPFLAGS"
2112 CFLAGS="$SAVE_CFLAGS"
2113 LDFLAGS="$SAVE_LDFLAGS"
2115 AC_SUBST(JAVA_CPPFLAGS)
2116 AC_SUBST(JAVA_CFLAGS)
2117 AC_SUBST(JAVA_LDFLAGS)
2119 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2122 # --with-libmemcached {{{
2123 with_libmemcached_cppflags=""
2124 with_libmemcached_ldflags=""
2125 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2127 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2129 with_libmemcached_cppflags="-I$withval/include"
2130 with_libmemcached_ldflags="-L$withval/lib"
2131 with_libmemcached="yes"
2133 with_libmemcached="$withval"
2137 with_libmemcached="yes"
2139 if test "x$with_libmemcached" = "xyes"
2141 SAVE_CPPFLAGS="$CPPFLAGS"
2142 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2144 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2146 CPPFLAGS="$SAVE_CPPFLAGS"
2148 if test "x$with_libmemcached" = "xyes"
2150 SAVE_CPPFLAGS="$CPPFLAGS"
2151 SAVE_LDFLAGS="$LDFLAGS"
2152 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2153 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2155 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2157 CPPFLAGS="$SAVE_CPPFLAGS"
2158 LDFLAGS="$SAVE_LDFLAGS"
2160 if test "x$with_libmemcached" = "xyes"
2162 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2163 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2164 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2165 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2166 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2167 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2168 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2170 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2173 # --with-libmodbus {{{
2174 with_libmodbus_config=""
2175 with_libmodbus_cflags=""
2176 with_libmodbus_libs=""
2177 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2179 if test "x$withval" = "xno"
2182 else if test "x$withval" = "xyes"
2184 with_libmodbus="use_pkgconfig"
2185 else if test -d "$with_libmodbus/lib"
2187 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2188 with_libmodbus_cflags="-I$withval/include"
2189 with_libmodbus_libs="-L$withval/lib -lmodbus"
2190 with_libmodbus="yes"
2193 [with_libmodbus="use_pkgconfig"])
2195 # configure using pkg-config
2196 if test "x$with_libmodbus" = "xuse_pkgconfig"
2198 if test "x$PKG_CONFIG" = "x"
2200 with_libmodbus="no (Don't have pkg-config)"
2203 if test "x$with_libmodbus" = "xuse_pkgconfig"
2205 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2206 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2209 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2212 if test "x$with_libmodbus" = "xuse_pkgconfig"
2214 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2217 with_libmodbus="no ($PKG_CONFIG failed)"
2219 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2222 with_libmodbus="no ($PKG_CONFIG failed)"
2225 if test "x$with_libmodbus" = "xuse_pkgconfig"
2227 with_libmodbus="yes"
2230 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2231 # the actual checks.
2232 if test "x$with_libmodbus" = "xyes"
2234 SAVE_CPPFLAGS="$CPPFLAGS"
2235 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2237 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2239 CPPFLAGS="$SAVE_CPPFLAGS"
2241 if test "x$with_libmodbus" = "xyes"
2243 SAVE_CPPFLAGS="$CPPFLAGS"
2244 SAVE_LDFLAGS="$LDFLAGS"
2246 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2247 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2249 AC_CHECK_LIB(modbus, modbus_connect,
2250 [with_libmodbus="yes"],
2251 [with_libmodbus="no (symbol modbus_connect not found)"])
2253 CPPFLAGS="$SAVE_CPPFLAGS"
2254 LDFLAGS="$SAVE_LDFLAGS"
2256 if test "x$with_libmodbus" = "xyes"
2258 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2259 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2260 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2261 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2265 # --with-libmongoc {{{
2266 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2268 if test "x$withval" = "xyes"
2270 with_libmongoc="yes"
2271 else if test "x$withval" = "xno"
2275 with_libmongoc="yes"
2276 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2277 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2280 [with_libmongoc="yes"])
2282 SAVE_CPPFLAGS="$CPPFLAGS"
2283 SAVE_LDFLAGS="$LDFLAGS"
2285 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2286 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2288 if test "x$with_libmongoc" = "xyes"
2290 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2292 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2294 AC_CHECK_HEADERS(mongo.h,
2295 [with_libmongoc="yes"],
2296 [with_libmongoc="no ('mongo.h' not found)"],
2298 # define MONGO_HAVE_STDINT 1
2300 # define MONGO_USE_LONG_LONG_INT 1
2304 if test "x$with_libmongoc" = "xyes"
2306 if test "x$LIBMONGOC_LDFLAGS" != "x"
2308 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2310 AC_CHECK_LIB(mongoc, mongo_run_command,
2311 [with_libmongoc="yes"],
2312 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2315 CPPFLAGS="$SAVE_CPPFLAGS"
2316 LDFLAGS="$SAVE_LDFLAGS"
2318 if test "x$with_libmongoc" = "xyes"
2320 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2321 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2322 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2323 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2325 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2328 # --with-libmysql {{{
2329 with_mysql_config="mysql_config"
2330 with_mysql_cflags=""
2332 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2334 if test "x$withval" = "xno"
2337 else if test "x$withval" = "xyes"
2341 if test -f "$withval" && test -x "$withval";
2343 with_mysql_config="$withval"
2344 else if test -x "$withval/bin/mysql_config"
2346 with_mysql_config="$withval/bin/mysql_config"
2354 if test "x$with_libmysql" = "xyes"
2356 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2357 mysql_config_status=$?
2359 if test $mysql_config_status -ne 0
2361 with_libmysql="no ($with_mysql_config failed)"
2363 SAVE_CPPFLAGS="$CPPFLAGS"
2364 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2367 have_mysql_mysql_h="no"
2368 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2370 if test "x$have_mysql_h" = "xno"
2372 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2375 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2377 with_libmysql="no (mysql.h not found)"
2380 CPPFLAGS="$SAVE_CPPFLAGS"
2383 if test "x$with_libmysql" = "xyes"
2385 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2386 mysql_config_status=$?
2388 if test $mysql_config_status -ne 0
2390 with_libmysql="no ($with_mysql_config failed)"
2392 AC_CHECK_LIB(mysqlclient, mysql_init,
2393 [with_libmysql="yes"],
2394 [with_libmysql="no (symbol 'mysql_init' not found)"],
2397 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2398 [with_libmysql="yes"],
2399 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2403 if test "x$with_libmysql" = "xyes"
2405 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2406 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2407 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2408 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2410 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2413 # --with-libnetlink {{{
2414 with_libnetlink_cflags=""
2415 with_libnetlink_libs="-lnetlink"
2416 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2418 echo "libnetlink: withval = $withval"
2419 if test "x$withval" = "xyes"
2421 with_libnetlink="yes"
2422 else if test "x$withval" = "xno"
2424 with_libnetlink="no"
2426 if test -d "$withval/include"
2428 with_libnetlink_cflags="-I$withval/include"
2429 with_libnetlink_libs="-L$withval/lib -lnetlink"
2430 with_libnetlink="yes"
2432 AC_MSG_ERROR("no such directory: $withval/include")
2437 if test "x$ac_system" = "xLinux"
2439 with_libnetlink="yes"
2441 with_libnetlink="no (Linux only library)"
2444 if test "x$with_libnetlink" = "xyes"
2446 SAVE_CFLAGS="$CFLAGS"
2447 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2449 with_libnetlink="no (libnetlink.h not found)"
2451 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2453 with_libnetlink="yes"
2457 #include <sys/types.h>
2458 #include <asm/types.h>
2459 #include <sys/socket.h>
2460 #include <linux/netlink.h>
2461 #include <linux/rtnetlink.h>])
2462 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2464 #include <sys/types.h>
2465 #include <asm/types.h>
2466 #include <sys/socket.h>])
2470 #include <sys/types.h>
2471 #include <asm/types.h>
2472 #include <sys/socket.h>
2473 #include <linux/netlink.h>
2474 #include <linux/rtnetlink.h>
2478 int retval = TCA_STATS2;
2481 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2486 #include <sys/types.h>
2487 #include <asm/types.h>
2488 #include <sys/socket.h>
2489 #include <linux/netlink.h>
2490 #include <linux/rtnetlink.h>
2494 int retval = TCA_STATS;
2497 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2500 CFLAGS="$SAVE_CFLAGS"
2502 if test "x$with_libnetlink" = "xyes"
2504 AC_CHECK_LIB(netlink, rtnl_open,
2505 [with_libnetlink="yes"],
2506 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2507 [$with_libnetlink_libs])
2509 if test "x$with_libnetlink" = "xyes"
2511 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2512 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2513 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2514 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2516 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2519 # --with-libnetapp {{{
2520 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2521 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2522 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2523 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2524 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2525 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2526 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2528 if test -d "$withval"
2530 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2531 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2532 with_libnetapp="yes"
2534 with_libnetapp="$withval"
2538 with_libnetapp="yes"
2541 SAVE_CPPFLAGS="$CPPFLAGS"
2542 SAVE_LDFLAGS="$LDFLAGS"
2543 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2544 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2546 if test "x$with_libnetapp" = "xyes"
2548 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2550 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2552 AC_CHECK_HEADERS(netapp_api.h,
2553 [with_libnetapp="yes"],
2554 [with_libnetapp="no (netapp_api.h not found)"])
2557 if test "x$with_libnetapp" = "xyes"
2559 if test "x$LIBNETAPP_LDFLAGS" != "x"
2561 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2564 if test "x$LIBNETAPP_LIBS" = "x"
2566 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2568 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2570 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2571 [with_libnetapp="yes"],
2572 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2574 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2577 CPPFLAGS="$SAVE_CPPFLAGS"
2578 LDFLAGS="$SAVE_LDFLAGS"
2580 if test "x$with_libnetapp" = "xyes"
2582 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2585 AC_SUBST(LIBNETAPP_CPPFLAGS)
2586 AC_SUBST(LIBNETAPP_LDFLAGS)
2587 AC_SUBST(LIBNETAPP_LIBS)
2588 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2591 # --with-libnetsnmp {{{
2592 with_snmp_config="net-snmp-config"
2595 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2597 if test "x$withval" = "xno"
2599 with_libnetsnmp="no"
2600 else if test "x$withval" = "xyes"
2602 with_libnetsnmp="yes"
2604 if test -x "$withval"
2606 with_snmp_config="$withval"
2607 with_libnetsnmp="yes"
2609 with_snmp_config="$withval/bin/net-snmp-config"
2610 with_libnetsnmp="yes"
2614 [with_libnetsnmp="yes"])
2615 if test "x$with_libnetsnmp" = "xyes"
2617 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2618 snmp_config_status=$?
2620 if test $snmp_config_status -ne 0
2622 with_libnetsnmp="no ($with_snmp_config failed)"
2624 SAVE_CPPFLAGS="$CPPFLAGS"
2625 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2627 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2629 CPPFLAGS="$SAVE_CPPFLAGS"
2632 if test "x$with_libnetsnmp" = "xyes"
2634 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2635 snmp_config_status=$?
2637 if test $snmp_config_status -ne 0
2639 with_libnetsnmp="no ($with_snmp_config failed)"
2641 AC_CHECK_LIB(netsnmp, init_snmp,
2642 [with_libnetsnmp="yes"],
2643 [with_libnetsnmp="no (libnetsnmp not found)"],
2647 if test "x$with_libnetsnmp" = "xyes"
2649 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2650 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2651 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2652 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2654 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2657 # --with-liboconfig {{{
2658 with_own_liboconfig="no"
2659 liboconfig_LDFLAGS="$LDFLAGS"
2660 liboconfig_CPPFLAGS="$CPPFLAGS"
2661 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2663 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2665 if test -d "$withval/lib"
2667 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2669 if test -d "$withval/include"
2671 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2674 if test "x$withval" = "xno"
2676 AC_MSG_ERROR("liboconfig is required")
2680 with_liboconfig="yes"
2683 save_LDFLAGS="$LDFLAGS"
2684 save_CPPFLAGS="$CPPFLAGS"
2685 LDFLAGS="$liboconfig_LDFLAGS"
2686 CPPFLAGS="$liboconfig_CPPFLAGS"
2687 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2689 with_liboconfig="yes"
2690 with_own_liboconfig="no"
2693 with_liboconfig="yes"
2694 with_own_liboconfig="yes"
2695 LDFLAGS="$save_LDFLAGS"
2696 CPPFLAGS="$save_CPPFLAGS"
2699 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2700 if test "x$with_own_liboconfig" = "xyes"
2702 with_liboconfig="yes (shipped version)"
2706 # --with-liboping {{{
2707 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2709 if test "x$withval" = "xyes"
2712 else if test "x$withval" = "xno"
2717 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2718 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2721 [with_liboping="yes"])
2723 SAVE_CPPFLAGS="$CPPFLAGS"
2724 SAVE_LDFLAGS="$LDFLAGS"
2726 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2727 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2729 if test "x$with_liboping" = "xyes"
2731 if test "x$LIBOPING_CPPFLAGS" != "x"
2733 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2735 AC_CHECK_HEADERS(oping.h,
2736 [with_liboping="yes"],
2737 [with_liboping="no (oping.h not found)"])
2739 if test "x$with_liboping" = "xyes"
2741 if test "x$LIBOPING_LDFLAGS" != "x"
2743 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2745 AC_CHECK_LIB(oping, ping_construct,
2746 [with_liboping="yes"],
2747 [with_liboping="no (symbol 'ping_construct' not found)"])
2750 CPPFLAGS="$SAVE_CPPFLAGS"
2751 LDFLAGS="$SAVE_LDFLAGS"
2753 if test "x$with_liboping" = "xyes"
2755 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2756 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2757 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2758 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2760 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2764 with_oracle_cppflags=""
2766 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2768 if test "x$withval" = "xyes"
2770 if test "x$ORACLE_HOME" = "x"
2772 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2775 else if test "x$withval" = "xno"
2780 ORACLE_HOME="$withval"
2784 if test "x$ORACLE_HOME" = "x"
2786 with_oracle="no (ORACLE_HOME is not set)"
2791 if test "x$ORACLE_HOME" != "x"
2793 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2795 if test -e "$ORACLE_HOME/lib/ldflags"
2797 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2799 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2800 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2802 if test "x$with_oracle" = "xyes"
2804 SAVE_CPPFLAGS="$CPPFLAGS"
2805 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2807 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2809 CPPFLAGS="$SAVE_CPPFLAGS"
2811 if test "x$with_oracle" = "xyes"
2813 SAVE_CPPFLAGS="$CPPFLAGS"
2814 SAVE_LDFLAGS="$LDFLAGS"
2815 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2816 LDFLAGS="$LDFLAGS $with_oracle_libs"
2818 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2820 CPPFLAGS="$SAVE_CPPFLAGS"
2821 LDFLAGS="$SAVE_LDFLAGS"
2823 if test "x$with_oracle" = "xyes"
2825 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2826 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2827 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2828 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2832 # --with-libowcapi {{{
2833 with_libowcapi_cppflags=""
2834 with_libowcapi_libs="-lowcapi"
2835 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2837 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2839 with_libowcapi_cppflags="-I$withval/include"
2840 with_libowcapi_libs="-L$withval/lib -lowcapi"
2841 with_libowcapi="yes"
2843 with_libowcapi="$withval"
2847 with_libowcapi="yes"
2849 if test "x$with_libowcapi" = "xyes"
2851 SAVE_CPPFLAGS="$CPPFLAGS"
2852 CPPFLAGS="$with_libowcapi_cppflags"
2854 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2856 CPPFLAGS="$SAVE_CPPFLAGS"
2858 if test "x$with_libowcapi" = "xyes"
2860 SAVE_LDFLAGS="$LDFLAGS"
2861 SAVE_CPPFLAGS="$CPPFLAGS"
2862 LDFLAGS="$with_libowcapi_libs"
2863 CPPFLAGS="$with_libowcapi_cppflags"
2865 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2867 LDFLAGS="$SAVE_LDFLAGS"
2868 CPPFLAGS="$SAVE_CPPFLAGS"
2870 if test "x$with_libowcapi" = "xyes"
2872 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2873 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2874 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2875 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2879 # --with-libpcap {{{
2880 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2882 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2884 LDFLAGS="$LDFLAGS -L$withval/lib"
2885 CPPFLAGS="$CPPFLAGS -I$withval/include"
2888 with_libpcap="$withval"
2894 if test "x$with_libpcap" = "xyes"
2896 AC_CHECK_LIB(pcap, pcap_open_live,
2898 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2899 ], [with_libpcap="no (libpcap not found)"])
2901 if test "x$with_libpcap" = "xyes"
2903 AC_CHECK_HEADERS(pcap.h,,
2904 [with_libpcap="no (pcap.h not found)"])
2906 if test "x$with_libpcap" = "xyes"
2908 AC_CHECK_HEADERS(pcap-bpf.h,,
2909 [with_libpcap="no (pcap-bpf.h not found)"])
2911 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2914 # --with-libperl {{{
2915 perl_interpreter="perl"
2916 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2918 if test -x "$withval"
2920 perl_interpreter="$withval"
2922 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2924 LDFLAGS="$LDFLAGS -L$withval/lib"
2925 CPPFLAGS="$CPPFLAGS -I$withval/include"
2926 perl_interpreter="$withval/bin/perl"
2929 with_libperl="$withval"
2936 AC_MSG_CHECKING([for perl])
2937 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2938 if test -x "$perl_interpreter"
2940 AC_MSG_RESULT([yes ($perl_interpreter)])
2946 AC_SUBST(PERL, "$perl_interpreter")
2948 if test "x$with_libperl" = "xyes" \
2949 && test -n "$perl_interpreter"
2951 SAVE_CFLAGS="$CFLAGS"
2952 SAVE_LDFLAGS="$LDFLAGS"
2953 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2954 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2955 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2956 CFLAGS="$CFLAGS $PERL_CFLAGS"
2957 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2959 AC_CACHE_CHECK([for libperl],
2960 [c_cv_have_libperl],
2964 #define PERL_NO_GET_CONTEXT
2971 load_module (PERL_LOADMOD_NOIMPORT,
2972 newSVpv ("Collectd::Plugin::FooBar", 24),
2975 [c_cv_have_libperl="yes"],
2976 [c_cv_have_libperl="no"]
2980 if test "x$c_cv_have_libperl" = "xyes"
2982 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2983 AC_SUBST(PERL_CFLAGS)
2984 AC_SUBST(PERL_LDFLAGS)
2989 CFLAGS="$SAVE_CFLAGS"
2990 LDFLAGS="$SAVE_LDFLAGS"
2991 else if test -z "$perl_interpreter"; then
2992 with_libperl="no (no perl interpreter found)"
2993 c_cv_have_libperl="no"
2995 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2997 if test "x$with_libperl" = "xyes"
2999 SAVE_CFLAGS="$CFLAGS"
3000 SAVE_LDFLAGS="$LDFLAGS"
3001 CFLAGS="$CFLAGS $PERL_CFLAGS"
3002 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3004 AC_CACHE_CHECK([if perl supports ithreads],
3005 [c_cv_have_perl_ithreads],
3013 #if !defined(USE_ITHREADS)
3014 # error "Perl does not support ithreads!"
3015 #endif /* !defined(USE_ITHREADS) */
3018 [c_cv_have_perl_ithreads="yes"],
3019 [c_cv_have_perl_ithreads="no"]
3023 if test "x$c_cv_have_perl_ithreads" = "xyes"
3025 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3028 CFLAGS="$SAVE_CFLAGS"
3029 LDFLAGS="$SAVE_LDFLAGS"
3032 if test "x$with_libperl" = "xyes"
3034 SAVE_CFLAGS="$CFLAGS"
3035 SAVE_LDFLAGS="$LDFLAGS"
3036 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3037 # (see issues #41 and #42)
3038 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3039 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3041 AC_CACHE_CHECK([for broken Perl_load_module()],
3042 [c_cv_have_broken_perl_load_module],
3046 #define PERL_NO_GET_CONTEXT
3053 load_module (PERL_LOADMOD_NOIMPORT,
3054 newSVpv ("Collectd::Plugin::FooBar", 24),
3057 [c_cv_have_broken_perl_load_module="no"],
3058 [c_cv_have_broken_perl_load_module="yes"]
3062 CFLAGS="$SAVE_CFLAGS"
3063 LDFLAGS="$SAVE_LDFLAGS"
3065 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3066 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3068 if test "x$with_libperl" = "xyes"
3070 SAVE_CFLAGS="$CFLAGS"
3071 SAVE_LDFLAGS="$LDFLAGS"
3072 CFLAGS="$CFLAGS $PERL_CFLAGS"
3073 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3076 [struct mgvtbl.svt_local],
3077 [have_struct_mgvtbl_svt_local="yes"],
3078 [have_struct_mgvtbl_svt_local="no"],
3085 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3087 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3088 [Define if Perl's struct mgvtbl has member svt_local.])
3091 CFLAGS="$SAVE_CFLAGS"
3092 LDFLAGS="$SAVE_LDFLAGS"
3097 with_pg_config="pg_config"
3098 with_libpq_includedir=""
3099 with_libpq_libdir=""
3100 with_libpq_cppflags=""
3101 with_libpq_ldflags=""
3102 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3105 if test "x$withval" = "xno"
3108 else if test "x$withval" = "xyes"
3112 if test -f "$withval" && test -x "$withval";
3114 with_pg_config="$withval"
3115 else if test -x "$withval/bin/pg_config"
3117 with_pg_config="$withval/bin/pg_config"
3125 if test "x$with_libpq" = "xyes"
3127 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3130 if test $pg_config_status -eq 0
3132 if test -n "$with_libpq_includedir"; then
3133 for dir in $with_libpq_includedir; do
3134 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3138 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3141 SAVE_CPPFLAGS="$CPPFLAGS"
3142 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3144 AC_CHECK_HEADERS(libpq-fe.h, [],
3145 [with_libpq="no (libpq-fe.h not found)"], [])
3147 CPPFLAGS="$SAVE_CPPFLAGS"
3149 if test "x$with_libpq" = "xyes"
3151 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3154 if test $pg_config_status -eq 0
3156 if test -n "$with_libpq_libdir"; then
3157 for dir in $with_libpq_libdir; do
3158 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3162 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3165 SAVE_LDFLAGS="$LDFLAGS"
3166 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3168 AC_CHECK_LIB(pq, PQconnectdb,
3170 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3172 AC_CHECK_LIB(pq, PQserverVersion,
3174 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3176 LDFLAGS="$SAVE_LDFLAGS"
3178 if test "x$with_libpq" = "xyes"
3180 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3181 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3182 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3183 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3185 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3188 # --with-libpthread {{{
3189 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3190 [ if test "x$withval" != "xno" \
3191 && test "x$withval" != "xyes"
3193 LDFLAGS="$LDFLAGS -L$withval/lib"
3194 CPPFLAGS="$CPPFLAGS -I$withval/include"
3195 with_libpthread="yes"
3197 if test "x$withval" = "xno"
3199 with_libpthread="no (disabled)"
3202 ], [with_libpthread="yes"])
3203 if test "x$with_libpthread" = "xyes"
3205 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3208 if test "x$with_libpthread" = "xyes"
3210 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3212 if test "x$with_libpthread" = "xyes"
3218 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3219 [Wether or not to use pthread (POSIX threads) library])
3220 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3225 with_python_path="$PATH"
3226 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3228 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3230 with_python="$withval"
3231 else if test -x "$withval"
3233 with_python_prog="$withval"
3234 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3236 else if test -d "$withval"
3238 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3241 AC_MSG_WARN([Argument not recognized: $withval])
3243 ], [with_python="yes"])
3246 SAVE_CPPFLAGS="$CPPFLAGS"
3247 SAVE_LDFLAGS="$LDFLAGS"
3250 PATH="$with_python_path"
3252 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3254 AC_MSG_CHECKING([for python])
3255 with_python_prog="`which python 2>/dev/null`"
3256 if test "x$with_python_prog" = "x"
3258 AC_MSG_RESULT([not found])
3259 with_python="no (interpreter not found)"
3261 AC_MSG_RESULT([$with_python_prog])
3265 if test "x$with_python" = "xyes"
3267 AC_MSG_CHECKING([for Python CPPFLAGS])
3268 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3269 python_config_status=$?
3271 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3273 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3276 AC_MSG_RESULT([$python_include_path])
3280 if test "x$with_python" = "xyes"
3282 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3283 AC_CHECK_HEADERS(Python.h,
3284 [with_python="yes"],
3285 [with_python="no ('Python.h' not found)"])
3288 if test "x$with_python" = "xyes"
3290 AC_MSG_CHECKING([for Python LDFLAGS])
3291 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`
3292 python_config_status=$?
3294 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3296 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3299 AC_MSG_RESULT([$python_library_path])
3303 if test "x$with_python" = "xyes"
3305 AC_MSG_CHECKING([for Python LIBS])
3306 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`
3307 python_config_status=$?
3309 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3311 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3314 AC_MSG_RESULT([$python_library_flags])
3318 if test "x$with_python" = "xyes"
3320 LDFLAGS="-L$python_library_path $LDFLAGS"
3321 LIBS="$python_library_flags $LIBS"
3323 AC_CHECK_FUNC(PyObject_CallFunction,
3324 [with_python="yes"],
3325 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3329 CPPFLAGS="$SAVE_CPPFLAGS"
3330 LDFLAGS="$SAVE_LDFLAGS"
3333 if test "x$with_python" = "xyes"
3335 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3336 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3337 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3338 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3339 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3340 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3344 # --with-librabbitmq {{{
3345 with_librabbitmq_cppflags=""
3346 with_librabbitmq_ldflags=""
3347 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3349 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3351 with_librabbitmq_cppflags="-I$withval/include"
3352 with_librabbitmq_ldflags="-L$withval/lib"
3353 with_librabbitmq="yes"
3355 with_librabbitmq="$withval"
3359 with_librabbitmq="yes"
3361 SAVE_CPPFLAGS="$CPPFLAGS"
3362 SAVE_LDFLAGS="$LDFLAGS"
3363 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3364 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3365 if test "x$with_librabbitmq" = "xyes"
3367 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3369 if test "x$with_librabbitmq" = "xyes"
3371 # librabbitmq up to version 0.9.1 provides "library_errno", later
3372 # versions use "library_error". The library does not provide a version
3373 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3374 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3377 # include <stdlib.h>
3383 # include <stdint.h>
3386 # include <inttypes.h>
3391 if test "x$with_librabbitmq" = "xyes"
3393 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3395 if test "x$with_librabbitmq" = "xyes"
3397 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3398 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3399 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3400 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3401 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3402 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3403 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3405 CPPFLAGS="$SAVE_CPPFLAGS"
3406 LDFLAGS="$SAVE_LDFLAGS"
3407 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3410 # --with-librouteros {{{
3411 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3413 if test "x$withval" = "xyes"
3415 with_librouteros="yes"
3416 else if test "x$withval" = "xno"
3418 with_librouteros="no"
3420 with_librouteros="yes"
3421 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3422 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3425 [with_librouteros="yes"])
3427 SAVE_CPPFLAGS="$CPPFLAGS"
3428 SAVE_LDFLAGS="$LDFLAGS"
3430 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3431 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3433 if test "x$with_librouteros" = "xyes"
3435 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3437 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3439 AC_CHECK_HEADERS(routeros_api.h,
3440 [with_librouteros="yes"],
3441 [with_librouteros="no (routeros_api.h not found)"])
3443 if test "x$with_librouteros" = "xyes"
3445 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3447 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3449 AC_CHECK_LIB(routeros, ros_interface,
3450 [with_librouteros="yes"],
3451 [with_librouteros="no (symbol 'ros_interface' not found)"])
3454 CPPFLAGS="$SAVE_CPPFLAGS"
3455 LDFLAGS="$SAVE_LDFLAGS"
3457 if test "x$with_librouteros" = "xyes"
3459 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3460 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3461 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3462 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3464 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3468 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3471 librrd_threadsafe="yes"
3472 librrd_rrdc_update="no"
3473 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3474 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3476 librrd_cflags="-I$withval/include"
3477 librrd_ldflags="-L$withval/lib"
3480 with_librrd="$withval"
3482 ], [with_librrd="yes"])
3483 if test "x$with_librrd" = "xyes"
3485 SAVE_CPPFLAGS="$CPPFLAGS"
3486 SAVE_LDFLAGS="$LDFLAGS"
3488 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3489 LDFLAGS="$LDFLAGS $librrd_ldflags"
3491 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3493 CPPFLAGS="$SAVE_CPPFLAGS"
3494 LDFLAGS="$SAVE_LDFLAGS"
3496 if test "x$with_librrd" = "xyes"
3498 SAVE_CPPFLAGS="$CPPFLAGS"
3499 SAVE_LDFLAGS="$LDFLAGS"
3501 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3502 LDFLAGS="$LDFLAGS $librrd_ldflags"
3504 AC_CHECK_LIB(rrd_th, rrd_update_r,
3506 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3508 [librrd_threadsafe="no"
3509 AC_CHECK_LIB(rrd, rrd_update,
3511 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3513 [with_librrd="no (symbol 'rrd_update' not found)"],
3518 if test "x$librrd_threadsafe" = "xyes"
3520 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3522 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3525 CPPFLAGS="$SAVE_CPPFLAGS"
3526 LDFLAGS="$SAVE_LDFLAGS"
3528 if test "x$with_librrd" = "xyes"
3530 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3531 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3532 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3533 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3535 if test "x$librrd_threadsafe" = "xyes"
3537 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3541 # --with-libsensors {{{
3542 with_sensors_cflags=""
3543 with_sensors_ldflags=""
3544 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3546 if test "x$withval" = "xno"
3548 with_libsensors="no"
3550 with_libsensors="yes"
3551 if test "x$withval" != "xyes"
3553 with_sensors_cflags="-I$withval/include"
3554 with_sensors_ldflags="-L$withval/lib"
3555 with_libsensors="yes"
3560 if test "x$ac_system" = "xLinux"
3562 with_libsensors="yes"
3564 with_libsensors="no (Linux only library)"
3567 if test "x$with_libsensors" = "xyes"
3569 SAVE_CPPFLAGS="$CPPFLAGS"
3570 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3572 # AC_CHECK_HEADERS(sensors/sensors.h,
3574 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3576 # [with_libsensors="no (sensors/sensors.h not found)"])
3577 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3579 CPPFLAGS="$SAVE_CPPFLAGS"
3581 if test "x$with_libsensors" = "xyes"
3583 SAVE_CPPFLAGS="$CPPFLAGS"
3584 SAVE_LDFLAGS="$LDFLAGS"
3585 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3586 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3588 AC_CHECK_LIB(sensors, sensors_init,
3590 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3592 [with_libsensors="no (libsensors not found)"])
3594 CPPFLAGS="$SAVE_CPPFLAGS"
3595 LDFLAGS="$SAVE_LDFLAGS"
3597 if test "x$with_libsensors" = "xyes"
3599 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3600 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3601 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3602 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3604 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3607 # --with-libstatgrab {{{
3608 with_libstatgrab_cflags=""
3609 with_libstatgrab_ldflags=""
3610 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3612 if test "x$withval" != "xno" \
3613 && test "x$withval" != "xyes"
3615 with_libstatgrab_cflags="-I$withval/include"
3616 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3617 with_libstatgrab="yes"
3618 with_libstatgrab_pkg_config="no"
3620 with_libstatgrab="$withval"
3621 with_libstatgrab_pkg_config="yes"
3625 with_libstatgrab="yes"
3626 with_libstatgrab_pkg_config="yes"
3629 if test "x$with_libstatgrab" = "xyes" \
3630 && test "x$with_libstatgrab_pkg_config" = "xyes"
3632 if test "x$PKG_CONFIG" != "x"
3634 AC_MSG_CHECKING([pkg-config for libstatgrab])
3636 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3639 with_libstatgrab_pkg_config="no"
3640 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3641 temp_result="not found"
3643 AC_MSG_RESULT([$temp_result])
3645 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3646 with_libstatgrab_pkg_config="no"
3647 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3651 if test "x$with_libstatgrab" = "xyes" \
3652 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3653 && test "x$with_libstatgrab_cflags" = "x"
3655 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3656 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3659 with_libstatgrab_cflags="$temp_result"
3661 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3662 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3664 AC_MSG_RESULT([$temp_result])
3667 if test "x$with_libstatgrab" = "xyes" \
3668 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3669 && test "x$with_libstatgrab_ldflags" = "x"
3671 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3672 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3675 with_libstatgrab_ldflags="$temp_result"
3677 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3678 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3680 AC_MSG_RESULT([$temp_result])
3683 if test "x$with_libstatgrab" = "xyes"
3685 SAVE_CPPFLAGS="$CPPFLAGS"
3686 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3688 AC_CHECK_HEADERS(statgrab.h,
3689 [with_libstatgrab="yes"],
3690 [with_libstatgrab="no (statgrab.h not found)"])
3692 CPPFLAGS="$SAVE_CPPFLAGS"
3695 if test "x$with_libstatgrab" = "xyes"
3697 SAVE_CFLAGS="$CFLAGS"
3698 SAVE_LDFLAGS="$LDFLAGS"
3700 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3701 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3703 AC_CHECK_LIB(statgrab, sg_init,
3704 [with_libstatgrab="yes"],
3705 [with_libstatgrab="no (symbol sg_init not found)"])
3707 CFLAGS="$SAVE_CFLAGS"
3708 LDFLAGS="$SAVE_LDFLAGS"
3711 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3712 if test "x$with_libstatgrab" = "xyes"
3714 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3715 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3716 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3717 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3718 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3722 # --with-libtokyotyrant {{{
3723 with_libtokyotyrant_cppflags=""
3724 with_libtokyotyrant_ldflags=""
3725 with_libtokyotyrant_libs=""
3726 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3728 if test "x$withval" = "xno"
3730 with_libtokyotyrant="no"
3731 else if test "x$withval" = "xyes"
3733 with_libtokyotyrant="yes"
3735 with_libtokyotyrant_cppflags="-I$withval/include"
3736 with_libtokyotyrant_ldflags="-L$withval/include"
3737 with_libtokyotyrant_libs="-ltokyotyrant"
3738 with_libtokyotyrant="yes"
3742 with_libtokyotyrant="yes"
3745 if test "x$with_libtokyotyrant" = "xyes"
3747 if $PKG_CONFIG --exists tokyotyrant
3749 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3750 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3751 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3755 SAVE_CPPFLAGS="$CPPFLAGS"
3756 SAVE_LDFLAGS="$LDFLAGS"
3757 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3758 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3760 if test "x$with_libtokyotyrant" = "xyes"
3762 AC_CHECK_HEADERS(tcrdb.h,
3764 AC_DEFINE(HAVE_TCRDB_H, 1,
3765 [Define to 1 if you have the <tcrdb.h> header file.])
3766 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3769 if test "x$with_libtokyotyrant" = "xyes"
3771 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3773 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3774 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3776 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3777 [$with_libtokyotyrant_libs])
3780 CPPFLAGS="$SAVE_CPPFLAGS"
3781 LDFLAGS="$SAVE_LDFLAGS"
3783 if test "x$with_libtokyotyrant" = "xyes"
3785 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3786 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3787 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3788 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3789 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3790 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3792 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3795 # --with-libupsclient {{{
3796 with_libupsclient_config=""
3797 with_libupsclient_cflags=""
3798 with_libupsclient_libs=""
3799 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3801 if test "x$withval" = "xno"
3803 with_libupsclient="no"
3804 else if test "x$withval" = "xyes"
3806 with_libupsclient="use_pkgconfig"
3808 if test -x "$withval"
3810 with_libupsclient_config="$withval"
3811 with_libupsclient="use_libupsclient_config"
3812 else if test -x "$withval/bin/libupsclient-config"
3814 with_libupsclient_config="$withval/bin/libupsclient-config"
3815 with_libupsclient="use_libupsclient_config"
3817 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3818 with_libupsclient_cflags="-I$withval/include"
3819 with_libupsclient_libs="-L$withval/lib -lupsclient"
3820 with_libupsclient="yes"
3824 [with_libupsclient="use_pkgconfig"])
3826 # configure using libupsclient-config
3827 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3829 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3830 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3833 with_libupsclient="no ($with_libupsclient_config failed)"
3835 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3838 with_libupsclient="no ($with_libupsclient_config failed)"
3841 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3843 with_libupsclient="yes"
3846 # configure using pkg-config
3847 if test "x$with_libupsclient" = "xuse_pkgconfig"
3849 if test "x$PKG_CONFIG" = "x"
3851 with_libupsclient="no (Don't have pkg-config)"
3854 if test "x$with_libupsclient" = "xuse_pkgconfig"
3856 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3857 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3860 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3863 if test "x$with_libupsclient" = "xuse_pkgconfig"
3865 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3868 with_libupsclient="no ($PKG_CONFIG failed)"
3870 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3873 with_libupsclient="no ($PKG_CONFIG failed)"
3876 if test "x$with_libupsclient" = "xuse_pkgconfig"
3878 with_libupsclient="yes"
3881 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3882 # the actual checks.
3883 if test "x$with_libupsclient" = "xyes"
3885 SAVE_CPPFLAGS="$CPPFLAGS"
3886 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3888 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3890 CPPFLAGS="$SAVE_CPPFLAGS"
3892 if test "x$with_libupsclient" = "xyes"
3894 SAVE_CPPFLAGS="$CPPFLAGS"
3895 SAVE_LDFLAGS="$LDFLAGS"
3897 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3898 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3900 AC_CHECK_LIB(upsclient, upscli_connect,
3901 [with_libupsclient="yes"],
3902 [with_libupsclient="no (symbol upscli_connect not found)"])
3904 CPPFLAGS="$SAVE_CPPFLAGS"
3905 LDFLAGS="$SAVE_LDFLAGS"
3907 if test "x$with_libupsclient" = "xyes"
3909 SAVE_CPPFLAGS="$CPPFLAGS"
3910 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3912 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3913 [#include <stdlib.h>
3915 #include <upsclient.h>])
3917 CPPFLAGS="$SAVE_CPPFLAGS"
3919 if test "x$with_libupsclient" = "xyes"
3921 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3922 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3923 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3924 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3928 # --with-libxmms {{{
3929 with_xmms_config="xmms-config"
3932 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3934 if test "x$withval" != "xno" \
3935 && test "x$withval" != "xyes"
3937 if test -f "$withval" && test -x "$withval";
3939 with_xmms_config="$withval"
3940 else if test -x "$withval/bin/xmms-config"
3942 with_xmms_config="$withval/bin/xmms-config"
3945 else if test "x$withval" = "xno"
3955 if test "x$with_libxmms" = "xyes"
3957 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3958 xmms_config_status=$?
3960 if test $xmms_config_status -ne 0
3965 if test "x$with_libxmms" = "xyes"
3967 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3968 xmms_config_status=$?
3970 if test $xmms_config_status -ne 0
3975 if test "x$with_libxmms" = "xyes"
3977 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3979 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3980 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3981 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3982 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3989 with_libxmms_numeric=0
3990 if test "x$with_libxmms" = "xyes"
3992 with_libxmms_numeric=1
3994 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3995 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3998 # --with-libyajl {{{
3999 with_libyajl_cppflags=""
4000 with_libyajl_ldflags=""
4001 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4003 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4005 with_libyajl_cppflags="-I$withval/include"
4006 with_libyajl_ldflags="-L$withval/lib"
4009 with_libyajl="$withval"
4015 if test "x$with_libyajl" = "xyes"
4017 SAVE_CPPFLAGS="$CPPFLAGS"
4018 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4020 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4021 AC_CHECK_HEADERS(yajl/yajl_version.h)
4023 CPPFLAGS="$SAVE_CPPFLAGS"
4025 if test "x$with_libyajl" = "xyes"
4027 SAVE_CPPFLAGS="$CPPFLAGS"
4028 SAVE_LDFLAGS="$LDFLAGS"
4029 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4030 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4032 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4034 CPPFLAGS="$SAVE_CPPFLAGS"
4035 LDFLAGS="$SAVE_LDFLAGS"
4037 if test "x$with_libyajl" = "xyes"
4039 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4040 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4041 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4042 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4043 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4044 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4045 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4047 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4050 # --with-libvarnish {{{
4051 with_libvarnish_cppflags=""
4052 with_libvarnish_cflags=""
4053 with_libvarnish_libs=""
4054 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4056 if test "x$withval" = "xno"
4058 with_libvarnish="no"
4059 else if test "x$withval" = "xyes"
4061 with_libvarnish="use_pkgconfig"
4062 else if test -d "$with_libvarnish/lib"
4064 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4065 with_libvarnish_cflags="-I$withval/include"
4066 with_libvarnish_libs="-L$withval/lib -lvarnish -lvarnishcompat -lvarnishapi"
4067 with_libvarnish="yes"
4070 [with_libvarnish="use_pkgconfig"])
4072 # configure using pkg-config
4073 if test "x$with_libvarnish" = "xuse_pkgconfig"
4075 if test "x$PKG_CONFIG" = "x"
4077 with_libvarnish="no (Don't have pkg-config)"
4080 if test "x$with_libvarnish" = "xuse_pkgconfig"
4082 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4083 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4086 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4089 if test "x$with_libvarnish" = "xuse_pkgconfig"
4091 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4094 with_libvarnish="no ($PKG_CONFIG failed)"
4096 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4099 with_libvarnish="no ($PKG_CONFIG failed)"
4102 if test "x$with_libvarnish" = "xuse_pkgconfig"
4104 with_libvarnish="yes"
4107 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4108 # the actual checks.
4109 if test "x$with_libvarnish" = "xyes"
4111 SAVE_CPPFLAGS="$CPPFLAGS"
4112 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4113 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4115 CPPFLAGS="$SAVE_CPPFLAGS"
4117 if test "x$with_libvarnish" = "xyes"
4119 SAVE_CPPFLAGS="$CPPFLAGS"
4120 #SAVE_LDFLAGS="$LDFLAGS"
4122 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4123 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4125 AC_CHECK_HEADERS(varnish/vsc.h,
4126 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4127 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4129 CPPFLAGS="$SAVE_CPPFLAGS"
4130 #LDFLAGS="$SAVE_LDFLAGS"
4132 if test "x$with_libvarnish" = "xyes"
4134 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4135 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4136 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4137 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4141 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4142 with_libxml2="no (pkg-config isn't available)"
4143 with_libxml2_cflags=""
4144 with_libxml2_ldflags=""
4145 with_libvirt="no (pkg-config isn't available)"
4146 with_libvirt_cflags=""
4147 with_libvirt_ldflags=""
4148 if test "x$PKG_CONFIG" != "x"
4150 pkg-config --exists 'libxml-2.0' 2>/dev/null
4155 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4158 pkg-config --exists libvirt 2>/dev/null
4163 with_libvirt="no (pkg-config doesn't know libvirt)"
4166 if test "x$with_libxml2" = "xyes"
4168 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4173 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4179 if test "x$with_libxml2" = "xyes"
4181 SAVE_CPPFLAGS="$CPPFLAGS"
4182 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4184 AC_CHECK_HEADERS(libxml/parser.h, [],
4185 [with_libxml2="no (libxml/parser.h not found)"])
4187 CPPFLAGS="$SAVE_CPPFLAGS"
4189 if test "x$with_libxml2" = "xyes"
4191 SAVE_CFLAGS="$CFLAGS"
4192 SAVE_LDFLAGS="$LDFLAGS"
4194 CFLAGS="$CFLAGS $with_libxml2_cflags"
4195 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4197 AC_CHECK_LIB(xml2, xmlXPathEval,
4198 [with_libxml2="yes"],
4199 [with_libxml2="no (symbol xmlXPathEval not found)"])
4201 CFLAGS="$SAVE_CFLAGS"
4202 LDFLAGS="$SAVE_LDFLAGS"
4204 dnl Add the right compiler flags and libraries.
4205 if test "x$with_libxml2" = "xyes"; then
4206 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4207 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4208 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4209 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4211 if test "x$with_libvirt" = "xyes"
4213 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4218 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4224 if test "x$with_libvirt" = "xyes"
4226 SAVE_CPPFLAGS="$CPPFLAGS"
4227 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4229 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4230 [with_libvirt="no (libvirt/libvirt.h not found)"])
4232 CPPFLAGS="$SAVE_CPPFLAGS"
4234 if test "x$with_libvirt" = "xyes"
4236 SAVE_CFLAGS="$CFLAGS"
4237 SAVE_LDFLAGS="$LDFLAGS"
4239 CFLAGS="$CFLAGS $with_libvirt_cflags"
4240 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4242 AC_CHECK_LIB(virt, virDomainBlockStats,
4243 [with_libvirt="yes"],
4244 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4246 CFLAGS="$SAVE_CFLAGS"
4247 LDFLAGS="$SAVE_LDFLAGS"
4249 dnl Add the right compiler flags and libraries.
4250 if test "x$with_libvirt" = "xyes"; then
4251 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4252 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4253 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4254 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4258 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4259 with_libopenipmipthread="yes"
4260 with_libopenipmipthread_cflags=""
4261 with_libopenipmipthread_libs=""
4263 AC_MSG_CHECKING([for pkg-config])
4265 if test "x$PKG_CONFIG" = "x"
4267 with_libopenipmipthread="no"
4270 temp_result="$PKG_CONFIG"
4272 AC_MSG_RESULT([$temp_result])
4274 if test "x$with_libopenipmipthread" = "xyes"
4276 AC_MSG_CHECKING([for libOpenIPMIpthread])
4277 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4280 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4282 AC_MSG_RESULT([$with_libopenipmipthread])
4285 if test "x$with_libopenipmipthread" = "xyes"
4287 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4288 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4291 with_libopenipmipthread_cflags="$temp_result"
4293 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4294 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4296 AC_MSG_RESULT([$temp_result])
4299 if test "x$with_libopenipmipthread" = "xyes"
4301 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4302 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4305 with_libopenipmipthread_ldflags="$temp_result"
4307 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4308 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4310 AC_MSG_RESULT([$temp_result])
4313 if test "x$with_libopenipmipthread" = "xyes"
4315 SAVE_CPPFLAGS="$CPPFLAGS"
4316 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4318 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4319 [with_libopenipmipthread="yes"],
4320 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4321 [#include <OpenIPMI/ipmiif.h>
4322 #include <OpenIPMI/ipmi_err.h>
4323 #include <OpenIPMI/ipmi_posix.h>
4324 #include <OpenIPMI/ipmi_conn.h>
4327 CPPFLAGS="$SAVE_CPPFLAGS"
4330 if test "x$with_libopenipmipthread" = "xyes"
4332 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4333 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4334 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4335 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4339 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4340 [with_libnotify="yes"],
4341 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4344 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4347 # Check for enabled/disabled features
4350 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4351 # ------------------------------------------------------------
4353 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4358 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4363 m4_define([EnDis],[disabled])dnl
4364 m4_define([YesNo],[no])dnl
4370 m4_define([EnDis],[enabled])dnl
4371 m4_define([YesNo],[yes])dnl
4374 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4378 m4_if([$3], [feature], [],
4382 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4388 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4390 enable_$1='[YesNo]'dnl
4392 if test "x$enable_$1" = "xno"
4396 if test "x$enable_$1" = "xyes"
4400 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4405 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4406 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4408 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4410 # AC_PLUGIN(name, default, info)
4411 # ------------------------------------------------------------
4418 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4420 if test "x$enableval" = "xyes"
4423 else if test "x$enableval" = "xforce"
4428 enable_plugin="no (disabled on command line)"
4432 if test "x$enable_all_plugins" = "xauto"
4434 if test "x$2" = "xyes"
4441 enable_plugin="$enable_all_plugins"
4444 if test "x$enable_plugin" = "xyes"
4446 if test "x$2" = "xyes" || test "x$force" = "xyes"
4448 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4449 if test "x$2" != "xyes"
4451 dependency_warning="yes"
4453 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4454 dependency_error="yes"
4455 enable_plugin="no (dependency error)"
4458 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4459 enable_$1="$enable_plugin"
4461 )# AC_PLUGIN(name, default, info)
4463 m4_divert_once([HELP_ENABLE], [
4464 collectd features:])
4465 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4466 AC_COLLECTD([debug], [enable], [feature], [debugging])
4467 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4468 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4470 dependency_warning="no"
4471 dependency_error="no"
4476 plugin_conntrack="no"
4477 plugin_contextswitch="no"
4480 plugin_curl_json="no"
4481 plugin_curl_xml="no"
4487 plugin_interface="no"
4494 plugin_multimeter="no"
4498 plugin_processes="no"
4499 plugin_protocols="no"
4503 plugin_tcpconns="no"
4510 plugin_wireless="no"
4514 if test "x$ac_system" = "xLinux"
4516 plugin_battery="yes"
4517 plugin_conntrack="yes"
4518 plugin_contextswitch="yes"
4520 plugin_cpufreq="yes"
4522 plugin_entropy="yes"
4523 plugin_fscache="yes"
4524 plugin_interface="yes"
4530 plugin_processes="yes"
4531 plugin_protocols="yes"
4534 plugin_tcpconns="yes"
4535 plugin_thermal="yes"
4538 plugin_vserver="yes"
4539 plugin_wireless="yes"
4541 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4547 if test "x$ac_system" = "xOpenBSD"
4549 plugin_tcpconns="yes"
4553 if test "x$with_libiokit" = "xyes"
4555 plugin_battery="yes"
4561 if test "x$ac_system" = "xAIX"
4563 plugin_tcpconns="yes"
4566 if test "x$with_perfstat" = "xyes"
4572 plugin_interface="yes"
4576 if test "x$with_procinfo" = "xyes"
4578 plugin_processes="yes"
4582 if test "x$with_kstat" = "xyes"
4586 plugin_zfs_arc="yes"
4589 if test "x$with_devinfo$with_kstat" = "xyesyes"
4593 plugin_interface="yes"
4599 if test "x$with_libstatgrab" = "xyes"
4603 plugin_interface="yes"
4610 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4613 if test "x$have_strptime" = "xyes"
4619 if test "x$with_libopenipmipthread" = "xyes"
4624 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4626 plugin_curl_json="yes"
4629 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4631 plugin_curl_xml="yes"
4634 if test "x$have_processor_info" = "xyes"
4638 if test "x$have_sysctl" = "xyes"
4643 if test "x$ac_system" = "xDarwin"
4648 if test "x$have_sysctlbyname" = "xyes"
4650 plugin_contextswitch="yes"
4653 plugin_tcpconns="yes"
4656 # Df plugin: Check if we know how to determine mount points first.
4657 #if test "x$have_listmntent" = "xyes"; then
4660 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4664 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4668 #if test "x$have_getmntent" = "xseq"
4672 if test "x$c_cv_have_one_getmntent" = "xyes"
4677 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4678 if test "x$plugin_df" = "xyes"
4681 if test "x$have_statfs" = "xyes"
4685 if test "x$have_statvfs" = "xyes"
4691 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
4693 plugin_ethstat="yes"
4696 if test "x$have_getifaddrs" = "xyes"
4698 plugin_interface="yes"
4701 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4703 plugin_libvirt="yes"
4706 if test "x$have_getloadavg" = "xyes"
4711 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4716 # Mac OS X memory interface
4717 if test "x$have_host_statistics" = "xyes"
4722 if test "x$have_termios_h" = "xyes"
4724 plugin_multimeter="yes"
4728 if test "x$have_thread_info" = "xyes"
4730 plugin_processes="yes"
4733 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4735 plugin_processes="yes"
4738 if test "x$with_kvm_getswapinfo" = "xyes"
4743 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4748 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4750 plugin_tcpconns="yes"
4753 if test "x$have_getutent" = "xyes"
4757 if test "x$have_getutxent" = "xyes"
4762 m4_divert_once([HELP_ENABLE], [
4765 AC_ARG_ENABLE([all-plugins],
4766 AC_HELP_STRING([--enable-all-plugins],
4767 [enable all plugins (auto by def)]),
4769 if test "x$enableval" = "xyes"
4771 enable_all_plugins="yes"
4772 else if test "x$enableval" = "xauto"
4774 enable_all_plugins="auto"
4776 enable_all_plugins="no"
4779 [enable_all_plugins="auto"])
4781 m4_divert_once([HELP_ENABLE], [])
4783 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4784 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4785 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4786 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4787 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4788 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4789 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4790 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4791 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4792 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4793 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4794 AC_PLUGIN([csv], [yes], [CSV output plugin])
4795 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4796 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4797 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4798 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4799 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4800 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4801 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4802 AC_PLUGIN([email], [yes], [EMail statistics])
4803 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4804 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
4805 AC_PLUGIN([exec], [yes], [Execution of external programs])
4806 AC_PLUGIN([filecount], [yes], [Count files in directories])
4807 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4808 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4809 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4810 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4811 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4812 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4813 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4814 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4815 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4816 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4817 AC_PLUGIN([load], [$plugin_load], [System load])
4818 AC_PLUGIN([logfile], [yes], [File logging plugin])
4819 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4820 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4821 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4822 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4823 AC_PLUGIN([match_regex], [yes], [The regex match])
4824 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4825 AC_PLUGIN([match_value], [yes], [The value match])
4826 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4827 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
4828 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4829 AC_PLUGIN([memcached], [yes], [memcached statistics])
4830 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4831 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4832 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4833 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4834 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4835 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4836 AC_PLUGIN([network], [yes], [Network communication plugin])
4837 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4838 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4839 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4840 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4841 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4842 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
4843 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4844 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4845 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4846 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4847 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4848 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4849 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
4850 # FIXME: Check for libevent, too.
4851 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4852 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4853 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4854 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4855 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4856 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4857 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4858 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
4859 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4860 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4861 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4862 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4863 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4864 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4865 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4866 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4867 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4868 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4869 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4870 AC_PLUGIN([target_notification], [yes], [The notification target])
4871 AC_PLUGIN([target_replace], [yes], [The replace target])
4872 AC_PLUGIN([target_scale],[yes], [The scale target])
4873 AC_PLUGIN([target_set], [yes], [The set target])
4874 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
4875 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4876 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4877 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4878 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4879 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
4880 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4881 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4882 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4883 AC_PLUGIN([users], [$plugin_users], [User statistics])
4884 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4885 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
4886 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4887 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4888 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4889 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
4890 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4891 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
4892 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
4893 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4894 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4896 dnl Default configuration file
4897 # Load either syslog or logfile
4898 LOAD_PLUGIN_SYSLOG=""
4899 LOAD_PLUGIN_LOGFILE=""
4901 AC_MSG_CHECKING([which default log plugin to load])
4902 default_log_plugin="none"
4903 if test "x$enable_syslog" = "xyes"
4905 default_log_plugin="syslog"
4907 LOAD_PLUGIN_SYSLOG="##"
4910 if test "x$enable_logfile" = "xyes"
4912 if test "x$default_log_plugin" = "xnone"
4914 default_log_plugin="logfile"
4916 LOAD_PLUGIN_LOGFILE="#"
4919 LOAD_PLUGIN_LOGFILE="##"
4921 AC_MSG_RESULT([$default_log_plugin])
4923 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4924 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4926 DEFAULT_LOG_LEVEL="info"
4927 if test "x$enable_debug" = "xyes"
4929 DEFAULT_LOG_LEVEL="debug"
4931 AC_SUBST(DEFAULT_LOG_LEVEL)
4933 # Load only one of rrdtool, network, csv in the default config.
4934 LOAD_PLUGIN_RRDTOOL=""
4935 LOAD_PLUGIN_NETWORK=""
4938 AC_MSG_CHECKING([which default write plugin to load])
4939 default_write_plugin="none"
4940 if test "x$enable_rrdtool" = "xyes"
4942 default_write_plugin="rrdtool"
4944 LOAD_PLUGIN_RRDTOOL="##"
4947 if test "x$enable_network" = "xyes"
4949 if test "x$default_write_plugin" = "xnone"
4951 default_write_plugin="network"
4953 LOAD_PLUGIN_NETWORK="#"
4956 LOAD_PLUGIN_NETWORK="##"
4959 if test "x$enable_csv" = "xyes"
4961 if test "x$default_write_plugin" = "xnone"
4963 default_write_plugin="csv"
4968 LOAD_PLUGIN_CSV="##"
4970 AC_MSG_RESULT([$default_write_plugin])
4972 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4973 AC_SUBST(LOAD_PLUGIN_NETWORK)
4974 AC_SUBST(LOAD_PLUGIN_CSV)
4977 if test "x$ac_system" = "xLinux" \
4978 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
4980 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4983 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
4985 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
4989 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4991 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4993 PERL_BINDINGS_OPTIONS="$withval"
4994 with_perl_bindings="yes"
4996 PERL_BINDINGS_OPTIONS=""
4997 with_perl_bindings="$withval"
5001 PERL_BINDINGS_OPTIONS=""
5002 if test -n "$perl_interpreter"
5004 with_perl_bindings="yes"
5006 with_perl_bindings="no (no perl interpreter found)"
5009 if test "x$with_perl_bindings" = "xyes"
5011 PERL_BINDINGS="perl"
5015 AC_SUBST(PERL_BINDINGS)
5016 AC_SUBST(PERL_BINDINGS_OPTIONS)
5018 dnl libcollectdclient
5019 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5020 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5021 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5023 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5025 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5027 AC_SUBST(LCC_VERSION_MAJOR)
5028 AC_SUBST(LCC_VERSION_MINOR)
5029 AC_SUBST(LCC_VERSION_PATCH)
5030 AC_SUBST(LCC_VERSION_EXTRA)
5031 AC_SUBST(LCC_VERSION_STRING)
5033 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
5035 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
5037 if test "x$with_librrd" = "xyes" \
5038 && test "x$librrd_threadsafe" != "xyes"
5040 with_librrd="yes (warning: librrd is not thread-safe)"
5043 if test "x$with_libperl" = "xyes"
5045 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5047 enable_perl="no (needs libperl)"
5050 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5052 enable_perl="no (libperl doesn't support ithreads)"
5055 if test "x$with_perl_bindings" = "xyes" \
5056 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5058 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5065 libcurl . . . . . . . $with_libcurl
5066 libdbi . . . . . . . $with_libdbi
5067 libcredis . . . . . . $with_libcredis
5068 libesmtp . . . . . . $with_libesmtp
5069 libganglia . . . . . $with_libganglia
5070 libgcrypt . . . . . . $with_libgcrypt
5071 libiokit . . . . . . $with_libiokit
5072 libiptc . . . . . . . $with_libiptc
5073 libjvm . . . . . . . $with_java
5074 libkstat . . . . . . $with_kstat
5075 libkvm . . . . . . . $with_libkvm
5076 libmemcached . . . . $with_libmemcached
5077 libmodbus . . . . . . $with_libmodbus
5078 libmysql . . . . . . $with_libmysql
5079 libnetapp . . . . . . $with_libnetapp
5080 libnetlink . . . . . $with_libnetlink
5081 libnetsnmp . . . . . $with_libnetsnmp
5082 libnotify . . . . . . $with_libnotify
5083 liboconfig . . . . . $with_liboconfig
5084 libopenipmi . . . . . $with_libopenipmipthread
5085 liboping . . . . . . $with_liboping
5086 libpcap . . . . . . . $with_libpcap
5087 libperfstat . . . . . $with_perfstat
5088 libperl . . . . . . . $with_libperl
5089 libpq . . . . . . . . $with_libpq
5090 libpthread . . . . . $with_libpthread
5091 librabbitmq . . . . . $with_librabbitmq
5092 librouteros . . . . . $with_librouteros
5093 librrd . . . . . . . $with_librrd
5094 libsensors . . . . . $with_libsensors
5095 libstatgrab . . . . . $with_libstatgrab
5096 libtokyotyrant . . . $with_libtokyotyrant
5097 libupsclient . . . . $with_libupsclient
5098 libvarnish . . . . . $with_libvarnish
5099 libvirt . . . . . . . $with_libvirt
5100 libxml2 . . . . . . . $with_libxml2
5101 libxmms . . . . . . . $with_libxmms
5102 libyajl . . . . . . . $with_libyajl
5103 libevent . . . . . . $with_libevent
5104 protobuf-c . . . . . $have_protoc_c
5105 oracle . . . . . . . $with_oracle
5106 python . . . . . . . $with_python
5109 daemon mode . . . . . $enable_daemon
5110 debug . . . . . . . . $enable_debug
5113 perl . . . . . . . . $with_perl_bindings
5116 amqp . . . . . . . $enable_amqp
5117 apache . . . . . . . $enable_apache
5118 apcups . . . . . . . $enable_apcups
5119 apple_sensors . . . . $enable_apple_sensors
5120 ascent . . . . . . . $enable_ascent
5121 battery . . . . . . . $enable_battery
5122 bind . . . . . . . . $enable_bind
5123 conntrack . . . . . . $enable_conntrack
5124 contextswitch . . . . $enable_contextswitch
5125 cpu . . . . . . . . . $enable_cpu
5126 cpufreq . . . . . . . $enable_cpufreq
5127 csv . . . . . . . . . $enable_csv
5128 curl . . . . . . . . $enable_curl
5129 curl_json . . . . . . $enable_curl_json
5130 curl_xml . . . . . . $enable_curl_xml
5131 dbi . . . . . . . . . $enable_dbi
5132 df . . . . . . . . . $enable_df
5133 disk . . . . . . . . $enable_disk
5134 dns . . . . . . . . . $enable_dns
5135 email . . . . . . . . $enable_email
5136 entropy . . . . . . . $enable_entropy
5137 ethstat . . . . . . . $enable_ethstat
5138 exec . . . . . . . . $enable_exec
5139 filecount . . . . . . $enable_filecount
5140 fscache . . . . . . . $enable_fscache
5141 gmond . . . . . . . . $enable_gmond
5142 hddtemp . . . . . . . $enable_hddtemp
5143 interface . . . . . . $enable_interface
5144 ipmi . . . . . . . . $enable_ipmi
5145 iptables . . . . . . $enable_iptables
5146 ipvs . . . . . . . . $enable_ipvs
5147 irq . . . . . . . . . $enable_irq
5148 java . . . . . . . . $enable_java
5149 libvirt . . . . . . . $enable_libvirt
5150 load . . . . . . . . $enable_load
5151 logfile . . . . . . . $enable_logfile
5152 lpar... . . . . . . . $enable_lpar
5153 madwifi . . . . . . . $enable_madwifi
5154 match_empty_counter . $enable_match_empty_counter
5155 match_hashed . . . . $enable_match_hashed
5156 match_regex . . . . . $enable_match_regex
5157 match_timediff . . . $enable_match_timediff
5158 match_value . . . . . $enable_match_value
5159 mbmon . . . . . . . . $enable_mbmon
5160 md . . . . . . . . . $enable_md
5161 memcachec . . . . . . $enable_memcachec
5162 memcached . . . . . . $enable_memcached
5163 memory . . . . . . . $enable_memory
5164 modbus . . . . . . . $enable_modbus
5165 multimeter . . . . . $enable_multimeter
5166 mysql . . . . . . . . $enable_mysql
5167 netapp . . . . . . . $enable_netapp
5168 netlink . . . . . . . $enable_netlink
5169 network . . . . . . . $enable_network
5170 nfs . . . . . . . . . $enable_nfs
5171 nginx . . . . . . . . $enable_nginx
5172 notify_desktop . . . $enable_notify_desktop
5173 notify_email . . . . $enable_notify_email
5174 ntpd . . . . . . . . $enable_ntpd
5175 numa . . . . . . . . $enable_numa
5176 nut . . . . . . . . . $enable_nut
5177 olsrd . . . . . . . . $enable_olsrd
5178 onewire . . . . . . . $enable_onewire
5179 openvpn . . . . . . . $enable_openvpn
5180 oracle . . . . . . . $enable_oracle
5181 perl . . . . . . . . $enable_perl
5182 pf . . . . . . . . . $enable_pf
5183 pinba . . . . . . . . $enable_pinba
5184 ping . . . . . . . . $enable_ping
5185 postgresql . . . . . $enable_postgresql
5186 powerdns . . . . . . $enable_powerdns
5187 processes . . . . . . $enable_processes
5188 protocols . . . . . . $enable_protocols
5189 python . . . . . . . $enable_python
5190 redis . . . . . . . . $enable_redis
5191 routeros . . . . . . $enable_routeros
5192 rrdcached . . . . . . $enable_rrdcached
5193 rrdtool . . . . . . . $enable_rrdtool
5194 sensors . . . . . . . $enable_sensors
5195 serial . . . . . . . $enable_serial
5196 snmp . . . . . . . . $enable_snmp
5197 swap . . . . . . . . $enable_swap
5198 syslog . . . . . . . $enable_syslog
5199 table . . . . . . . . $enable_table
5200 tail . . . . . . . . $enable_tail
5201 tape . . . . . . . . $enable_tape
5202 target_notification . $enable_target_notification
5203 target_replace . . . $enable_target_replace
5204 target_scale . . . . $enable_target_scale
5205 target_set . . . . . $enable_target_set
5206 target_v5upgrade . . $enable_target_v5upgrade
5207 tcpconns . . . . . . $enable_tcpconns
5208 teamspeak2 . . . . . $enable_teamspeak2
5209 ted . . . . . . . . . $enable_ted
5210 thermal . . . . . . . $enable_thermal
5211 threshold . . . . . . $enable_threshold
5212 tokyotyrant . . . . . $enable_tokyotyrant
5213 unixsock . . . . . . $enable_unixsock
5214 uptime . . . . . . . $enable_uptime
5215 users . . . . . . . . $enable_users
5216 uuid . . . . . . . . $enable_uuid
5217 varnish . . . . . . . $enable_varnish
5218 vmem . . . . . . . . $enable_vmem
5219 vserver . . . . . . . $enable_vserver
5220 wireless . . . . . . $enable_wireless
5221 write_graphite . . . $enable_write_graphite
5222 write_http . . . . . $enable_write_http
5223 write_redis . . . . . $enable_write_redis
5224 write_mongodb . . . . $enable_write_mongodb
5225 xmms . . . . . . . . $enable_xmms
5226 zfs_arc . . . . . . . $enable_zfs_arc
5230 if test "x$dependency_error" = "xyes"; then
5231 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5234 if test "x$dependency_warning" = "xyes"; then
5235 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5238 # vim: set fdm=marker :