1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, [m4_esyscmd(./version-gen.sh)])
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AC_CONFIG_AUX_DIR([libltdl/config])
7 m4_ifdef([LT_PACKAGE_VERSION],
10 LT_CONFIG_LTDL_DIR([libltdl])
12 LTDL_INIT([convenience])
13 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
18 AC_LIBLTDL_CONVENIENCE
22 AC_CONFIG_SUBDIRS(libltdl)
23 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
27 AM_INIT_AUTOMAKE([tar-pax dist-bzip2])
30 AC_PREFIX_DEFAULT("/opt/collectd")
35 # Checks for programs.
43 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
51 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
52 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
54 AC_MSG_CHECKING([for kernel type ($host_os)])
57 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
61 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
71 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
77 AC_MSG_RESULT([$ac_system])
79 if test "x$ac_system" = "xLinux"
81 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
82 if test -z "$KERNEL_DIR"
84 KERNEL_DIR="/lib/modules/`uname -r`/source"
87 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
88 AC_SUBST(KERNEL_CFLAGS)
91 if test "x$ac_system" = "xSolaris"
93 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
94 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
96 if test "x$ac_system" = "xAIX"
98 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
101 # Where to install .pc files.
102 pkgconfigdir="${libdir}/pkgconfig"
103 AC_SUBST(pkgconfigdir)
105 # Check for standards compliance mode
106 AC_ARG_ENABLE(standards,
107 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
108 [enable_standards="$enableval"],
109 [enable_standards="no"])
110 if test "x$enable_standards" = "xyes"
112 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
113 AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
114 AC_DEFINE(_XOPEN_SOURCE, 700, [Define to enforce X/Open 7 (XSI) compliance.])
115 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
116 if test "x$GCC" = "xyes"
118 CFLAGS="$CFLAGS -std=c99"
121 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
124 # Checks for header files.
131 AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h fnmatch.h libgen.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)
273 # For the battery plugin
274 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
276 #if HAVE_IOKIT_IOKITLIB_H
277 # include <IOKit/IOKitLib.h>
279 #if HAVE_IOKIT_IOTYPES_H
280 # include <IOKit/IOTypes.h>
286 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
289 # include <sys/types.h>
292 # include <sys/param.h>
296 AC_MSG_CHECKING([for sysctl kern.cp_times])
297 if test -x /sbin/sysctl
299 /sbin/sysctl kern.cp_times 2>/dev/null
303 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
304 [Define if sysctl supports kern.cp_times])
313 AC_CHECK_HEADERS(linux/major.h)
315 # For md module (Linux only)
316 if test "x$ac_system" = "xLinux"
318 AC_CHECK_HEADERS(linux/raid/md_u.h,
319 [have_linux_raid_md_u_h="yes"],
320 [have_linux_raid_md_u_h="no"],
322 #include <sys/ioctl.h>
323 #include <linux/major.h>
324 #include <linux/types.h>
327 have_linux_raid_md_u_h="no"
330 # For the swap module
331 have_linux_wireless_h="no"
332 if test "x$ac_system" = "xLinux"
334 AC_CHECK_HEADERS(linux/wireless.h,
335 [have_linux_wireless_h="yes"],
336 [have_linux_wireless_h="no"],
339 #include <sys/ioctl.h>
340 #include <sys/socket.h>
344 # For the swap module
345 have_sys_swap_h="yes"
346 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
348 #undef _FILE_OFFSET_BITS
349 #undef _LARGEFILE64_SOURCE
351 # include <sys/types.h>
354 # include <sys/param.h>
358 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
361 if test "x$GCC" = "xyes"
363 hint_64="CFLAGS='-m64'"
365 hint_64="CFLAGS='-xarch=v9'"
367 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
371 # For the processes plugin
373 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
375 # For interface plugin
376 AC_CHECK_HEADERS(ifaddrs.h)
377 AC_CHECK_HEADERS(net/if.h, [], [],
380 # include <sys/types.h>
382 #if HAVE_SYS_SOCKET_H
383 # include <sys/socket.h>
386 AC_CHECK_HEADERS(linux/if.h, [], [],
389 # include <sys/types.h>
391 #if HAVE_SYS_SOCKET_H
392 # include <sys/socket.h>
395 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
398 # include <sys/types.h>
400 #if HAVE_SYS_SOCKET_H
401 # include <sys/socket.h>
404 # include <linux/if.h>
409 AC_CHECK_HEADERS(linux/sockios.h,
410 [have_linux_sockios_h="yes"],
411 [have_linux_sockios_h="no"],
414 # include <sys/ioctl.h>
420 AC_CHECK_HEADERS(linux/ethtool.h,
421 [have_linux_ethtool_h="yes"],
422 [have_linux_ethtool_h="no"],
425 # include <sys/ioctl.h>
430 #if HAVE_LINUX_SOCKIOS_H
431 # include <linux/sockios.h>
436 have_linux_ip_vs_h="no"
437 have_net_ip_vs_h="no"
439 ip_vs_h_needs_kernel_cflags="no"
440 if test "x$ac_system" = "xLinux"
442 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
443 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
444 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
446 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
448 SAVE_CFLAGS="$CFLAGS"
449 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
451 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
453 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
454 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
455 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
457 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
459 ip_vs_h_needs_kernel_cflags="yes"
462 CFLAGS="$SAVE_CFLAGS"
465 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
468 AC_CHECK_HEADERS(sys/ucred.h, [], [],
471 # include <sys/types.h>
474 # include <sys/param.h>
478 # For mount interface
479 AC_CHECK_HEADERS(sys/mount.h, [], [],
482 # include <sys/types.h>
485 # include <sys/param.h>
489 # For the email plugin
490 AC_CHECK_HEADERS(linux/un.h, [], [],
492 #if HAVE_SYS_SOCKET_H
493 # include <sys/socket.h>
497 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)
500 AC_CHECK_HEADERS(arpa/nameser.h)
501 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
503 #if HAVE_ARPA_NAMESER_H
504 # include <arpa/nameser.h>
508 AC_CHECK_HEADERS(net/if_arp.h, [], [],
509 [#if HAVE_SYS_SOCKET_H
510 # include <sys/socket.h>
513 AC_CHECK_HEADERS(net/ppp_defs.h)
514 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
515 [#if HAVE_NET_PPP_DEFS_H
516 # include <net/ppp_defs.h>
519 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
524 # include <sys/types.h>
526 #if HAVE_SYS_SOCKET_H
527 # include <sys/socket.h>
532 #if HAVE_NETINET_IN_H
533 # include <netinet/in.h>
537 AC_CHECK_HEADERS(netinet/ip_compat.h)
539 have_net_pfvar_h="no"
540 AC_CHECK_HEADERS(net/pfvar.h,
541 [have_net_pfvar_h="yes"],
542 [have_net_pfvar_h="no"],
545 # include <sys/ioctl.h>
547 #if HAVE_SYS_SOCKET_H
548 # include <sys/socket.h>
555 # For the multimeter plugin
557 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
560 # Checks for typedefs, structures, and compiler characteristics.
569 # Checks for library functions.
571 AC_PROG_GCC_TRADITIONAL
572 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
576 SAVE_CFLAGS="$CFLAGS"
577 # Emulate behavior of src/Makefile.am
578 if test "x$GCC" = "xyes"
580 CFLAGS="$CFLAGS -Wall -Werror"
583 AC_CACHE_CHECK([for strtok_r],
584 [c_cv_have_strtok_r_default],
593 char buffer[] = "foo,bar,baz";
600 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
603 printf ("token = %s;\n", token);
606 [c_cv_have_strtok_r_default="yes"],
607 [c_cv_have_strtok_r_default="no"]
611 if test "x$c_cv_have_strtok_r_default" = "xno"
613 CFLAGS="$CFLAGS -D_REENTRANT=1"
615 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
616 [c_cv_have_strtok_r_reentrant],
625 char buffer[] = "foo,bar,baz";
632 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
635 printf ("token = %s;\n", token);
638 [c_cv_have_strtok_r_reentrant="yes"],
639 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
644 CFLAGS="$SAVE_CFLAGS"
645 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
647 CFLAGS="$CFLAGS -D_REENTRANT=1"
650 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
652 socket_needs_socket="no"
653 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
654 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
656 clock_gettime_needs_rt="no"
657 clock_gettime_needs_posix4="no"
658 have_clock_gettime="no"
659 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
660 if test "x$have_clock_gettime" = "xno"
662 AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
663 have_clock_gettime="yes"])
665 if test "x$have_clock_gettime" = "xno"
667 AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
668 have_clock_gettime="yes"])
670 if test "x$have_clock_gettime" = "xyes"
672 AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
674 AC_MSG_WARN(cannot find clock_gettime)
677 nanosleep_needs_rt="no"
678 nanosleep_needs_posix4="no"
679 AC_CHECK_FUNCS(nanosleep,
681 AC_CHECK_LIB(rt, nanosleep,
682 [nanosleep_needs_rt="yes"],
683 AC_CHECK_LIB(posix4, nanosleep,
684 [nanosleep_needs_posix4="yes"],
685 AC_MSG_ERROR(cannot find nanosleep))))
687 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
688 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
690 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
691 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
692 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
693 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
694 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
695 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
696 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
697 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
698 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
699 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
700 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
701 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
703 # Check for strptime {{{
704 if test "x$GCC" = "xyes"
706 SAVE_CFLAGS="$CFLAGS"
707 CFLAGS="$CFLAGS -Wall -Wextra -Werror"
710 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
711 if test "x$have_strptime" = "xyes"
713 AC_CACHE_CHECK([whether strptime is exported by default],
714 [c_cv_have_strptime_default],
723 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
725 [c_cv_have_strptime_default="yes"],
726 [c_cv_have_strptime_default="no"]))
728 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
730 AC_CACHE_CHECK([whether strptime needs standards mode],
731 [c_cv_have_strptime_standards],
735 #ifndef _ISOC99_SOURCE
736 # define _ISOC99_SOURCE 1
738 #ifndef _POSIX_C_SOURCE
739 # define _POSIX_C_SOURCE 200112L
741 #ifndef _XOPEN_SOURCE
742 # define _XOPEN_SOURCE 500
749 (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
751 [c_cv_have_strptime_standards="yes"],
752 [c_cv_have_strptime_standards="no"]))
754 if test "x$c_cv_have_strptime_standards" = "xyes"
756 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
762 if test "x$GCC" = "xyes"
764 CFLAGS="$SAVE_CFLAGS"
767 # }}} Check for strptime
769 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
770 if test "x$have_swapctl" = "xyes"; then
771 AC_CACHE_CHECK([whether swapctl takes two arguments],
772 [c_cv_have_swapctl_two_args],
774 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
775 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
776 # undef _FILE_OFFSET_BITS
777 # undef _LARGEFILE64_SOURCE
779 #include <sys/stat.h>
780 #include <sys/swap.h>]],
782 int num = swapctl(0, NULL);
785 [c_cv_have_swapctl_two_args="yes"],
786 [c_cv_have_swapctl_two_args="no"]
789 AC_CACHE_CHECK([whether swapctl takes three arguments],
790 [c_cv_have_swapctl_three_args],
792 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
793 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
794 # undef _FILE_OFFSET_BITS
795 # undef _LARGEFILE64_SOURCE
797 #include <sys/stat.h>
798 #include <sys/swap.h>]],
800 int num = swapctl(0, NULL,0);
803 [c_cv_have_swapctl_three_args="yes"],
804 [c_cv_have_swapctl_three_args="no"]
808 # Check for different versions of `swapctl' here..
809 if test "x$have_swapctl" = "xyes"; then
810 if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
811 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
812 [Define if the function swapctl exists and takes two arguments.])
814 if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
815 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
816 [Define if the function swapctl exists and takes three arguments.])
821 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
823 if test "x$withval" = "xno"; then
825 else if test "x$withval" = "xyes"; then
832 if test "x$nan_type" = "xnone"; then
833 AC_CACHE_CHECK([whether NAN is defined by default],
834 [c_cv_have_nan_default],
840 static double foo = NAN;
848 [c_cv_have_nan_default="yes"],
849 [c_cv_have_nan_default="no"]
852 if test "x$c_cv_have_nan_default" = "xyes"
857 if test "x$nan_type" = "xnone"; then
858 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
859 [c_cv_have_nan_isoc],
864 #define __USE_ISOC99 1
866 static double foo = NAN;
874 [c_cv_have_nan_isoc="yes"],
875 [c_cv_have_nan_isoc="no"]
878 if test "x$c_cv_have_nan_isoc" = "xyes"
883 if test "x$nan_type" = "xnone"; then
884 SAVE_LDFLAGS=$LDFLAGS
885 LDFLAGS="$LDFLAGS -lm"
886 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
887 [c_cv_have_nan_zero],
896 #define NAN (0.0 / 0.0)
898 # define isnan(f) ((f) != (f))
900 static double foo = NAN;
908 [c_cv_have_nan_zero="yes"],
909 [c_cv_have_nan_zero="no"]
912 LDFLAGS=$SAVE_LDFLAGS
913 if test "x$c_cv_have_nan_zero" = "xyes"
919 if test "x$nan_type" = "xdefault"; then
920 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
921 [Define if NAN is defined by default and can initialize static variables.])
922 else if test "x$nan_type" = "xisoc99"; then
923 AC_DEFINE(NAN_STATIC_ISOC, 1,
924 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
925 else if test "x$nan_type" = "xzero"; then
926 AC_DEFINE(NAN_ZERO_ZERO, 1,
927 [Define if NAN can be defined as (0.0 / 0.0)])
929 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
932 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
934 if test "x$withval" = "xnothing"; then
935 fp_layout_type="nothing"
936 else if test "x$withval" = "xendianflip"; then
937 fp_layout_type="endianflip"
938 else if test "x$withval" = "xintswap"; then
939 fp_layout_type="intswap"
941 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
944 [fp_layout_type="unknown"])
946 if test "x$fp_layout_type" = "xunknown"; then
947 AC_CACHE_CHECK([if doubles are stored in x86 representation],
948 [c_cv_fp_layout_need_nothing],
959 # include <inttypes.h>
962 # include <stdbool.h>
972 memcpy ((void *) &i0, (void *) &d, 8);
975 memcpy ((void *) c, (void *) &i1, 8);
977 if ((c[0] == 0x2f) && (c[1] == 0x25)
978 && (c[2] == 0xc0) && (c[3] == 0xc7)
979 && (c[4] == 0x43) && (c[5] == 0x2b)
980 && (c[6] == 0x1f) && (c[7] == 0x5b))
985 [c_cv_fp_layout_need_nothing="yes"],
986 [c_cv_fp_layout_need_nothing="no"]
989 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
990 fp_layout_type="nothing"
993 if test "x$fp_layout_type" = "xunknown"; then
994 AC_CACHE_CHECK([if endianflip converts to x86 representation],
995 [c_cv_fp_layout_need_endianflip],
1003 # include <stdint.h>
1006 # include <inttypes.h>
1009 # include <stdbool.h>
1011 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
1012 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
1013 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1014 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
1015 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
1016 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1017 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1018 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1027 memcpy ((void *) &i0, (void *) &d, 8);
1029 i1 = endianflip (i0);
1030 memcpy ((void *) c, (void *) &i1, 8);
1032 if ((c[0] == 0x2f) && (c[1] == 0x25)
1033 && (c[2] == 0xc0) && (c[3] == 0xc7)
1034 && (c[4] == 0x43) && (c[5] == 0x2b)
1035 && (c[6] == 0x1f) && (c[7] == 0x5b))
1040 [c_cv_fp_layout_need_endianflip="yes"],
1041 [c_cv_fp_layout_need_endianflip="no"]
1044 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1045 fp_layout_type="endianflip"
1048 if test "x$fp_layout_type" = "xunknown"; then
1049 AC_CACHE_CHECK([if intswap converts to x86 representation],
1050 [c_cv_fp_layout_need_intswap],
1058 # include <stdint.h>
1061 # include <inttypes.h>
1064 # include <stdbool.h>
1066 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1067 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1076 memcpy ((void *) &i0, (void *) &d, 8);
1079 memcpy ((void *) c, (void *) &i1, 8);
1081 if ((c[0] == 0x2f) && (c[1] == 0x25)
1082 && (c[2] == 0xc0) && (c[3] == 0xc7)
1083 && (c[4] == 0x43) && (c[5] == 0x2b)
1084 && (c[6] == 0x1f) && (c[7] == 0x5b))
1089 [c_cv_fp_layout_need_intswap="yes"],
1090 [c_cv_fp_layout_need_intswap="no"]
1093 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1094 fp_layout_type="intswap"
1098 if test "x$fp_layout_type" = "xnothing"; then
1099 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1100 [Define if doubles are stored in x86 representation.])
1101 else if test "x$fp_layout_type" = "xendianflip"; then
1102 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1103 [Define if endianflip is needed to convert to x86 representation.])
1104 else if test "x$fp_layout_type" = "xintswap"; then
1105 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1106 [Define if intswap is needed to convert to x86 representation.])
1108 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1112 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1113 have_getvfsstat="no"
1114 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1115 have_listmntent="no"
1116 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1119 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1120 if test "x$have_getmntent" = "xno"; then
1121 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1123 if test "x$have_getmntent" = "xno"; then
1124 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1126 if test "x$have_getmntent" = "xno"; then
1127 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1130 if test "x$have_getmntent" = "xc"; then
1131 AC_CACHE_CHECK([whether getmntent takes one argument],
1132 [c_cv_have_one_getmntent],
1134 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1135 #include "$srcdir/src/utils_mount.h"]],
1139 fh = setmntent ("/etc/mtab", "r");
1140 me = getmntent (fh);
1143 [c_cv_have_one_getmntent="yes"],
1144 [c_cv_have_one_getmntent="no"]
1147 AC_CACHE_CHECK([whether getmntent takes two arguments],
1148 [c_cv_have_two_getmntent],
1150 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
1151 #include "$srcdir/src/utils_mount.h"]],
1156 fh = fopen ("/etc/mnttab", "r");
1157 status = getmntent (fh, &mt);
1160 [c_cv_have_two_getmntent="yes"],
1161 [c_cv_have_two_getmntent="no"]
1166 # Check for different versions of `getmntent' here..
1168 if test "x$have_getmntent" = "xc"; then
1169 if test "x$c_cv_have_one_getmntent" = "xyes"; then
1170 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1171 [Define if the function getmntent exists and takes one argument.])
1173 if test "x$c_cv_have_two_getmntent" = "xyes"; then
1174 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1175 [Define if the function getmntent exists and takes two arguments.])
1178 if test "x$have_getmntent" = "xsun"; then
1179 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1180 [Define if the function getmntent exists. It's the version from libsun.])
1182 if test "x$have_getmntent" = "xseq"; then
1183 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1184 [Define if the function getmntent exists. It's the version from libseq.])
1186 if test "x$have_getmntent" = "xgen"; then
1187 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1188 [Define if the function getmntent exists. It's the version from libgen.])
1192 AC_MSG_CHECKING([if have htonll defined])
1197 #include <sys/types.h>
1198 #include <netinet/in.h>
1200 # include <inttypes.h>
1207 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1210 AC_MSG_RESULT([$have_htonll])
1212 # Check for structures
1213 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1214 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1217 #include <sys/types.h>
1218 #include <sys/socket.h>
1221 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1222 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1225 #include <sys/types.h>
1226 #include <sys/socket.h>
1227 #include <linux/if.h>
1228 #include <linux/netdevice.h>
1231 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1234 #include <netinet/in.h>
1238 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1240 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1241 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1242 have_struct_kinfo_proc_freebsd="yes"
1245 have_struct_kinfo_proc_freebsd="no"
1250 #include <sys/param.h>
1251 #include <sys/sysctl.h>
1252 #include <sys/user.h>
1255 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1257 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1258 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1259 have_struct_kinfo_proc_openbsd="yes"
1262 have_struct_kinfo_proc_openbsd="no"
1266 #include <sys/param.h>
1267 #include <sys/sysctl.h>
1271 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1272 [#define _BSD_SOURCE
1274 # include <stdint.h>
1276 #if HAVE_SYS_TYPES_H
1277 # include <sys/types.h>
1279 #if HAVE_NETINET_IN_SYSTM_H
1280 # include <netinet/in_systm.h>
1282 #if HAVE_NETINET_IN_H
1283 # include <netinet/in.h>
1285 #if HAVE_NETINET_IP_H
1286 # include <netinet/ip.h>
1288 #if HAVE_NETINET_UDP_H
1289 # include <netinet/udp.h>
1292 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1293 [#define _BSD_SOURCE
1295 # include <stdint.h>
1297 #if HAVE_SYS_TYPES_H
1298 # include <sys/types.h>
1300 #if HAVE_NETINET_IN_SYSTM_H
1301 # include <netinet/in_systm.h>
1303 #if HAVE_NETINET_IN_H
1304 # include <netinet/in.h>
1306 #if HAVE_NETINET_IP_H
1307 # include <netinet/ip.h>
1309 #if HAVE_NETINET_UDP_H
1310 # include <netinet/udp.h>
1314 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1324 # Checks for libraries begin here
1327 with_libresolv="yes"
1328 AC_CHECK_LIB(resolv, res_search,
1330 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1332 [with_libresolv="no"])
1333 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1335 dnl Check for HAL (hardware abstraction library)
1337 AC_CHECK_LIB(hal,libhal_device_property_exists,
1338 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1340 if test "x$with_libhal" = "xyes"; then
1341 if test "x$PKG_CONFIG" != "x"; then
1342 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1343 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1344 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1345 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1349 m4_divert_once([HELP_WITH], [
1350 collectd additional packages:])
1352 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1354 if test "x$ac_system" = "xAIX"
1359 with_perfstat="no (AIX only)"
1360 with_procinfo="no (AIX only)"
1363 if test "x$with_perfstat" = "xyes"
1365 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1366 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1368 if test "x$with_perfstat" = "xyes"
1370 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1371 # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1372 AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1373 if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1375 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1378 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1380 # Processes plugin under AIX.
1381 if test "x$with_procinfo" = "xyes"
1383 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1385 if test "x$with_procinfo" = "xyes"
1387 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1390 if test "x$ac_system" = "xSolaris"
1395 with_kstat="no (Solaris only)"
1396 with_devinfo="no (Solaris only)"
1399 if test "x$with_kstat" = "xyes"
1401 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1403 if test "x$with_kstat" = "xyes"
1405 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1406 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1408 if test "x$with_kstat" = "xyes"
1410 AC_DEFINE(HAVE_LIBKSTAT, 1,
1411 [Define to 1 if you have the 'kstat' library (-lkstat)])
1413 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1414 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1417 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1424 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1427 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1428 if test "x$with_kvm_getprocs" = "xyes"
1430 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1431 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1434 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1436 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1437 if test "x$with_kvm_getswapinfo" = "xyes"
1439 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1440 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1443 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1445 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1446 if test "x$with_kvm_nlist" = "xyes"
1448 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1449 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1450 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1453 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1455 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1456 if test "x$with_kvm_openfiles" = "xyes"
1458 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1459 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1462 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1464 # --with-libcredis {{{
1465 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1467 if test "x$withval" = "xyes"
1469 with_libcredis="yes"
1470 else if test "x$withval" = "xno"
1474 with_libcredis="yes"
1475 LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1476 LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1479 [with_libcredis="yes"])
1481 SAVE_CPPFLAGS="$CPPFLAGS"
1482 SAVE_LDFLAGS="$LDFLAGS"
1484 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1485 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1487 if test "x$with_libcredis" = "xyes"
1489 if test "x$LIBCREDIS_CPPFLAGS" != "x"
1491 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1493 AC_CHECK_HEADERS(credis.h,
1494 [with_libcredis="yes"],
1495 [with_libcredis="no (credis.h not found)"])
1497 if test "x$with_libcredis" = "xyes"
1499 if test "x$LIBCREDIS_LDFLAGS" != "x"
1501 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1503 AC_CHECK_LIB(credis, credis_info,
1504 [with_libcredis="yes"],
1505 [with_libcredis="no (symbol 'credis_info' not found)"])
1509 CPPFLAGS="$SAVE_CPPFLAGS"
1510 LDFLAGS="$SAVE_LDFLAGS"
1512 if test "x$with_libcredis" = "xyes"
1514 BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1515 BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1516 AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1517 AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1519 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1522 # --with-libcurl {{{
1523 with_curl_config="curl-config"
1526 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1528 if test "x$withval" = "xno"
1531 else if test "x$withval" = "xyes"
1535 if test -f "$withval" && test -x "$withval"
1537 with_curl_config="$withval"
1539 else if test -x "$withval/bin/curl-config"
1541 with_curl_config="$withval/bin/curl-config"
1550 if test "x$with_libcurl" = "xyes"
1552 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1553 curl_config_status=$?
1555 if test $curl_config_status -ne 0
1557 with_libcurl="no ($with_curl_config failed)"
1559 SAVE_CPPFLAGS="$CPPFLAGS"
1560 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1562 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1564 CPPFLAGS="$SAVE_CPPFLAGS"
1567 if test "x$with_libcurl" = "xyes"
1569 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1570 curl_config_status=$?
1572 if test $curl_config_status -ne 0
1574 with_libcurl="no ($with_curl_config failed)"
1576 AC_CHECK_LIB(curl, curl_easy_init,
1577 [with_libcurl="yes"],
1578 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1582 if test "x$with_libcurl" = "xyes"
1584 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1585 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1586 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1587 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1589 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1593 with_libdbi_cppflags=""
1594 with_libdbi_ldflags=""
1595 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1597 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1599 with_libdbi_cppflags="-I$withval/include"
1600 with_libdbi_ldflags="-L$withval/lib"
1603 with_libdbi="$withval"
1609 if test "x$with_libdbi" = "xyes"
1611 SAVE_CPPFLAGS="$CPPFLAGS"
1612 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1614 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1616 CPPFLAGS="$SAVE_CPPFLAGS"
1618 if test "x$with_libdbi" = "xyes"
1620 SAVE_CPPFLAGS="$CPPFLAGS"
1621 SAVE_LDFLAGS="$LDFLAGS"
1622 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1623 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1625 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1627 CPPFLAGS="$SAVE_CPPFLAGS"
1628 LDFLAGS="$SAVE_LDFLAGS"
1630 if test "x$with_libdbi" = "xyes"
1632 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1633 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1634 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1635 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1636 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1637 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1639 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1642 # --with-libesmtp {{{
1643 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1645 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1647 LDFLAGS="$LDFLAGS -L$withval/lib"
1648 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1651 with_libesmtp="$withval"
1657 if test "x$with_libesmtp" = "xyes"
1659 AC_CHECK_LIB(esmtp, smtp_create_session,
1661 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1662 ], [with_libesmtp="no (libesmtp not found)"])
1664 if test "x$with_libesmtp" = "xyes"
1666 AC_CHECK_HEADERS(libesmtp.h,
1668 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1669 ], [with_libesmtp="no (libesmtp.h not found)"])
1671 if test "x$with_libesmtp" = "xyes"
1677 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1678 [Wether or not to use the esmtp library])
1679 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1682 # --with-libganglia {{{
1683 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1685 if test -f "$withval" && test -x "$withval"
1687 with_libganglia_config="$withval"
1688 with_libganglia="yes"
1689 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1691 with_libganglia_config="$withval/bin/ganglia-config"
1692 with_libganglia="yes"
1693 else if test -d "$withval"
1695 GANGLIA_CPPFLAGS="-I$withval/include"
1696 GANGLIA_LDFLAGS="-L$withval/lib"
1697 with_libganglia="yes"
1699 with_libganglia_config="ganglia-config"
1700 with_libganglia="$withval"
1704 with_libganglia_config="ganglia-config"
1705 with_libganglia="yes"
1708 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1710 if test "x$GANGLIA_CPPFLAGS" = "x"
1712 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1715 if test "x$GANGLIA_LDFLAGS" = "x"
1717 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1720 if test "x$GANGLIA_LIBS" = "x"
1722 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1726 SAVE_CPPFLAGS="$CPPFLAGS"
1727 SAVE_LDFLAGS="$LDFLAGS"
1728 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1729 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1731 if test "x$with_libganglia" = "xyes"
1733 AC_CHECK_HEADERS(gm_protocol.h,
1735 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1736 [Define to 1 if you have the <gm_protocol.h> header file.])
1737 ], [with_libganglia="no (gm_protocol.h not found)"])
1740 if test "x$with_libganglia" = "xyes"
1742 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1744 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1745 [Define to 1 if you have the ganglia library (-lganglia).])
1746 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1749 CPPFLAGS="$SAVE_CPPFLAGS"
1750 LDFLAGS="$SAVE_LDFLAGS"
1752 AC_SUBST(GANGLIA_CPPFLAGS)
1753 AC_SUBST(GANGLIA_LDFLAGS)
1754 AC_SUBST(GANGLIA_LIBS)
1755 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1758 # --with-libgcrypt {{{
1759 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1760 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1761 GCRYPT_LIBS="$GCRYPT_LIBS"
1762 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1764 if test -f "$withval" && test -x "$withval"
1766 with_libgcrypt_config="$withval"
1767 with_libgcrypt="yes"
1768 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1770 with_libgcrypt_config="$withval/bin/gcrypt-config"
1771 with_libgcrypt="yes"
1772 else if test -d "$withval"
1774 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1775 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1776 with_libgcrypt="yes"
1778 with_libgcrypt_config="gcrypt-config"
1779 with_libgcrypt="$withval"
1783 with_libgcrypt_config="libgcrypt-config"
1784 with_libgcrypt="yes"
1787 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1789 if test "x$GCRYPT_CPPFLAGS" = "x"
1791 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1794 if test "x$GCRYPT_LDFLAGS" = "x"
1796 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1797 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1800 if test "x$GCRYPT_LIBS" = "x"
1802 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1806 SAVE_CPPFLAGS="$CPPFLAGS"
1807 SAVE_LDFLAGS="$LDFLAGS"
1808 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1809 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1811 if test "x$with_libgcrypt" = "xyes"
1813 if test "x$GCRYPT_CPPFLAGS" != "x"
1815 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1817 AC_CHECK_HEADERS(gcrypt.h,
1818 [with_libgcrypt="yes"],
1819 [with_libgcrypt="no (gcrypt.h not found)"])
1822 if test "x$with_libgcrypt" = "xyes"
1824 if test "x$GCRYPT_LDFLAGS" != "x"
1826 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1828 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1829 [with_libgcrypt="yes"],
1830 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1832 if test "$with_libgcrypt" != "no"; then
1833 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1834 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS"
1835 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
1839 CPPFLAGS="$SAVE_CPPFLAGS"
1840 LDFLAGS="$SAVE_LDFLAGS"
1842 if test "x$with_libgcrypt" = "xyes"
1844 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1847 AC_SUBST(GCRYPT_CPPFLAGS)
1848 AC_SUBST(GCRYPT_LDFLAGS)
1849 AC_SUBST(GCRYPT_LIBS)
1850 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1853 # --with-libiptc {{{
1854 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1856 if test "x$withval" = "xshipped"
1859 else if test "x$withval" = "xyes"
1861 with_libiptc="pkgconfig"
1862 else if test "x$withval" = "xno"
1867 with_libiptc_cflags="-I$withval/include"
1868 with_libiptc_libs="-L$withval/lib"
1872 if test "x$ac_system" = "xLinux"
1874 with_libiptc="pkgconfig"
1876 with_libiptc="no (Linux only)"
1880 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1882 with_libiptc="no (Don't have pkg-config)"
1885 if test "x$with_libiptc" = "xpkgconfig"
1887 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1890 with_libiptc="no (pkg-config doesn't know libiptc)"
1893 if test "x$with_libiptc" = "xpkgconfig"
1895 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1898 with_libiptc="no ($PKG_CONFIG failed)"
1900 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1903 with_libiptc="no ($PKG_CONFIG failed)"
1907 SAVE_CPPFLAGS="$CPPFLAGS"
1908 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1910 # check whether the header file for libiptc is available.
1911 if test "x$with_libiptc" = "xpkgconfig"
1913 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1914 [with_libiptc="no (header file missing)"])
1916 # If the header file is available, check for the required type declaractions.
1917 # They may be missing in old versions of libiptc. In that case, they will be
1918 # declared in the iptables plugin.
1919 if test "x$with_libiptc" = "xpkgconfig"
1921 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1923 # Check for the iptc_init symbol in the library.
1924 # This could be in iptc or ip4tc
1925 if test "x$with_libiptc" = "xpkgconfig"
1928 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1929 [with_libiptc="pkgconfig"],
1930 [with_libiptc="no"],
1931 [$with_libiptc_libs])
1934 if test "x$with_libiptc" = "xpkgconfig"
1939 CPPFLAGS="$SAVE_CPPFLAGS"
1941 if test "x$with_libiptc" = "xown"
1943 with_libiptc_cflags=""
1944 with_libiptc_libs=""
1946 if test "x$with_libiptc" = "xown"
1948 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1950 with_libiptc="no (Linux iptables headers not found)"
1953 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1956 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1957 if test "x$with_libiptc" = "xown"
1959 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1963 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1964 if test "x$with_libiptc" = "xyes"
1966 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1967 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1968 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1969 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1974 with_java_home="$JAVA_HOME"
1975 with_java_vmtype="client"
1980 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1982 if test "x$withval" = "xno"
1985 else if test "x$withval" = "xyes"
1989 with_java_home="$withval"
1994 if test "x$with_java" = "xyes"
1996 if test -d "$with_java_home"
1998 AC_MSG_CHECKING([for jni.h])
1999 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2000 if test "x$TMPDIR" != "x"
2002 AC_MSG_RESULT([found in $TMPDIR])
2003 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
2005 AC_MSG_RESULT([not found])
2008 AC_MSG_CHECKING([for jni_md.h])
2009 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2010 if test "x$TMPDIR" != "x"
2012 AC_MSG_RESULT([found in $TMPDIR])
2013 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
2015 AC_MSG_RESULT([not found])
2018 AC_MSG_CHECKING([for libjvm.so])
2019 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2020 if test "x$TMPDIR" != "x"
2022 AC_MSG_RESULT([found in $TMPDIR])
2023 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
2025 AC_MSG_RESULT([not found])
2028 if test "x$JAVAC" = "x"
2030 AC_MSG_CHECKING([for javac])
2031 TMPDIR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2032 if test "x$TMPDIR" != "x"
2035 AC_MSG_RESULT([$JAVAC])
2037 AC_MSG_RESULT([not found])
2040 if test "x$JAR" = "x"
2042 AC_MSG_CHECKING([for jar])
2043 TMPDIR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2044 if test "x$TMPDIR" != "x"
2047 AC_MSG_RESULT([$JAR])
2049 AC_MSG_RESULT([not found])
2052 else if test "x$with_java_home" != "x"
2054 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2058 if test "x$JAVA_CPPFLAGS" != "x"
2060 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2062 if test "x$JAVA_CFLAGS" != "x"
2064 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2066 if test "x$JAVA_LDFLAGS" != "x"
2068 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2070 if test "x$JAVAC" = "x"
2072 with_javac_path="$PATH"
2073 if test "x$with_java_home" != "x"
2075 with_javac_path="$with_java_home:with_javac_path"
2076 if test -d "$with_java_home/bin"
2078 with_javac_path="$with_java_home/bin:with_javac_path"
2082 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2084 if test "x$JAVAC" = "x"
2086 with_java="no (javac not found)"
2088 if test "x$JAR" = "x"
2090 with_jar_path="$PATH"
2091 if test "x$with_java_home" != "x"
2093 with_jar_path="$with_java_home:$with_jar_path"
2094 if test -d "$with_java_home/bin"
2096 with_jar_path="$with_java_home/bin:$with_jar_path"
2100 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2102 if test "x$JAR" = "x"
2104 with_java="no (jar not found)"
2107 SAVE_CPPFLAGS="$CPPFLAGS"
2108 SAVE_CFLAGS="$CFLAGS"
2109 SAVE_LDFLAGS="$LDFLAGS"
2110 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2111 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2112 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2114 if test "x$with_java" = "xyes"
2116 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2118 if test "x$with_java" = "xyes"
2120 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2122 [with_java="no (libjvm not found)"],
2125 if test "x$with_java" = "xyes"
2127 JAVA_LIBS="$JAVA_LIBS -ljvm"
2128 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2131 CPPFLAGS="$SAVE_CPPFLAGS"
2132 CFLAGS="$SAVE_CFLAGS"
2133 LDFLAGS="$SAVE_LDFLAGS"
2135 AC_SUBST(JAVA_CPPFLAGS)
2136 AC_SUBST(JAVA_CFLAGS)
2137 AC_SUBST(JAVA_LDFLAGS)
2139 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2142 # --with-libmemcached {{{
2143 with_libmemcached_cppflags=""
2144 with_libmemcached_ldflags=""
2145 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2147 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2149 with_libmemcached_cppflags="-I$withval/include"
2150 with_libmemcached_ldflags="-L$withval/lib"
2151 with_libmemcached="yes"
2153 with_libmemcached="$withval"
2157 with_libmemcached="yes"
2159 if test "x$with_libmemcached" = "xyes"
2161 SAVE_CPPFLAGS="$CPPFLAGS"
2162 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2164 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2166 CPPFLAGS="$SAVE_CPPFLAGS"
2168 if test "x$with_libmemcached" = "xyes"
2170 SAVE_CPPFLAGS="$CPPFLAGS"
2171 SAVE_LDFLAGS="$LDFLAGS"
2172 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2173 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2175 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2177 CPPFLAGS="$SAVE_CPPFLAGS"
2178 LDFLAGS="$SAVE_LDFLAGS"
2180 if test "x$with_libmemcached" = "xyes"
2182 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2183 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2184 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2185 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2186 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2187 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2188 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2190 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2193 # --with-libmodbus {{{
2194 with_libmodbus_config=""
2195 with_libmodbus_cflags=""
2196 with_libmodbus_libs=""
2197 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2199 if test "x$withval" = "xno"
2202 else if test "x$withval" = "xyes"
2204 with_libmodbus="use_pkgconfig"
2205 else if test -d "$with_libmodbus/lib"
2207 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2208 with_libmodbus_cflags="-I$withval/include"
2209 with_libmodbus_libs="-L$withval/lib -lmodbus"
2210 with_libmodbus="yes"
2213 [with_libmodbus="use_pkgconfig"])
2215 # configure using pkg-config
2216 if test "x$with_libmodbus" = "xuse_pkgconfig"
2218 if test "x$PKG_CONFIG" = "x"
2220 with_libmodbus="no (Don't have pkg-config)"
2223 if test "x$with_libmodbus" = "xuse_pkgconfig"
2225 AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2226 $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2229 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2232 if test "x$with_libmodbus" = "xuse_pkgconfig"
2234 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2237 with_libmodbus="no ($PKG_CONFIG failed)"
2239 with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2242 with_libmodbus="no ($PKG_CONFIG failed)"
2245 if test "x$with_libmodbus" = "xuse_pkgconfig"
2247 with_libmodbus="yes"
2250 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2251 # the actual checks.
2252 if test "x$with_libmodbus" = "xyes"
2254 SAVE_CPPFLAGS="$CPPFLAGS"
2255 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2257 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
2259 CPPFLAGS="$SAVE_CPPFLAGS"
2261 if test "x$with_libmodbus" = "xyes"
2263 SAVE_CPPFLAGS="$CPPFLAGS"
2264 SAVE_LDFLAGS="$LDFLAGS"
2266 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2267 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2269 AC_CHECK_LIB(modbus, modbus_connect,
2270 [with_libmodbus="yes"],
2271 [with_libmodbus="no (symbol modbus_connect not found)"])
2273 CPPFLAGS="$SAVE_CPPFLAGS"
2274 LDFLAGS="$SAVE_LDFLAGS"
2276 if test "x$with_libmodbus" = "xyes"
2278 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2279 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2280 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2281 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2285 # --with-libmongoc {{{
2286 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2288 if test "x$withval" = "xyes"
2290 with_libmongoc="yes"
2291 else if test "x$withval" = "xno"
2295 with_libmongoc="yes"
2296 LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2297 LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2300 [with_libmongoc="yes"])
2302 SAVE_CPPFLAGS="$CPPFLAGS"
2303 SAVE_LDFLAGS="$LDFLAGS"
2305 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2306 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2308 if test "x$with_libmongoc" = "xyes"
2310 if test "x$LIBMONGOC_CPPFLAGS" != "x"
2312 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2314 AC_CHECK_HEADERS(mongo.h,
2315 [with_libmongoc="yes"],
2316 [with_libmongoc="no ('mongo.h' not found)"],
2318 # define MONGO_HAVE_STDINT 1
2320 # define MONGO_USE_LONG_LONG_INT 1
2324 if test "x$with_libmongoc" = "xyes"
2326 if test "x$LIBMONGOC_LDFLAGS" != "x"
2328 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2330 AC_CHECK_LIB(mongoc, mongo_run_command,
2331 [with_libmongoc="yes"],
2332 [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2335 CPPFLAGS="$SAVE_CPPFLAGS"
2336 LDFLAGS="$SAVE_LDFLAGS"
2338 if test "x$with_libmongoc" = "xyes"
2340 BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2341 BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2342 AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2343 AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2345 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2348 # --with-libmysql {{{
2349 with_mysql_config="mysql_config"
2350 with_mysql_cflags=""
2352 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2354 if test "x$withval" = "xno"
2357 else if test "x$withval" = "xyes"
2361 if test -f "$withval" && test -x "$withval";
2363 with_mysql_config="$withval"
2364 else if test -x "$withval/bin/mysql_config"
2366 with_mysql_config="$withval/bin/mysql_config"
2374 if test "x$with_libmysql" = "xyes"
2376 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2377 mysql_config_status=$?
2379 if test $mysql_config_status -ne 0
2381 with_libmysql="no ($with_mysql_config failed)"
2383 SAVE_CPPFLAGS="$CPPFLAGS"
2384 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2387 have_mysql_mysql_h="no"
2388 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2390 if test "x$have_mysql_h" = "xno"
2392 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2395 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2397 with_libmysql="no (mysql.h not found)"
2400 CPPFLAGS="$SAVE_CPPFLAGS"
2403 if test "x$with_libmysql" = "xyes"
2405 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2406 mysql_config_status=$?
2408 if test $mysql_config_status -ne 0
2410 with_libmysql="no ($with_mysql_config failed)"
2412 AC_CHECK_LIB(mysqlclient, mysql_init,
2413 [with_libmysql="yes"],
2414 [with_libmysql="no (symbol 'mysql_init' not found)"],
2417 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2418 [with_libmysql="yes"],
2419 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2423 if test "x$with_libmysql" = "xyes"
2425 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2426 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2427 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2428 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2430 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2433 # --with-libnetlink {{{
2434 with_libnetlink_cflags=""
2435 with_libnetlink_libs="-lnetlink"
2436 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2438 echo "libnetlink: withval = $withval"
2439 if test "x$withval" = "xyes"
2441 with_libnetlink="yes"
2442 else if test "x$withval" = "xno"
2444 with_libnetlink="no"
2446 if test -d "$withval/include"
2448 with_libnetlink_cflags="-I$withval/include"
2449 with_libnetlink_libs="-L$withval/lib -lnetlink"
2450 with_libnetlink="yes"
2452 AC_MSG_ERROR("no such directory: $withval/include")
2457 if test "x$ac_system" = "xLinux"
2459 with_libnetlink="yes"
2461 with_libnetlink="no (Linux only library)"
2464 if test "x$with_libnetlink" = "xyes"
2466 SAVE_CFLAGS="$CFLAGS"
2467 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2469 with_libnetlink="no (libnetlink.h not found)"
2471 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2473 with_libnetlink="yes"
2477 #include <sys/types.h>
2478 #include <asm/types.h>
2479 #include <sys/socket.h>
2480 #include <linux/netlink.h>
2481 #include <linux/rtnetlink.h>])
2482 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2484 #include <sys/types.h>
2485 #include <asm/types.h>
2486 #include <sys/socket.h>])
2488 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2491 #include <sys/types.h>
2492 #include <asm/types.h>
2493 #include <sys/socket.h>
2494 #include <linux/netlink.h>
2495 #include <linux/rtnetlink.h>
2497 int retval = TCA_STATS2;
2501 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2505 #include <sys/types.h>
2506 #include <asm/types.h>
2507 #include <sys/socket.h>
2508 #include <linux/netlink.h>
2509 #include <linux/rtnetlink.h>
2513 int retval = TCA_STATS;
2516 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2519 CFLAGS="$SAVE_CFLAGS"
2521 if test "x$with_libnetlink" = "xyes"
2523 AC_CHECK_LIB(netlink, rtnl_open,
2524 [with_libnetlink="yes"],
2525 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2526 [$with_libnetlink_libs])
2528 if test "x$with_libnetlink" = "xyes"
2530 SAVE_CFLAGS="$CFLAGS"
2531 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2534 [if function 'rtnl_dump_filter' expects five arguments],
2535 [c_cv_rtnl_dump_filter_five_args],
2536 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2539 #include <asm/types.h>
2540 #include <sys/socket.h>
2541 #if HAVE_LIBNETLINK_H
2542 # include <libnetlink.h>
2543 #elif HAVE_IPROUTE_LIBNETLINK_H
2544 # include <iproute/libnetlink.h>
2545 #elif HAVE_LINUX_LIBNETLINK_H
2546 # include <linux/libnetlink.h>
2550 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2555 [c_cv_rtnl_dump_filter_five_args="yes"],
2556 [c_cv_rtnl_dump_filter_five_args="no"]
2561 [if function 'rtnl_dump_filter' expects three arguments],
2562 [c_cv_rtnl_dump_filter_three_args],
2563 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2566 #include <asm/types.h>
2567 #include <sys/socket.h>
2568 #if HAVE_LIBNETLINK_H
2569 # include <libnetlink.h>
2570 #elif HAVE_IPROUTE_LIBNETLINK_H
2571 # include <iproute/libnetlink.h>
2572 #elif HAVE_LINUX_LIBNETLINK_H
2573 # include <linux/libnetlink.h>
2577 if (rtnl_dump_filter(NULL, NULL, NULL))
2582 [c_cv_rtnl_dump_filter_three_args="yes"],
2583 [c_cv_rtnl_dump_filter_three_args="no"]
2587 CFLAGS="$SAVE_CFLAGS"
2589 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2591 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2592 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2594 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2596 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2597 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2600 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2601 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2602 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2603 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2605 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2608 # --with-libnetapp {{{
2609 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2610 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2611 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2612 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2613 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2614 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2615 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2617 if test -d "$withval"
2619 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2620 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2621 with_libnetapp="yes"
2623 with_libnetapp="$withval"
2627 with_libnetapp="yes"
2630 SAVE_CPPFLAGS="$CPPFLAGS"
2631 SAVE_LDFLAGS="$LDFLAGS"
2632 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2633 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2635 if test "x$with_libnetapp" = "xyes"
2637 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2639 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2641 AC_CHECK_HEADERS(netapp_api.h,
2642 [with_libnetapp="yes"],
2643 [with_libnetapp="no (netapp_api.h not found)"])
2646 if test "x$with_libnetapp" = "xyes"
2648 if test "x$LIBNETAPP_LDFLAGS" != "x"
2650 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2653 if test "x$LIBNETAPP_LIBS" = "x"
2655 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2657 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2659 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2660 [with_libnetapp="yes"],
2661 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2663 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2666 CPPFLAGS="$SAVE_CPPFLAGS"
2667 LDFLAGS="$SAVE_LDFLAGS"
2669 if test "x$with_libnetapp" = "xyes"
2671 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2674 AC_SUBST(LIBNETAPP_CPPFLAGS)
2675 AC_SUBST(LIBNETAPP_LDFLAGS)
2676 AC_SUBST(LIBNETAPP_LIBS)
2677 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2680 # --with-libnetsnmp {{{
2681 with_snmp_config="net-snmp-config"
2684 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2686 if test "x$withval" = "xno"
2688 with_libnetsnmp="no"
2689 else if test "x$withval" = "xyes"
2691 with_libnetsnmp="yes"
2693 if test -x "$withval"
2695 with_snmp_config="$withval"
2696 with_libnetsnmp="yes"
2698 with_snmp_config="$withval/bin/net-snmp-config"
2699 with_libnetsnmp="yes"
2703 [with_libnetsnmp="yes"])
2704 if test "x$with_libnetsnmp" = "xyes"
2706 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2707 snmp_config_status=$?
2709 if test $snmp_config_status -ne 0
2711 with_libnetsnmp="no ($with_snmp_config failed)"
2713 SAVE_CPPFLAGS="$CPPFLAGS"
2714 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2716 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2718 CPPFLAGS="$SAVE_CPPFLAGS"
2721 if test "x$with_libnetsnmp" = "xyes"
2723 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2724 snmp_config_status=$?
2726 if test $snmp_config_status -ne 0
2728 with_libnetsnmp="no ($with_snmp_config failed)"
2730 AC_CHECK_LIB(netsnmp, init_snmp,
2731 [with_libnetsnmp="yes"],
2732 [with_libnetsnmp="no (libnetsnmp not found)"],
2736 if test "x$with_libnetsnmp" = "xyes"
2738 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2739 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2740 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2741 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2743 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2746 # --with-liboconfig {{{
2747 with_own_liboconfig="no"
2748 liboconfig_LDFLAGS="$LDFLAGS"
2749 liboconfig_CPPFLAGS="$CPPFLAGS"
2750 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2752 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2754 if test -d "$withval/lib"
2756 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2758 if test -d "$withval/include"
2760 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2763 if test "x$withval" = "xno"
2765 AC_MSG_ERROR("liboconfig is required")
2769 with_liboconfig="yes"
2772 save_LDFLAGS="$LDFLAGS"
2773 save_CPPFLAGS="$CPPFLAGS"
2774 LDFLAGS="$liboconfig_LDFLAGS"
2775 CPPFLAGS="$liboconfig_CPPFLAGS"
2776 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2778 with_liboconfig="yes"
2779 with_own_liboconfig="no"
2782 with_liboconfig="yes"
2783 with_own_liboconfig="yes"
2784 LDFLAGS="$save_LDFLAGS"
2785 CPPFLAGS="$save_CPPFLAGS"
2788 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2789 if test "x$with_own_liboconfig" = "xyes"
2791 with_liboconfig="yes (shipped version)"
2795 # --with-liboping {{{
2796 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2798 if test "x$withval" = "xyes"
2801 else if test "x$withval" = "xno"
2806 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2807 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2810 [with_liboping="yes"])
2812 SAVE_CPPFLAGS="$CPPFLAGS"
2813 SAVE_LDFLAGS="$LDFLAGS"
2815 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2816 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2818 if test "x$with_liboping" = "xyes"
2820 if test "x$LIBOPING_CPPFLAGS" != "x"
2822 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2824 AC_CHECK_HEADERS(oping.h,
2825 [with_liboping="yes"],
2826 [with_liboping="no (oping.h not found)"])
2828 if test "x$with_liboping" = "xyes"
2830 if test "x$LIBOPING_LDFLAGS" != "x"
2832 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2834 AC_CHECK_LIB(oping, ping_construct,
2835 [with_liboping="yes"],
2836 [with_liboping="no (symbol 'ping_construct' not found)"])
2839 CPPFLAGS="$SAVE_CPPFLAGS"
2840 LDFLAGS="$SAVE_LDFLAGS"
2842 if test "x$with_liboping" = "xyes"
2844 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2845 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2846 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2847 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2849 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2853 with_oracle_cppflags=""
2855 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2857 if test "x$withval" = "xyes"
2859 if test "x$ORACLE_HOME" = "x"
2861 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2864 else if test "x$withval" = "xno"
2869 ORACLE_HOME="$withval"
2873 if test "x$ORACLE_HOME" = "x"
2875 with_oracle="no (ORACLE_HOME is not set)"
2880 if test "x$ORACLE_HOME" != "x"
2882 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2884 if test -e "$ORACLE_HOME/lib/ldflags"
2886 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2888 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2889 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2891 if test "x$with_oracle" = "xyes"
2893 SAVE_CPPFLAGS="$CPPFLAGS"
2894 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2896 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2898 CPPFLAGS="$SAVE_CPPFLAGS"
2900 if test "x$with_oracle" = "xyes"
2902 SAVE_CPPFLAGS="$CPPFLAGS"
2903 SAVE_LDFLAGS="$LDFLAGS"
2904 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2905 LDFLAGS="$LDFLAGS $with_oracle_libs"
2907 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2909 CPPFLAGS="$SAVE_CPPFLAGS"
2910 LDFLAGS="$SAVE_LDFLAGS"
2912 if test "x$with_oracle" = "xyes"
2914 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2915 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2916 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2917 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2921 # --with-libowcapi {{{
2922 with_libowcapi_cppflags=""
2923 with_libowcapi_libs="-lowcapi"
2924 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2926 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2928 with_libowcapi_cppflags="-I$withval/include"
2929 with_libowcapi_libs="-L$withval/lib -lowcapi"
2930 with_libowcapi="yes"
2932 with_libowcapi="$withval"
2936 with_libowcapi="yes"
2938 if test "x$with_libowcapi" = "xyes"
2940 SAVE_CPPFLAGS="$CPPFLAGS"
2941 CPPFLAGS="$with_libowcapi_cppflags"
2943 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2945 CPPFLAGS="$SAVE_CPPFLAGS"
2947 if test "x$with_libowcapi" = "xyes"
2949 SAVE_LDFLAGS="$LDFLAGS"
2950 SAVE_CPPFLAGS="$CPPFLAGS"
2951 LDFLAGS="$with_libowcapi_libs"
2952 CPPFLAGS="$with_libowcapi_cppflags"
2954 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2956 LDFLAGS="$SAVE_LDFLAGS"
2957 CPPFLAGS="$SAVE_CPPFLAGS"
2959 if test "x$with_libowcapi" = "xyes"
2961 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2962 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2963 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2964 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2968 # --with-libpcap {{{
2969 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2971 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2973 LDFLAGS="$LDFLAGS -L$withval/lib"
2974 CPPFLAGS="$CPPFLAGS -I$withval/include"
2977 with_libpcap="$withval"
2983 if test "x$with_libpcap" = "xyes"
2985 AC_CHECK_LIB(pcap, pcap_open_live,
2987 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2988 ], [with_libpcap="no (libpcap not found)"])
2990 if test "x$with_libpcap" = "xyes"
2992 AC_CHECK_HEADERS(pcap.h,,
2993 [with_libpcap="no (pcap.h not found)"])
2995 if test "x$with_libpcap" = "xyes"
2997 AC_CHECK_HEADERS(pcap-bpf.h,,
2998 [with_libpcap="no (pcap-bpf.h not found)"])
3000 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3003 # --with-libperl {{{
3004 perl_interpreter="perl"
3005 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3007 if test -f "$withval" && test -x "$withval"
3009 perl_interpreter="$withval"
3011 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3013 LDFLAGS="$LDFLAGS -L$withval/lib"
3014 CPPFLAGS="$CPPFLAGS -I$withval/include"
3015 perl_interpreter="$withval/bin/perl"
3018 with_libperl="$withval"
3025 AC_MSG_CHECKING([for perl])
3026 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3027 if test -x "$perl_interpreter"
3029 AC_MSG_RESULT([yes ($perl_interpreter)])
3035 AC_SUBST(PERL, "$perl_interpreter")
3037 if test "x$with_libperl" = "xyes" \
3038 && test -n "$perl_interpreter"
3040 SAVE_CFLAGS="$CFLAGS"
3041 SAVE_LDFLAGS="$LDFLAGS"
3042 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3043 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3044 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3045 CFLAGS="$CFLAGS $PERL_CFLAGS"
3046 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3048 AC_CACHE_CHECK([for libperl],
3049 [c_cv_have_libperl],
3053 #define PERL_NO_GET_CONTEXT
3060 load_module (PERL_LOADMOD_NOIMPORT,
3061 newSVpv ("Collectd::Plugin::FooBar", 24),
3064 [c_cv_have_libperl="yes"],
3065 [c_cv_have_libperl="no"]
3069 if test "x$c_cv_have_libperl" = "xyes"
3071 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3072 AC_SUBST(PERL_CFLAGS)
3073 AC_SUBST(PERL_LDFLAGS)
3078 CFLAGS="$SAVE_CFLAGS"
3079 LDFLAGS="$SAVE_LDFLAGS"
3080 else if test -z "$perl_interpreter"; then
3081 with_libperl="no (no perl interpreter found)"
3082 c_cv_have_libperl="no"
3084 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3086 if test "x$with_libperl" = "xyes"
3088 SAVE_CFLAGS="$CFLAGS"
3089 SAVE_LDFLAGS="$LDFLAGS"
3090 CFLAGS="$CFLAGS $PERL_CFLAGS"
3091 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3093 AC_CACHE_CHECK([if perl supports ithreads],
3094 [c_cv_have_perl_ithreads],
3102 #if !defined(USE_ITHREADS)
3103 # error "Perl does not support ithreads!"
3104 #endif /* !defined(USE_ITHREADS) */
3107 [c_cv_have_perl_ithreads="yes"],
3108 [c_cv_have_perl_ithreads="no"]
3112 if test "x$c_cv_have_perl_ithreads" = "xyes"
3114 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3117 CFLAGS="$SAVE_CFLAGS"
3118 LDFLAGS="$SAVE_LDFLAGS"
3121 if test "x$with_libperl" = "xyes"
3123 SAVE_CFLAGS="$CFLAGS"
3124 SAVE_LDFLAGS="$LDFLAGS"
3125 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3126 # (see issues #41 and #42)
3127 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3128 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3130 AC_CACHE_CHECK([for broken Perl_load_module()],
3131 [c_cv_have_broken_perl_load_module],
3135 #define PERL_NO_GET_CONTEXT
3142 load_module (PERL_LOADMOD_NOIMPORT,
3143 newSVpv ("Collectd::Plugin::FooBar", 24),
3146 [c_cv_have_broken_perl_load_module="no"],
3147 [c_cv_have_broken_perl_load_module="yes"]
3151 CFLAGS="$SAVE_CFLAGS"
3152 LDFLAGS="$SAVE_LDFLAGS"
3154 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3155 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3157 if test "x$with_libperl" = "xyes"
3159 SAVE_CFLAGS="$CFLAGS"
3160 SAVE_LDFLAGS="$LDFLAGS"
3161 CFLAGS="$CFLAGS $PERL_CFLAGS"
3162 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
3165 [struct mgvtbl.svt_local],
3166 [have_struct_mgvtbl_svt_local="yes"],
3167 [have_struct_mgvtbl_svt_local="no"],
3174 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3176 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3177 [Define if Perl's struct mgvtbl has member svt_local.])
3180 CFLAGS="$SAVE_CFLAGS"
3181 LDFLAGS="$SAVE_LDFLAGS"
3186 with_pg_config="pg_config"
3187 with_libpq_includedir=""
3188 with_libpq_libdir=""
3189 with_libpq_cppflags=""
3190 with_libpq_ldflags=""
3191 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3194 if test "x$withval" = "xno"
3197 else if test "x$withval" = "xyes"
3201 if test -f "$withval" && test -x "$withval";
3203 with_pg_config="$withval"
3204 else if test -x "$withval/bin/pg_config"
3206 with_pg_config="$withval/bin/pg_config"
3214 if test "x$with_libpq" = "xyes"
3216 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3219 if test $pg_config_status -eq 0
3221 if test -n "$with_libpq_includedir"; then
3222 for dir in $with_libpq_includedir; do
3223 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3227 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3230 SAVE_CPPFLAGS="$CPPFLAGS"
3231 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3233 AC_CHECK_HEADERS(libpq-fe.h, [],
3234 [with_libpq="no (libpq-fe.h not found)"], [])
3236 CPPFLAGS="$SAVE_CPPFLAGS"
3238 if test "x$with_libpq" = "xyes"
3240 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3243 if test $pg_config_status -eq 0
3245 if test -n "$with_libpq_libdir"; then
3246 for dir in $with_libpq_libdir; do
3247 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3251 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3254 SAVE_LDFLAGS="$LDFLAGS"
3255 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3257 AC_CHECK_LIB(pq, PQconnectdb,
3259 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3261 AC_CHECK_LIB(pq, PQserverVersion,
3263 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3265 LDFLAGS="$SAVE_LDFLAGS"
3267 if test "x$with_libpq" = "xyes"
3269 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3270 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3271 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3272 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3274 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3277 # --with-libpthread {{{
3278 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3279 [ if test "x$withval" != "xno" \
3280 && test "x$withval" != "xyes"
3282 LDFLAGS="$LDFLAGS -L$withval/lib"
3283 CPPFLAGS="$CPPFLAGS -I$withval/include"
3284 with_libpthread="yes"
3286 if test "x$withval" = "xno"
3288 with_libpthread="no (disabled)"
3291 ], [with_libpthread="yes"])
3292 if test "x$with_libpthread" = "xyes"
3294 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3297 if test "x$with_libpthread" = "xyes"
3299 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3301 if test "x$with_libpthread" = "xyes"
3307 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3308 [Wether or not to use pthread (POSIX threads) library])
3309 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3314 with_python_path="$PATH"
3315 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3317 if test "x$withval" = "xyes" || test "x$withval" = "xno"
3319 with_python="$withval"
3320 else if test -x "$withval"
3322 with_python_prog="$withval"
3323 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3325 else if test -d "$withval"
3327 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3330 AC_MSG_WARN([Argument not recognized: $withval])
3332 ], [with_python="yes"])
3335 SAVE_CPPFLAGS="$CPPFLAGS"
3336 SAVE_LDFLAGS="$LDFLAGS"
3339 PATH="$with_python_path"
3341 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3343 AC_MSG_CHECKING([for python])
3344 with_python_prog="`which python 2>/dev/null`"
3345 if test "x$with_python_prog" = "x"
3347 AC_MSG_RESULT([not found])
3348 with_python="no (interpreter not found)"
3350 AC_MSG_RESULT([$with_python_prog])
3354 if test "x$with_python" = "xyes"
3356 AC_MSG_CHECKING([for Python CPPFLAGS])
3357 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3358 python_config_status=$?
3360 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3362 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3365 AC_MSG_RESULT([$python_include_path])
3369 if test "x$with_python" = "xyes"
3371 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3372 AC_CHECK_HEADERS(Python.h,
3373 [with_python="yes"],
3374 [with_python="no ('Python.h' not found)"])
3377 if test "x$with_python" = "xyes"
3379 AC_MSG_CHECKING([for Python LDFLAGS])
3380 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`
3381 python_config_status=$?
3383 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3385 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3388 AC_MSG_RESULT([$python_library_path])
3392 if test "x$with_python" = "xyes"
3394 AC_MSG_CHECKING([for Python LIBS])
3395 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`
3396 python_config_status=$?
3398 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3400 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3403 AC_MSG_RESULT([$python_library_flags])
3407 if test "x$with_python" = "xyes"
3409 LDFLAGS="-L$python_library_path $LDFLAGS"
3410 LIBS="$python_library_flags $LIBS"
3412 AC_CHECK_FUNC(PyObject_CallFunction,
3413 [with_python="yes"],
3414 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3418 CPPFLAGS="$SAVE_CPPFLAGS"
3419 LDFLAGS="$SAVE_LDFLAGS"
3422 if test "x$with_python" = "xyes"
3424 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3425 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3426 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3427 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3428 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3429 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3433 # --with-librabbitmq {{{
3434 with_librabbitmq_cppflags=""
3435 with_librabbitmq_ldflags=""
3436 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3438 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3440 with_librabbitmq_cppflags="-I$withval/include"
3441 with_librabbitmq_ldflags="-L$withval/lib"
3442 with_librabbitmq="yes"
3444 with_librabbitmq="$withval"
3448 with_librabbitmq="yes"
3450 SAVE_CPPFLAGS="$CPPFLAGS"
3451 SAVE_LDFLAGS="$LDFLAGS"
3452 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3453 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3454 if test "x$with_librabbitmq" = "xyes"
3456 AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3458 if test "x$with_librabbitmq" = "xyes"
3460 # librabbitmq up to version 0.9.1 provides "library_errno", later
3461 # versions use "library_error". The library does not provide a version
3462 # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3463 AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3466 # include <stdlib.h>
3472 # include <stdint.h>
3475 # include <inttypes.h>
3480 if test "x$with_librabbitmq" = "xyes"
3482 AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3484 if test "x$with_librabbitmq" = "xyes"
3486 BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3487 BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3488 BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3489 AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3490 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3491 AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3492 AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3494 CPPFLAGS="$SAVE_CPPFLAGS"
3495 LDFLAGS="$SAVE_LDFLAGS"
3496 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3499 # --with-librouteros {{{
3500 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3502 if test "x$withval" = "xyes"
3504 with_librouteros="yes"
3505 else if test "x$withval" = "xno"
3507 with_librouteros="no"
3509 with_librouteros="yes"
3510 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3511 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3514 [with_librouteros="yes"])
3516 SAVE_CPPFLAGS="$CPPFLAGS"
3517 SAVE_LDFLAGS="$LDFLAGS"
3519 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3520 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3522 if test "x$with_librouteros" = "xyes"
3524 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3526 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3528 AC_CHECK_HEADERS(routeros_api.h,
3529 [with_librouteros="yes"],
3530 [with_librouteros="no (routeros_api.h not found)"])
3532 if test "x$with_librouteros" = "xyes"
3534 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3536 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3538 AC_CHECK_LIB(routeros, ros_interface,
3539 [with_librouteros="yes"],
3540 [with_librouteros="no (symbol 'ros_interface' not found)"])
3543 CPPFLAGS="$SAVE_CPPFLAGS"
3544 LDFLAGS="$SAVE_LDFLAGS"
3546 if test "x$with_librouteros" = "xyes"
3548 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3549 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3550 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3551 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3553 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3557 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3560 librrd_threadsafe="yes"
3561 librrd_rrdc_update="no"
3562 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3563 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3565 librrd_cflags="-I$withval/include"
3566 librrd_ldflags="-L$withval/lib"
3569 with_librrd="$withval"
3571 ], [with_librrd="yes"])
3572 if test "x$with_librrd" = "xyes"
3574 SAVE_CPPFLAGS="$CPPFLAGS"
3575 SAVE_LDFLAGS="$LDFLAGS"
3577 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3578 LDFLAGS="$LDFLAGS $librrd_ldflags"
3580 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3582 CPPFLAGS="$SAVE_CPPFLAGS"
3583 LDFLAGS="$SAVE_LDFLAGS"
3585 if test "x$with_librrd" = "xyes"
3587 SAVE_CPPFLAGS="$CPPFLAGS"
3588 SAVE_LDFLAGS="$LDFLAGS"
3590 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3591 LDFLAGS="$LDFLAGS $librrd_ldflags"
3593 AC_CHECK_LIB(rrd_th, rrd_update_r,
3595 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3597 [librrd_threadsafe="no"
3598 AC_CHECK_LIB(rrd, rrd_update,
3600 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3602 [with_librrd="no (symbol 'rrd_update' not found)"],
3607 if test "x$librrd_threadsafe" = "xyes"
3609 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3611 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3614 CPPFLAGS="$SAVE_CPPFLAGS"
3615 LDFLAGS="$SAVE_LDFLAGS"
3617 if test "x$with_librrd" = "xyes"
3619 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3620 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3621 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3622 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3624 if test "x$librrd_threadsafe" = "xyes"
3626 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3630 # --with-libsensors {{{
3631 with_sensors_cflags=""
3632 with_sensors_ldflags=""
3633 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3635 if test "x$withval" = "xno"
3637 with_libsensors="no"
3639 with_libsensors="yes"
3640 if test "x$withval" != "xyes"
3642 with_sensors_cflags="-I$withval/include"
3643 with_sensors_ldflags="-L$withval/lib"
3644 with_libsensors="yes"
3649 if test "x$ac_system" = "xLinux"
3651 with_libsensors="yes"
3653 with_libsensors="no (Linux only library)"
3656 if test "x$with_libsensors" = "xyes"
3658 SAVE_CPPFLAGS="$CPPFLAGS"
3659 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3661 # AC_CHECK_HEADERS(sensors/sensors.h,
3663 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3665 # [with_libsensors="no (sensors/sensors.h not found)"])
3666 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3668 CPPFLAGS="$SAVE_CPPFLAGS"
3670 if test "x$with_libsensors" = "xyes"
3672 SAVE_CPPFLAGS="$CPPFLAGS"
3673 SAVE_LDFLAGS="$LDFLAGS"
3674 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3675 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3677 AC_CHECK_LIB(sensors, sensors_init,
3679 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3681 [with_libsensors="no (libsensors not found)"])
3683 CPPFLAGS="$SAVE_CPPFLAGS"
3684 LDFLAGS="$SAVE_LDFLAGS"
3686 if test "x$with_libsensors" = "xyes"
3688 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3689 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3690 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3691 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3693 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3696 # --with-libstatgrab {{{
3697 with_libstatgrab_cflags=""
3698 with_libstatgrab_ldflags=""
3699 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3701 if test "x$withval" != "xno" \
3702 && test "x$withval" != "xyes"
3704 with_libstatgrab_cflags="-I$withval/include"
3705 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3706 with_libstatgrab="yes"
3707 with_libstatgrab_pkg_config="no"
3709 with_libstatgrab="$withval"
3710 with_libstatgrab_pkg_config="yes"
3714 with_libstatgrab="yes"
3715 with_libstatgrab_pkg_config="yes"
3718 if test "x$with_libstatgrab" = "xyes" \
3719 && test "x$with_libstatgrab_pkg_config" = "xyes"
3721 if test "x$PKG_CONFIG" != "x"
3723 AC_MSG_CHECKING([pkg-config for libstatgrab])
3725 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3728 with_libstatgrab_pkg_config="no"
3729 with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
3730 temp_result="not found"
3732 AC_MSG_RESULT([$temp_result])
3734 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3735 with_libstatgrab_pkg_config="no"
3736 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3740 if test "x$with_libstatgrab" = "xyes" \
3741 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3742 && test "x$with_libstatgrab_cflags" = "x"
3744 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3745 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3748 with_libstatgrab_cflags="$temp_result"
3750 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3751 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3753 AC_MSG_RESULT([$temp_result])
3756 if test "x$with_libstatgrab" = "xyes" \
3757 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3758 && test "x$with_libstatgrab_ldflags" = "x"
3760 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3761 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3764 with_libstatgrab_ldflags="$temp_result"
3766 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3767 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3769 AC_MSG_RESULT([$temp_result])
3772 if test "x$with_libstatgrab" = "xyes"
3774 SAVE_CPPFLAGS="$CPPFLAGS"
3775 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3777 AC_CHECK_HEADERS(statgrab.h,
3778 [with_libstatgrab="yes"],
3779 [with_libstatgrab="no (statgrab.h not found)"])
3781 CPPFLAGS="$SAVE_CPPFLAGS"
3784 if test "x$with_libstatgrab" = "xyes"
3786 SAVE_CFLAGS="$CFLAGS"
3787 SAVE_LDFLAGS="$LDFLAGS"
3789 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3790 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3792 AC_CHECK_LIB(statgrab, sg_init,
3793 [with_libstatgrab="yes"],
3794 [with_libstatgrab="no (symbol sg_init not found)"])
3796 CFLAGS="$SAVE_CFLAGS"
3797 LDFLAGS="$SAVE_LDFLAGS"
3800 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3801 if test "x$with_libstatgrab" = "xyes"
3803 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3804 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3805 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3806 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3807 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3811 # --with-libtokyotyrant {{{
3812 with_libtokyotyrant_cppflags=""
3813 with_libtokyotyrant_ldflags=""
3814 with_libtokyotyrant_libs=""
3815 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3817 if test "x$withval" = "xno"
3819 with_libtokyotyrant="no"
3820 else if test "x$withval" = "xyes"
3822 with_libtokyotyrant="yes"
3824 with_libtokyotyrant_cppflags="-I$withval/include"
3825 with_libtokyotyrant_ldflags="-L$withval/include"
3826 with_libtokyotyrant_libs="-ltokyotyrant"
3827 with_libtokyotyrant="yes"
3831 with_libtokyotyrant="yes"
3834 if test "x$with_libtokyotyrant" = "xyes"
3836 if $PKG_CONFIG --exists tokyotyrant
3838 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3839 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3840 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3844 SAVE_CPPFLAGS="$CPPFLAGS"
3845 SAVE_LDFLAGS="$LDFLAGS"
3846 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3847 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3849 if test "x$with_libtokyotyrant" = "xyes"
3851 AC_CHECK_HEADERS(tcrdb.h,
3853 AC_DEFINE(HAVE_TCRDB_H, 1,
3854 [Define to 1 if you have the <tcrdb.h> header file.])
3855 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3858 if test "x$with_libtokyotyrant" = "xyes"
3860 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3862 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3863 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3865 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3866 [$with_libtokyotyrant_libs])
3869 CPPFLAGS="$SAVE_CPPFLAGS"
3870 LDFLAGS="$SAVE_LDFLAGS"
3872 if test "x$with_libtokyotyrant" = "xyes"
3874 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3875 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3876 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3877 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3878 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3879 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3881 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3884 # --with-libupsclient {{{
3885 with_libupsclient_config=""
3886 with_libupsclient_cflags=""
3887 with_libupsclient_libs=""
3888 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3890 if test "x$withval" = "xno"
3892 with_libupsclient="no"
3893 else if test "x$withval" = "xyes"
3895 with_libupsclient="use_pkgconfig"
3897 if test -x "$withval"
3899 with_libupsclient_config="$withval"
3900 with_libupsclient="use_libupsclient_config"
3901 else if test -x "$withval/bin/libupsclient-config"
3903 with_libupsclient_config="$withval/bin/libupsclient-config"
3904 with_libupsclient="use_libupsclient_config"
3906 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3907 with_libupsclient_cflags="-I$withval/include"
3908 with_libupsclient_libs="-L$withval/lib -lupsclient"
3909 with_libupsclient="yes"
3913 [with_libupsclient="use_pkgconfig"])
3915 # configure using libupsclient-config
3916 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3918 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3919 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3922 with_libupsclient="no ($with_libupsclient_config failed)"
3924 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3927 with_libupsclient="no ($with_libupsclient_config failed)"
3930 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3932 with_libupsclient="yes"
3935 # configure using pkg-config
3936 if test "x$with_libupsclient" = "xuse_pkgconfig"
3938 if test "x$PKG_CONFIG" = "x"
3940 with_libupsclient="no (Don't have pkg-config)"
3943 if test "x$with_libupsclient" = "xuse_pkgconfig"
3945 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3946 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3949 with_libupsclient="no (pkg-config doesn't know libupsclient)"
3952 if test "x$with_libupsclient" = "xuse_pkgconfig"
3954 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3957 with_libupsclient="no ($PKG_CONFIG failed)"
3959 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3962 with_libupsclient="no ($PKG_CONFIG failed)"
3965 if test "x$with_libupsclient" = "xuse_pkgconfig"
3967 with_libupsclient="yes"
3970 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3971 # the actual checks.
3972 if test "x$with_libupsclient" = "xyes"
3974 SAVE_CPPFLAGS="$CPPFLAGS"
3975 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3977 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3979 CPPFLAGS="$SAVE_CPPFLAGS"
3981 if test "x$with_libupsclient" = "xyes"
3983 SAVE_CPPFLAGS="$CPPFLAGS"
3984 SAVE_LDFLAGS="$LDFLAGS"
3986 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3987 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3989 AC_CHECK_LIB(upsclient, upscli_connect,
3990 [with_libupsclient="yes"],
3991 [with_libupsclient="no (symbol upscli_connect not found)"])
3993 CPPFLAGS="$SAVE_CPPFLAGS"
3994 LDFLAGS="$SAVE_LDFLAGS"
3996 if test "x$with_libupsclient" = "xyes"
3998 SAVE_CPPFLAGS="$CPPFLAGS"
3999 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4001 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4002 [#include <stdlib.h>
4004 #include <upsclient.h>])
4006 CPPFLAGS="$SAVE_CPPFLAGS"
4008 if test "x$with_libupsclient" = "xyes"
4010 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4011 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4012 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4013 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4017 # --with-libxmms {{{
4018 with_xmms_config="xmms-config"
4021 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4023 if test "x$withval" != "xno" \
4024 && test "x$withval" != "xyes"
4026 if test -f "$withval" && test -x "$withval";
4028 with_xmms_config="$withval"
4029 else if test -x "$withval/bin/xmms-config"
4031 with_xmms_config="$withval/bin/xmms-config"
4034 else if test "x$withval" = "xno"
4044 if test "x$with_libxmms" = "xyes"
4046 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4047 xmms_config_status=$?
4049 if test $xmms_config_status -ne 0
4054 if test "x$with_libxmms" = "xyes"
4056 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4057 xmms_config_status=$?
4059 if test $xmms_config_status -ne 0
4064 if test "x$with_libxmms" = "xyes"
4066 AC_CHECK_LIB(xmms, xmms_remote_get_info,
4068 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4069 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4070 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4071 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4078 with_libxmms_numeric=0
4079 if test "x$with_libxmms" = "xyes"
4081 with_libxmms_numeric=1
4083 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4084 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4087 # --with-libyajl {{{
4088 with_libyajl_cppflags=""
4089 with_libyajl_ldflags=""
4090 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4092 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4094 with_libyajl_cppflags="-I$withval/include"
4095 with_libyajl_ldflags="-L$withval/lib"
4098 with_libyajl="$withval"
4104 if test "x$with_libyajl" = "xyes"
4106 SAVE_CPPFLAGS="$CPPFLAGS"
4107 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4109 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4110 AC_CHECK_HEADERS(yajl/yajl_version.h)
4112 CPPFLAGS="$SAVE_CPPFLAGS"
4114 if test "x$with_libyajl" = "xyes"
4116 SAVE_CPPFLAGS="$CPPFLAGS"
4117 SAVE_LDFLAGS="$LDFLAGS"
4118 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4119 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4121 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4123 CPPFLAGS="$SAVE_CPPFLAGS"
4124 LDFLAGS="$SAVE_LDFLAGS"
4126 if test "x$with_libyajl" = "xyes"
4128 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4129 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4130 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4131 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4132 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4133 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4134 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4136 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4139 # --with-libvarnish {{{
4140 with_libvarnish_cppflags=""
4141 with_libvarnish_cflags=""
4142 with_libvarnish_libs=""
4143 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4145 if test "x$withval" = "xno"
4147 with_libvarnish="no"
4148 else if test "x$withval" = "xyes"
4150 with_libvarnish="use_pkgconfig"
4151 else if test -d "$with_libvarnish/lib"
4153 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4154 with_libvarnish_cflags="-I$withval/include"
4155 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4156 with_libvarnish="yes"
4159 [with_libvarnish="use_pkgconfig"])
4161 # configure using pkg-config
4162 if test "x$with_libvarnish" = "xuse_pkgconfig"
4164 if test "x$PKG_CONFIG" = "x"
4166 with_libvarnish="no (Don't have pkg-config)"
4169 if test "x$with_libvarnish" = "xuse_pkgconfig"
4171 AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4172 $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4175 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4178 if test "x$with_libvarnish" = "xuse_pkgconfig"
4180 with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4183 with_libvarnish="no ($PKG_CONFIG failed)"
4185 with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4188 with_libvarnish="no ($PKG_CONFIG failed)"
4191 if test "x$with_libvarnish" = "xuse_pkgconfig"
4193 with_libvarnish="yes"
4196 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4197 # the actual checks.
4198 if test "x$with_libvarnish" = "xyes"
4200 SAVE_CPPFLAGS="$CPPFLAGS"
4201 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4202 AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4204 CPPFLAGS="$SAVE_CPPFLAGS"
4206 if test "x$with_libvarnish" = "xyes"
4208 SAVE_CPPFLAGS="$CPPFLAGS"
4209 #SAVE_LDFLAGS="$LDFLAGS"
4211 CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4212 #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4214 AC_CHECK_HEADERS(varnish/vsc.h,
4215 [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4216 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4218 CPPFLAGS="$SAVE_CPPFLAGS"
4219 #LDFLAGS="$SAVE_LDFLAGS"
4221 if test "x$with_libvarnish" = "xyes"
4223 BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4224 BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4225 AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4226 AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4230 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4231 with_libxml2="no (pkg-config isn't available)"
4232 with_libxml2_cflags=""
4233 with_libxml2_ldflags=""
4234 with_libvirt="no (pkg-config isn't available)"
4235 with_libvirt_cflags=""
4236 with_libvirt_ldflags=""
4237 if test "x$PKG_CONFIG" != "x"
4239 pkg-config --exists 'libxml-2.0' 2>/dev/null
4244 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4247 pkg-config --exists libvirt 2>/dev/null
4252 with_libvirt="no (pkg-config doesn't know libvirt)"
4255 if test "x$with_libxml2" = "xyes"
4257 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
4262 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
4268 if test "x$with_libxml2" = "xyes"
4270 SAVE_CPPFLAGS="$CPPFLAGS"
4271 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4273 AC_CHECK_HEADERS(libxml/parser.h, [],
4274 [with_libxml2="no (libxml/parser.h not found)"])
4276 CPPFLAGS="$SAVE_CPPFLAGS"
4278 if test "x$with_libxml2" = "xyes"
4280 SAVE_CFLAGS="$CFLAGS"
4281 SAVE_LDFLAGS="$LDFLAGS"
4283 CFLAGS="$CFLAGS $with_libxml2_cflags"
4284 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4286 AC_CHECK_LIB(xml2, xmlXPathEval,
4287 [with_libxml2="yes"],
4288 [with_libxml2="no (symbol xmlXPathEval not found)"])
4290 CFLAGS="$SAVE_CFLAGS"
4291 LDFLAGS="$SAVE_LDFLAGS"
4293 dnl Add the right compiler flags and libraries.
4294 if test "x$with_libxml2" = "xyes"; then
4295 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4296 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4297 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4298 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4300 if test "x$with_libvirt" = "xyes"
4302 with_libvirt_cflags="`pkg-config --cflags libvirt`"
4307 with_libvirt_ldflags="`pkg-config --libs libvirt`"
4313 if test "x$with_libvirt" = "xyes"
4315 SAVE_CPPFLAGS="$CPPFLAGS"
4316 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4318 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4319 [with_libvirt="no (libvirt/libvirt.h not found)"])
4321 CPPFLAGS="$SAVE_CPPFLAGS"
4323 if test "x$with_libvirt" = "xyes"
4325 SAVE_CFLAGS="$CFLAGS"
4326 SAVE_LDFLAGS="$LDFLAGS"
4328 CFLAGS="$CFLAGS $with_libvirt_cflags"
4329 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4331 AC_CHECK_LIB(virt, virDomainBlockStats,
4332 [with_libvirt="yes"],
4333 [with_libvirt="no (symbol virDomainBlockStats not found)"])
4335 CFLAGS="$SAVE_CFLAGS"
4336 LDFLAGS="$SAVE_LDFLAGS"
4338 dnl Add the right compiler flags and libraries.
4339 if test "x$with_libvirt" = "xyes"; then
4340 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4341 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4342 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4343 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4347 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4348 with_libopenipmipthread="yes"
4349 with_libopenipmipthread_cflags=""
4350 with_libopenipmipthread_libs=""
4352 AC_MSG_CHECKING([for pkg-config])
4354 if test "x$PKG_CONFIG" = "x"
4356 with_libopenipmipthread="no"
4359 temp_result="$PKG_CONFIG"
4361 AC_MSG_RESULT([$temp_result])
4363 if test "x$with_libopenipmipthread" = "xyes"
4365 AC_MSG_CHECKING([for libOpenIPMIpthread])
4366 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4369 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4371 AC_MSG_RESULT([$with_libopenipmipthread])
4374 if test "x$with_libopenipmipthread" = "xyes"
4376 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4377 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4380 with_libopenipmipthread_cflags="$temp_result"
4382 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4383 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4385 AC_MSG_RESULT([$temp_result])
4388 if test "x$with_libopenipmipthread" = "xyes"
4390 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4391 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4394 with_libopenipmipthread_ldflags="$temp_result"
4396 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4397 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4399 AC_MSG_RESULT([$temp_result])
4402 if test "x$with_libopenipmipthread" = "xyes"
4404 SAVE_CPPFLAGS="$CPPFLAGS"
4405 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4407 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4408 [with_libopenipmipthread="yes"],
4409 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4410 [#include <OpenIPMI/ipmiif.h>
4411 #include <OpenIPMI/ipmi_err.h>
4412 #include <OpenIPMI/ipmi_posix.h>
4413 #include <OpenIPMI/ipmi_conn.h>
4416 CPPFLAGS="$SAVE_CPPFLAGS"
4419 if test "x$with_libopenipmipthread" = "xyes"
4421 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4422 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4423 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4424 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4428 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4429 [with_libnotify="yes"],
4430 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4433 with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4436 # Check for enabled/disabled features
4439 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4440 # ------------------------------------------------------------
4442 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4447 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4452 m4_define([EnDis],[disabled])dnl
4453 m4_define([YesNo],[no])dnl
4459 m4_define([EnDis],[enabled])dnl
4460 m4_define([YesNo],[yes])dnl
4463 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4467 m4_if([$3], [feature], [],
4471 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4477 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4479 enable_$1='[YesNo]'dnl
4481 if test "x$enable_$1" = "xno"
4485 if test "x$enable_$1" = "xyes"
4489 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4494 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4495 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4497 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4499 # AC_PLUGIN(name, default, info)
4500 # ------------------------------------------------------------
4507 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4509 if test "x$enableval" = "xyes"
4512 else if test "x$enableval" = "xforce"
4517 enable_plugin="no (disabled on command line)"
4521 if test "x$enable_all_plugins" = "xauto"
4523 if test "x$2" = "xyes"
4530 enable_plugin="$enable_all_plugins"
4533 if test "x$enable_plugin" = "xyes"
4535 if test "x$2" = "xyes" || test "x$force" = "xyes"
4537 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4538 if test "x$2" != "xyes"
4540 dependency_warning="yes"
4542 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4543 dependency_error="yes"
4544 enable_plugin="no (dependency error)"
4547 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4548 enable_$1="$enable_plugin"
4550 )# AC_PLUGIN(name, default, info)
4552 m4_divert_once([HELP_ENABLE], [
4553 collectd features:])
4554 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4555 AC_COLLECTD([debug], [enable], [feature], [debugging])
4556 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4557 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4559 dependency_warning="no"
4560 dependency_error="no"
4565 plugin_conntrack="no"
4566 plugin_contextswitch="no"
4569 plugin_curl_json="no"
4570 plugin_curl_xml="no"
4576 plugin_interface="no"
4583 plugin_multimeter="no"
4587 plugin_processes="no"
4588 plugin_protocols="no"
4592 plugin_tcpconns="no"
4599 plugin_wireless="no"
4603 if test "x$ac_system" = "xLinux"
4605 plugin_battery="yes"
4606 plugin_conntrack="yes"
4607 plugin_contextswitch="yes"
4609 plugin_cpufreq="yes"
4611 plugin_entropy="yes"
4612 plugin_fscache="yes"
4613 plugin_interface="yes"
4619 plugin_processes="yes"
4620 plugin_protocols="yes"
4623 plugin_tcpconns="yes"
4624 plugin_thermal="yes"
4627 plugin_vserver="yes"
4628 plugin_wireless="yes"
4630 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4636 if test "x$ac_system" = "xOpenBSD"
4638 plugin_tcpconns="yes"
4642 if test "x$with_libiokit" = "xyes"
4644 plugin_battery="yes"
4650 if test "x$ac_system" = "xAIX"
4652 plugin_tcpconns="yes"
4655 if test "x$with_perfstat" = "xyes"
4658 plugin_contextswitch="yes"
4662 plugin_interface="yes"
4667 if test "x$with_procinfo" = "xyes"
4669 plugin_processes="yes"
4673 if test "x$with_kstat" = "xyes"
4677 plugin_zfs_arc="yes"
4680 if test "x$with_devinfo$with_kstat" = "xyesyes"
4684 plugin_interface="yes"
4690 if test "x$with_libstatgrab" = "xyes"
4694 plugin_interface="yes"
4701 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4704 if test "x$have_strptime" = "xyes"
4710 if test "x$with_libopenipmipthread" = "xyes"
4715 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4717 plugin_curl_json="yes"
4720 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4722 plugin_curl_xml="yes"
4725 if test "x$have_processor_info" = "xyes"
4729 if test "x$have_sysctl" = "xyes"
4734 if test "x$ac_system" = "xDarwin"
4739 if test "x$have_sysctlbyname" = "xyes"
4741 plugin_contextswitch="yes"
4744 plugin_tcpconns="yes"
4747 # Df plugin: Check if we know how to determine mount points first.
4748 #if test "x$have_listmntent" = "xyes"; then
4751 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4755 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4759 #if test "x$have_getmntent" = "xseq"
4763 if test "x$c_cv_have_one_getmntent" = "xyes"
4768 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4769 if test "x$plugin_df" = "xyes"
4772 if test "x$have_statfs" = "xyes"
4776 if test "x$have_statvfs" = "xyes"
4782 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
4784 plugin_ethstat="yes"
4787 if test "x$have_getifaddrs" = "xyes"
4789 plugin_interface="yes"
4792 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4794 plugin_libvirt="yes"
4797 if test "x$have_getloadavg" = "xyes"
4802 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4807 # Mac OS X memory interface
4808 if test "x$have_host_statistics" = "xyes"
4813 if test "x$have_termios_h" = "xyes"
4815 plugin_multimeter="yes"
4819 if test "x$have_thread_info" = "xyes"
4821 plugin_processes="yes"
4824 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4826 plugin_processes="yes"
4829 if test "x$with_kvm_getswapinfo" = "xyes"
4834 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
4839 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4841 plugin_tcpconns="yes"
4844 if test "x$have_getutent" = "xyes"
4848 if test "x$have_getutxent" = "xyes"
4853 m4_divert_once([HELP_ENABLE], [
4856 AC_ARG_ENABLE([all-plugins],
4857 AC_HELP_STRING([--enable-all-plugins],
4858 [enable all plugins (auto by def)]),
4860 if test "x$enableval" = "xyes"
4862 enable_all_plugins="yes"
4863 else if test "x$enableval" = "xauto"
4865 enable_all_plugins="auto"
4867 enable_all_plugins="no"
4870 [enable_all_plugins="auto"])
4872 m4_divert_once([HELP_ENABLE], [])
4874 AC_PLUGIN([aggregation], [yes], [Aggregation plugin])
4875 AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin])
4876 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4877 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4878 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4879 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4880 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4881 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4882 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4883 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4884 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4885 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4886 AC_PLUGIN([csv], [yes], [CSV output plugin])
4887 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4888 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4889 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4890 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4891 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4892 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4893 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4894 AC_PLUGIN([email], [yes], [EMail statistics])
4895 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4896 AC_PLUGIN([ethstat], [$plugin_ethstat], [Stats from NIC driver])
4897 AC_PLUGIN([exec], [yes], [Execution of external programs])
4898 AC_PLUGIN([filecount], [yes], [Count files in directories])
4899 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4900 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4901 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4902 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4903 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4904 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4905 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4906 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4907 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4908 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4909 AC_PLUGIN([load], [$plugin_load], [System load])
4910 AC_PLUGIN([logfile], [yes], [File logging plugin])
4911 AC_PLUGIN([lpar], [$with_perfstat], [AIX logical partitions statistics])
4912 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4913 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4914 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4915 AC_PLUGIN([match_regex], [yes], [The regex match])
4916 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4917 AC_PLUGIN([match_value], [yes], [The value match])
4918 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4919 AC_PLUGIN([md], [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
4920 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4921 AC_PLUGIN([memcached], [yes], [memcached statistics])
4922 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4923 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4924 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4925 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4926 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4927 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4928 AC_PLUGIN([network], [yes], [Network communication plugin])
4929 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4930 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4931 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4932 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4933 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4934 AC_PLUGIN([numa], [$plugin_numa], [NUMA virtual memory statistics])
4935 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4936 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4937 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4938 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4939 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4940 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4941 AC_PLUGIN([pf], [$have_net_pfvar_h], [BSD packet filter (PF) statistics])
4942 # FIXME: Check for libevent, too.
4943 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4944 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4945 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4946 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4947 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4948 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4949 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4950 AC_PLUGIN([redis], [$with_libcredis], [Redis plugin])
4951 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4952 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4953 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4954 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4955 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4956 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4957 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4958 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4959 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4960 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4961 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4962 AC_PLUGIN([target_notification], [yes], [The notification target])
4963 AC_PLUGIN([target_replace], [yes], [The replace target])
4964 AC_PLUGIN([target_scale],[yes], [The scale target])
4965 AC_PLUGIN([target_set], [yes], [The set target])
4966 AC_PLUGIN([target_v5upgrade], [yes], [The v5upgrade target])
4967 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4968 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4969 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4970 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4971 AC_PLUGIN([threshold], [yes], [Threshold checking plugin])
4972 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4973 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4974 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4975 AC_PLUGIN([users], [$plugin_users], [User statistics])
4976 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4977 AC_PLUGIN([varnish], [$with_libvarnish], [Varnish cache statistics])
4978 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4979 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4980 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4981 AC_PLUGIN([write_graphite], [yes], [Graphite / Carbon output plugin])
4982 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4983 AC_PLUGIN([write_mongodb], [$with_libmongoc], [MongoDB output plugin])
4984 AC_PLUGIN([write_redis], [$with_libcredis], [Redis output plugin])
4985 AC_PLUGIN([write_riemann], [$have_protoc_c], [Riemann output plugin])
4986 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4987 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4989 dnl Default configuration file
4990 # Load either syslog or logfile
4991 LOAD_PLUGIN_SYSLOG=""
4992 LOAD_PLUGIN_LOGFILE=""
4994 AC_MSG_CHECKING([which default log plugin to load])
4995 default_log_plugin="none"
4996 if test "x$enable_syslog" = "xyes"
4998 default_log_plugin="syslog"
5000 LOAD_PLUGIN_SYSLOG="##"
5003 if test "x$enable_logfile" = "xyes"
5005 if test "x$default_log_plugin" = "xnone"
5007 default_log_plugin="logfile"
5009 LOAD_PLUGIN_LOGFILE="#"
5012 LOAD_PLUGIN_LOGFILE="##"
5014 AC_MSG_RESULT([$default_log_plugin])
5016 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5017 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5019 DEFAULT_LOG_LEVEL="info"
5020 if test "x$enable_debug" = "xyes"
5022 DEFAULT_LOG_LEVEL="debug"
5024 AC_SUBST(DEFAULT_LOG_LEVEL)
5026 # Load only one of rrdtool, network, csv in the default config.
5027 LOAD_PLUGIN_RRDTOOL=""
5028 LOAD_PLUGIN_NETWORK=""
5031 AC_MSG_CHECKING([which default write plugin to load])
5032 default_write_plugin="none"
5033 if test "x$enable_rrdtool" = "xyes"
5035 default_write_plugin="rrdtool"
5037 LOAD_PLUGIN_RRDTOOL="##"
5040 if test "x$enable_network" = "xyes"
5042 if test "x$default_write_plugin" = "xnone"
5044 default_write_plugin="network"
5046 LOAD_PLUGIN_NETWORK="#"
5049 LOAD_PLUGIN_NETWORK="##"
5052 if test "x$enable_csv" = "xyes"
5054 if test "x$default_write_plugin" = "xnone"
5056 default_write_plugin="csv"
5061 LOAD_PLUGIN_CSV="##"
5063 AC_MSG_RESULT([$default_write_plugin])
5065 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5066 AC_SUBST(LOAD_PLUGIN_NETWORK)
5067 AC_SUBST(LOAD_PLUGIN_CSV)
5070 if test "x$ac_system" = "xLinux" \
5071 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5073 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5076 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5078 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5082 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5084 if test "x$withval" != "xno" && test "x$withval" != "xyes"
5086 PERL_BINDINGS_OPTIONS="$withval"
5087 with_perl_bindings="yes"
5089 PERL_BINDINGS_OPTIONS=""
5090 with_perl_bindings="$withval"
5094 PERL_BINDINGS_OPTIONS=""
5095 if test -n "$perl_interpreter"
5097 with_perl_bindings="yes"
5099 with_perl_bindings="no (no perl interpreter found)"
5102 if test "x$with_perl_bindings" = "xyes"
5104 PERL_BINDINGS="perl"
5108 AC_SUBST(PERL_BINDINGS)
5109 AC_SUBST(PERL_BINDINGS_OPTIONS)
5111 dnl libcollectdclient
5112 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5113 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5114 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5116 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5118 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5120 AC_SUBST(LCC_VERSION_MAJOR)
5121 AC_SUBST(LCC_VERSION_MINOR)
5122 AC_SUBST(LCC_VERSION_PATCH)
5123 AC_SUBST(LCC_VERSION_EXTRA)
5124 AC_SUBST(LCC_VERSION_STRING)
5126 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5128 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
5130 if test "x$with_librrd" = "xyes" \
5131 && test "x$librrd_threadsafe" != "xyes"
5133 with_librrd="yes (warning: librrd is not thread-safe)"
5136 if test "x$with_libperl" = "xyes"
5138 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5140 enable_perl="no (needs libperl)"
5143 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5145 enable_perl="no (libperl doesn't support ithreads)"
5148 if test "x$with_perl_bindings" = "xyes" \
5149 && test "x$PERL_BINDINGS_OPTIONS" != "x"
5151 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5158 libcurl . . . . . . . $with_libcurl
5159 libdbi . . . . . . . $with_libdbi
5160 libcredis . . . . . . $with_libcredis
5161 libesmtp . . . . . . $with_libesmtp
5162 libganglia . . . . . $with_libganglia
5163 libgcrypt . . . . . . $with_libgcrypt
5164 libiokit . . . . . . $with_libiokit
5165 libiptc . . . . . . . $with_libiptc
5166 libjvm . . . . . . . $with_java
5167 libkstat . . . . . . $with_kstat
5168 libkvm . . . . . . . $with_libkvm
5169 libmemcached . . . . $with_libmemcached
5170 libmodbus . . . . . . $with_libmodbus
5171 libmysql . . . . . . $with_libmysql
5172 libnetapp . . . . . . $with_libnetapp
5173 libnetlink . . . . . $with_libnetlink
5174 libnetsnmp . . . . . $with_libnetsnmp
5175 libnotify . . . . . . $with_libnotify
5176 liboconfig . . . . . $with_liboconfig
5177 libopenipmi . . . . . $with_libopenipmipthread
5178 liboping . . . . . . $with_liboping
5179 libpcap . . . . . . . $with_libpcap
5180 libperfstat . . . . . $with_perfstat
5181 libperl . . . . . . . $with_libperl
5182 libpq . . . . . . . . $with_libpq
5183 libpthread . . . . . $with_libpthread
5184 librabbitmq . . . . . $with_librabbitmq
5185 librouteros . . . . . $with_librouteros
5186 librrd . . . . . . . $with_librrd
5187 libsensors . . . . . $with_libsensors
5188 libstatgrab . . . . . $with_libstatgrab
5189 libtokyotyrant . . . $with_libtokyotyrant
5190 libupsclient . . . . $with_libupsclient
5191 libvarnish . . . . . $with_libvarnish
5192 libvirt . . . . . . . $with_libvirt
5193 libxml2 . . . . . . . $with_libxml2
5194 libxmms . . . . . . . $with_libxmms
5195 libyajl . . . . . . . $with_libyajl
5196 libevent . . . . . . $with_libevent
5197 protobuf-c . . . . . $have_protoc_c
5198 oracle . . . . . . . $with_oracle
5199 python . . . . . . . $with_python
5202 daemon mode . . . . . $enable_daemon
5203 debug . . . . . . . . $enable_debug
5206 perl . . . . . . . . $with_perl_bindings
5209 aggregation . . . . . $enable_aggregation
5210 amqp . . . . . . . $enable_amqp
5211 apache . . . . . . . $enable_apache
5212 apcups . . . . . . . $enable_apcups
5213 apple_sensors . . . . $enable_apple_sensors
5214 ascent . . . . . . . $enable_ascent
5215 battery . . . . . . . $enable_battery
5216 bind . . . . . . . . $enable_bind
5217 conntrack . . . . . . $enable_conntrack
5218 contextswitch . . . . $enable_contextswitch
5219 cpu . . . . . . . . . $enable_cpu
5220 cpufreq . . . . . . . $enable_cpufreq
5221 csv . . . . . . . . . $enable_csv
5222 curl . . . . . . . . $enable_curl
5223 curl_json . . . . . . $enable_curl_json
5224 curl_xml . . . . . . $enable_curl_xml
5225 dbi . . . . . . . . . $enable_dbi
5226 df . . . . . . . . . $enable_df
5227 disk . . . . . . . . $enable_disk
5228 dns . . . . . . . . . $enable_dns
5229 email . . . . . . . . $enable_email
5230 entropy . . . . . . . $enable_entropy
5231 ethstat . . . . . . . $enable_ethstat
5232 exec . . . . . . . . $enable_exec
5233 filecount . . . . . . $enable_filecount
5234 fscache . . . . . . . $enable_fscache
5235 gmond . . . . . . . . $enable_gmond
5236 hddtemp . . . . . . . $enable_hddtemp
5237 interface . . . . . . $enable_interface
5238 ipmi . . . . . . . . $enable_ipmi
5239 iptables . . . . . . $enable_iptables
5240 ipvs . . . . . . . . $enable_ipvs
5241 irq . . . . . . . . . $enable_irq
5242 java . . . . . . . . $enable_java
5243 libvirt . . . . . . . $enable_libvirt
5244 load . . . . . . . . $enable_load
5245 logfile . . . . . . . $enable_logfile
5246 lpar... . . . . . . . $enable_lpar
5247 madwifi . . . . . . . $enable_madwifi
5248 match_empty_counter . $enable_match_empty_counter
5249 match_hashed . . . . $enable_match_hashed
5250 match_regex . . . . . $enable_match_regex
5251 match_timediff . . . $enable_match_timediff
5252 match_value . . . . . $enable_match_value
5253 mbmon . . . . . . . . $enable_mbmon
5254 md . . . . . . . . . $enable_md
5255 memcachec . . . . . . $enable_memcachec
5256 memcached . . . . . . $enable_memcached
5257 memory . . . . . . . $enable_memory
5258 modbus . . . . . . . $enable_modbus
5259 multimeter . . . . . $enable_multimeter
5260 mysql . . . . . . . . $enable_mysql
5261 netapp . . . . . . . $enable_netapp
5262 netlink . . . . . . . $enable_netlink
5263 network . . . . . . . $enable_network
5264 nfs . . . . . . . . . $enable_nfs
5265 nginx . . . . . . . . $enable_nginx
5266 notify_desktop . . . $enable_notify_desktop
5267 notify_email . . . . $enable_notify_email
5268 ntpd . . . . . . . . $enable_ntpd
5269 numa . . . . . . . . $enable_numa
5270 nut . . . . . . . . . $enable_nut
5271 olsrd . . . . . . . . $enable_olsrd
5272 onewire . . . . . . . $enable_onewire
5273 openvpn . . . . . . . $enable_openvpn
5274 oracle . . . . . . . $enable_oracle
5275 perl . . . . . . . . $enable_perl
5276 pf . . . . . . . . . $enable_pf
5277 pinba . . . . . . . . $enable_pinba
5278 ping . . . . . . . . $enable_ping
5279 postgresql . . . . . $enable_postgresql
5280 powerdns . . . . . . $enable_powerdns
5281 processes . . . . . . $enable_processes
5282 protocols . . . . . . $enable_protocols
5283 python . . . . . . . $enable_python
5284 redis . . . . . . . . $enable_redis
5285 routeros . . . . . . $enable_routeros
5286 rrdcached . . . . . . $enable_rrdcached
5287 rrdtool . . . . . . . $enable_rrdtool
5288 sensors . . . . . . . $enable_sensors
5289 serial . . . . . . . $enable_serial
5290 snmp . . . . . . . . $enable_snmp
5291 swap . . . . . . . . $enable_swap
5292 syslog . . . . . . . $enable_syslog
5293 table . . . . . . . . $enable_table
5294 tail . . . . . . . . $enable_tail
5295 tape . . . . . . . . $enable_tape
5296 target_notification . $enable_target_notification
5297 target_replace . . . $enable_target_replace
5298 target_scale . . . . $enable_target_scale
5299 target_set . . . . . $enable_target_set
5300 target_v5upgrade . . $enable_target_v5upgrade
5301 tcpconns . . . . . . $enable_tcpconns
5302 teamspeak2 . . . . . $enable_teamspeak2
5303 ted . . . . . . . . . $enable_ted
5304 thermal . . . . . . . $enable_thermal
5305 threshold . . . . . . $enable_threshold
5306 tokyotyrant . . . . . $enable_tokyotyrant
5307 unixsock . . . . . . $enable_unixsock
5308 uptime . . . . . . . $enable_uptime
5309 users . . . . . . . . $enable_users
5310 uuid . . . . . . . . $enable_uuid
5311 varnish . . . . . . . $enable_varnish
5312 vmem . . . . . . . . $enable_vmem
5313 vserver . . . . . . . $enable_vserver
5314 wireless . . . . . . $enable_wireless
5315 write_graphite . . . $enable_write_graphite
5316 write_http . . . . . $enable_write_http
5317 write_mongodb . . . . $enable_write_mongodb
5318 write_redis . . . . . $enable_write_redis
5319 write_riemann . . . . $enable_write_riemann
5320 xmms . . . . . . . . $enable_xmms
5321 zfs_arc . . . . . . . $enable_zfs_arc
5325 if test "x$dependency_error" = "xyes"; then
5326 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5329 if test "x$dependency_warning" = "xyes"; then
5330 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5333 # vim: set fdm=marker :