1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AC_CONFIG_AUX_DIR([libltdl/config])
7 m4_ifdef([LT_PACKAGE_VERSION],
10 LT_CONFIG_LTDL_DIR([libltdl])
12 LTDL_INIT([convenience])
13 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
18 AC_LIBLTDL_CONVENIENCE
22 AC_CONFIG_SUBDIRS(libltdl)
23 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
27 AM_INIT_AUTOMAKE(dist-bzip2)
30 AC_PREFIX_DEFAULT("/opt/collectd")
35 # Checks for programs.
43 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
51 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
52 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
54 AC_MSG_CHECKING([for kernel type ($host_os)])
57 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
61 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
71 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
77 AC_MSG_RESULT([$ac_system])
79 if test "x$ac_system" = "xLinux"
81 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
82 if test -z "$KERNEL_DIR"
84 KERNEL_DIR="/lib/modules/`uname -r`/source"
87 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
88 AC_SUBST(KERNEL_CFLAGS)
91 if test "x$ac_system" = "xSolaris"
93 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
95 if test "x$ac_system" = "xAIX"
97 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
100 # Where to install .pc files.
101 pkgconfigdir="${libdir}/pkgconfig"
102 AC_SUBST(pkgconfigdir)
104 # Check for standards compliance mode
105 AC_ARG_ENABLE(standards,
106 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
107 [enable_standards="$enableval"],
108 [enable_standards="no"])
109 if test "x$enable_standards" = "xyes"
111 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
112 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Define to enforce POSIX.1-2001 compliance.])
113 AC_DEFINE(_XOPEN_SOURCE, 600, [Define to enforce X/Open 6 (XSI) compliance.])
114 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
116 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
119 # Checks for header files.
126 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)
129 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
134 # include <sys/types.h>
137 AC_CHECK_HEADERS(netinet/in.h, [], [],
142 # include <sys/types.h>
144 #if HAVE_NETINET_IN_SYSTM_H
145 # include <netinet/in_systm.h>
148 AC_CHECK_HEADERS(netinet/ip.h, [], [],
153 # include <sys/types.h>
155 #if HAVE_NETINET_IN_SYSTM_H
156 # include <netinet/in_systm.h>
158 #if HAVE_NETINET_IN_H
159 # include <netinet/in.h>
162 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
167 # include <sys/types.h>
169 #if HAVE_NETINET_IN_SYSTM_H
170 # include <netinet/in_systm.h>
172 #if HAVE_NETINET_IN_H
173 # include <netinet/in.h>
175 #if HAVE_NETINET_IP_H
176 # include <netinet/ip.h>
179 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
184 # include <sys/types.h>
186 #if HAVE_NETINET_IN_SYSTM_H
187 # include <netinet/in_systm.h>
189 #if HAVE_NETINET_IN_H
190 # include <netinet/in.h>
192 #if HAVE_NETINET_IP_H
193 # include <netinet/ip.h>
196 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
201 # include <sys/types.h>
203 #if HAVE_NETINET_IN_SYSTM_H
204 # include <netinet/in_systm.h>
206 #if HAVE_NETINET_IN_H
207 # include <netinet/in.h>
210 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
215 # include <sys/types.h>
217 #if HAVE_NETINET_IN_SYSTM_H
218 # include <netinet/in_systm.h>
220 #if HAVE_NETINET_IN_H
221 # include <netinet/in.h>
223 #if HAVE_NETINET_IP6_H
224 # include <netinet/ip6.h>
227 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
232 # include <sys/types.h>
234 #if HAVE_NETINET_IN_SYSTM_H
235 # include <netinet/in_systm.h>
237 #if HAVE_NETINET_IN_H
238 # include <netinet/in.h>
240 #if HAVE_NETINET_IP_H
241 # include <netinet/ip.h>
244 AC_CHECK_HEADERS(netinet/udp.h, [], [],
249 # include <sys/types.h>
251 #if HAVE_NETINET_IN_SYSTM_H
252 # include <netinet/in_systm.h>
254 #if HAVE_NETINET_IN_H
255 # include <netinet/in.h>
257 #if HAVE_NETINET_IP_H
258 # include <netinet/ip.h>
263 AC_CHECK_HEADERS(sys/dkstat.h)
264 if test "x$ac_system" = "xDarwin"
266 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)
267 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
269 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
272 # include <sys/types.h>
275 # include <sys/param.h>
279 AC_MSG_CHECKING([for sysctl kern.cp_times])
280 if test -x /sbin/sysctl
282 /sbin/sysctl kern.cp_times 2>/dev/null
286 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
287 [Define if sysctl supports kern.cp_times])
296 AC_CHECK_HEADERS(linux/major.h libgen.h)
298 # For the battery plugin
299 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
301 #if HAVE_IOKIT_IOKITLIB_H
302 # include <IOKit/IOKitLib.h>
304 #if HAVE_IOKIT_IOTYPES_H
305 # include <IOKit/IOTypes.h>
309 # For the swap module
310 have_linux_wireless_h="no"
311 if test "x$ac_system" = "xLinux"
313 AC_CHECK_HEADERS(linux/wireless.h,
314 [have_linux_wireless_h="yes"],
315 [have_linux_wireless_h="no"],
318 #include <sys/ioctl.h>
319 #include <sys/socket.h>
323 # For the swap module
324 have_sys_swap_h="yes"
325 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
327 #undef _FILE_OFFSET_BITS
328 #undef _LARGEFILE64_SOURCE
330 # include <sys/types.h>
333 # include <sys/param.h>
337 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
340 if test "x$GCC" = "xyes"
342 hint_64="CFLAGS='-m64'"
344 hint_64="CFLAGS='-xarch=v9'"
346 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
350 # For the processes plugin
352 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
354 # For interface plugin
355 AC_CHECK_HEADERS(ifaddrs.h)
356 AC_CHECK_HEADERS(net/if.h, [], [],
359 # include <sys/types.h>
361 #if HAVE_SYS_SOCKET_H
362 # include <sys/socket.h>
365 AC_CHECK_HEADERS(linux/if.h, [], [],
368 # include <sys/types.h>
370 #if HAVE_SYS_SOCKET_H
371 # include <sys/socket.h>
374 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
377 # include <sys/types.h>
379 #if HAVE_SYS_SOCKET_H
380 # include <sys/socket.h>
383 # include <linux/if.h>
388 have_linux_ip_vs_h="no"
389 have_net_ip_vs_h="no"
391 ip_vs_h_needs_kernel_cflags="no"
392 if test "x$ac_system" = "xLinux"
394 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
395 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
396 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
398 if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
400 SAVE_CFLAGS="$CFLAGS"
401 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
403 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
405 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
406 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
407 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
409 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
411 ip_vs_h_needs_kernel_cflags="yes"
414 CFLAGS="$SAVE_CFLAGS"
417 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
420 AC_CHECK_HEADERS(sys/ucred.h, [], [],
423 # include <sys/types.h>
426 # include <sys/param.h>
430 # For mount interface
431 AC_CHECK_HEADERS(sys/mount.h, [], [],
434 # include <sys/types.h>
437 # include <sys/param.h>
441 # For the email plugin
442 AC_CHECK_HEADERS(linux/un.h, [], [],
444 #if HAVE_SYS_SOCKET_H
445 # include <sys/socket.h>
449 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)
452 AC_CHECK_HEADERS(arpa/nameser.h)
453 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
455 #if HAVE_ARPA_NAMESER_H
456 # include <arpa/nameser.h>
460 AC_CHECK_HEADERS(net/if_arp.h, [], [],
461 [#if HAVE_SYS_SOCKET_H
462 # include <sys/socket.h>
465 AC_CHECK_HEADERS(net/ppp_defs.h)
466 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
467 [#if HAVE_NET_PPP_DEFS_H
468 # include <net/ppp_defs.h>
471 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
476 # include <sys/types.h>
478 #if HAVE_SYS_SOCKET_H
479 # include <sys/socket.h>
484 #if HAVE_NETINET_IN_H
485 # include <netinet/in.h>
489 # For the multimeter plugin
491 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
494 # Checks for typedefs, structures, and compiler characteristics.
503 # Checks for library functions.
505 AC_PROG_GCC_TRADITIONAL
506 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
510 SAVE_CFLAGS="$CFLAGS"
511 # Emulate behavior of src/Makefile.am
512 if test "x$GCC" = "xyes"
514 CFLAGS="$CFLAGS -Wall -Werror"
517 AC_CACHE_CHECK([for strtok_r],
518 [c_cv_have_strtok_r_default],
527 char buffer[] = "foo,bar,baz";
534 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
537 printf ("token = %s;\n", token);
540 [c_cv_have_strtok_r_default="yes"],
541 [c_cv_have_strtok_r_default="no"]
545 if test "x$c_cv_have_strtok_r_default" = "xno"
547 CFLAGS="$CFLAGS -D_REENTRANT=1"
549 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
550 [c_cv_have_strtok_r_reentrant],
559 char buffer[] = "foo,bar,baz";
566 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
569 printf ("token = %s;\n", token);
572 [c_cv_have_strtok_r_reentrant="yes"],
573 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
578 CFLAGS="$SAVE_CFLAGS"
579 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
581 CFLAGS="$CFLAGS -D_REENTRANT=1"
584 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
586 socket_needs_socket="no"
587 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
588 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
590 nanosleep_needs_rt="no"
591 nanosleep_needs_posix4="no"
592 AC_CHECK_FUNCS(nanosleep,
594 AC_CHECK_LIB(rt, nanosleep,
595 [nanosleep_needs_rt="yes"],
596 AC_CHECK_LIB(posix4, nanosleep,
597 [nanosleep_needs_posix4="yes"],
598 AC_MSG_ERROR(cannot find nanosleep))))
599 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
600 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$nanosleep_needs_posix4" = "xyes")
602 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
603 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
604 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
605 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
606 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
607 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
608 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
609 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
610 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
611 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
612 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
613 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
616 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
619 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
621 if test "x$withval" = "xno"; then
623 else if test "x$withval" = "xyes"; then
630 if test "x$nan_type" = "xnone"; then
631 AC_CACHE_CHECK([whether NAN is defined by default],
632 [c_cv_have_nan_default],
638 static double foo = NAN;
646 [c_cv_have_nan_default="yes"],
647 [c_cv_have_nan_default="no"]
650 if test "x$c_cv_have_nan_default" = "xyes"
655 if test "x$nan_type" = "xnone"; then
656 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
657 [c_cv_have_nan_isoc],
662 #define __USE_ISOC99 1
664 static double foo = NAN;
672 [c_cv_have_nan_isoc="yes"],
673 [c_cv_have_nan_isoc="no"]
676 if test "x$c_cv_have_nan_isoc" = "xyes"
681 if test "x$nan_type" = "xnone"; then
682 SAVE_LDFLAGS=$LDFLAGS
683 LDFLAGS="$LDFLAGS -lm"
684 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
685 [c_cv_have_nan_zero],
694 #define NAN (0.0 / 0.0)
696 # define isnan(f) ((f) != (f))
698 static double foo = NAN;
706 [c_cv_have_nan_zero="yes"],
707 [c_cv_have_nan_zero="no"]
710 LDFLAGS=$SAVE_LDFLAGS
711 if test "x$c_cv_have_nan_zero" = "xyes"
717 if test "x$nan_type" = "xdefault"; then
718 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
719 [Define if NAN is defined by default and can initialize static variables.])
720 else if test "x$nan_type" = "xisoc99"; then
721 AC_DEFINE(NAN_STATIC_ISOC, 1,
722 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
723 else if test "x$nan_type" = "xzero"; then
724 AC_DEFINE(NAN_ZERO_ZERO, 1,
725 [Define if NAN can be defined as (0.0 / 0.0)])
727 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
730 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
732 if test "x$withval" = "xnothing"; then
733 fp_layout_type="nothing"
734 else if test "x$withval" = "xendianflip"; then
735 fp_layout_type="endianflip"
736 else if test "x$withval" = "xintswap"; then
737 fp_layout_type="intswap"
739 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
742 [fp_layout_type="unknown"])
744 if test "x$fp_layout_type" = "xunknown"; then
745 AC_CACHE_CHECK([if doubles are stored in x86 representation],
746 [c_cv_fp_layout_need_nothing],
757 # include <inttypes.h>
760 # include <stdbool.h>
770 memcpy ((void *) &i0, (void *) &d, 8);
773 memcpy ((void *) c, (void *) &i1, 8);
775 if ((c[0] == 0x2f) && (c[1] == 0x25)
776 && (c[2] == 0xc0) && (c[3] == 0xc7)
777 && (c[4] == 0x43) && (c[5] == 0x2b)
778 && (c[6] == 0x1f) && (c[7] == 0x5b))
783 [c_cv_fp_layout_need_nothing="yes"],
784 [c_cv_fp_layout_need_nothing="no"]
787 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
788 fp_layout_type="nothing"
791 if test "x$fp_layout_type" = "xunknown"; then
792 AC_CACHE_CHECK([if endianflip converts to x86 representation],
793 [c_cv_fp_layout_need_endianflip],
804 # include <inttypes.h>
807 # include <stdbool.h>
809 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
810 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
811 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
812 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
813 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
814 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
815 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
816 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
825 memcpy ((void *) &i0, (void *) &d, 8);
827 i1 = endianflip (i0);
828 memcpy ((void *) c, (void *) &i1, 8);
830 if ((c[0] == 0x2f) && (c[1] == 0x25)
831 && (c[2] == 0xc0) && (c[3] == 0xc7)
832 && (c[4] == 0x43) && (c[5] == 0x2b)
833 && (c[6] == 0x1f) && (c[7] == 0x5b))
838 [c_cv_fp_layout_need_endianflip="yes"],
839 [c_cv_fp_layout_need_endianflip="no"]
842 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
843 fp_layout_type="endianflip"
846 if test "x$fp_layout_type" = "xunknown"; then
847 AC_CACHE_CHECK([if intswap converts to x86 representation],
848 [c_cv_fp_layout_need_intswap],
859 # include <inttypes.h>
862 # include <stdbool.h>
864 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
865 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
874 memcpy ((void *) &i0, (void *) &d, 8);
877 memcpy ((void *) c, (void *) &i1, 8);
879 if ((c[0] == 0x2f) && (c[1] == 0x25)
880 && (c[2] == 0xc0) && (c[3] == 0xc7)
881 && (c[4] == 0x43) && (c[5] == 0x2b)
882 && (c[6] == 0x1f) && (c[7] == 0x5b))
887 [c_cv_fp_layout_need_intswap="yes"],
888 [c_cv_fp_layout_need_intswap="no"]
891 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
892 fp_layout_type="intswap"
896 if test "x$fp_layout_type" = "xnothing"; then
897 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
898 [Define if doubles are stored in x86 representation.])
899 else if test "x$fp_layout_type" = "xendianflip"; then
900 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
901 [Define if endianflip is needed to convert to x86 representation.])
902 else if test "x$fp_layout_type" = "xintswap"; then
903 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
904 [Define if intswap is needed to convert to x86 representation.])
906 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
910 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
912 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
914 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
917 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
918 if test "x$have_getmntent" = "xno"; then
919 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
921 if test "x$have_getmntent" = "xno"; then
922 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
924 if test "x$have_getmntent" = "xno"; then
925 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
928 if test "x$have_getmntent" = "xc"; then
929 AC_CACHE_CHECK([whether getmntent takes one argument],
930 [c_cv_have_one_getmntent],
932 [AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
933 #include "$srcdir/src/utils_mount.h"]],
937 fh = setmntent ("/etc/mtab", "r");
941 [c_cv_have_one_getmntent="yes"],
942 [c_cv_have_one_getmntent="no"]
945 AC_CACHE_CHECK([whether getmntent takes two arguments],
946 [c_cv_have_two_getmntent],
948 [AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
949 #include "$srcdir/src/utils_mount.h"]],
954 fh = fopen ("/etc/mnttab", "r");
955 status = getmntent (fh, &mt);
958 [c_cv_have_two_getmntent="yes"],
959 [c_cv_have_two_getmntent="no"]
964 # Check for different versions of `getmntent' here..
966 if test "x$have_getmntent" = "xc"; then
967 if test "x$c_cv_have_one_getmntent" = "xyes"; then
968 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
969 [Define if the function getmntent exists and takes one argument.])
971 if test "x$c_cv_have_two_getmntent" = "xyes"; then
972 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
973 [Define if the function getmntent exists and takes two arguments.])
976 if test "x$have_getmntent" = "xsun"; then
977 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
978 [Define if the function getmntent exists. It's the version from libsun.])
980 if test "x$have_getmntent" = "xseq"; then
981 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
982 [Define if the function getmntent exists. It's the version from libseq.])
984 if test "x$have_getmntent" = "xgen"; then
985 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
986 [Define if the function getmntent exists. It's the version from libgen.])
990 AC_MSG_CHECKING([if have htonll defined])
995 #include <sys/types.h>
996 #include <netinet/in.h>
998 # include <inttypes.h>
1005 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1008 AC_MSG_RESULT([$have_htonll])
1010 # Check for structures
1011 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1012 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1015 #include <sys/types.h>
1016 #include <sys/socket.h>
1019 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1020 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1023 #include <sys/types.h>
1024 #include <sys/socket.h>
1025 #include <linux/if.h>
1026 #include <linux/netdevice.h>
1029 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1032 #include <netinet/in.h>
1036 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1038 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1039 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1040 have_struct_kinfo_proc_freebsd="yes"
1043 have_struct_kinfo_proc_freebsd="no"
1048 #include <sys/param.h>
1049 #include <sys/sysctl.h>
1050 #include <sys/user.h>
1053 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1055 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1056 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1057 have_struct_kinfo_proc_openbsd="yes"
1060 have_struct_kinfo_proc_openbsd="no"
1064 #include <sys/param.h>
1065 #include <sys/sysctl.h>
1069 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1070 [#define _BSD_SOURCE
1072 # include <stdint.h>
1074 #if HAVE_SYS_TYPES_H
1075 # include <sys/types.h>
1077 #if HAVE_NETINET_IN_SYSTM_H
1078 # include <netinet/in_systm.h>
1080 #if HAVE_NETINET_IN_H
1081 # include <netinet/in.h>
1083 #if HAVE_NETINET_IP_H
1084 # include <netinet/ip.h>
1086 #if HAVE_NETINET_UDP_H
1087 # include <netinet/udp.h>
1090 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1091 [#define _BSD_SOURCE
1093 # include <stdint.h>
1095 #if HAVE_SYS_TYPES_H
1096 # include <sys/types.h>
1098 #if HAVE_NETINET_IN_SYSTM_H
1099 # include <netinet/in_systm.h>
1101 #if HAVE_NETINET_IN_H
1102 # include <netinet/in.h>
1104 #if HAVE_NETINET_IP_H
1105 # include <netinet/ip.h>
1107 #if HAVE_NETINET_UDP_H
1108 # include <netinet/udp.h>
1112 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1122 # Checks for libraries begin here
1124 with_libresolv="yes"
1125 AC_CHECK_LIB(resolv, res_search,
1127 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1129 [with_libresolv="no"])
1130 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1132 dnl Check for HAL (hardware abstraction library)
1134 AC_CHECK_LIB(hal,libhal_device_property_exists,
1135 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1137 if test "x$with_libhal" = "xyes"; then
1138 if test "x$PKG_CONFIG" != "x"; then
1139 BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`"
1140 BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`"
1141 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1142 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1146 m4_divert_once([HELP_WITH], [
1147 collectd additional packages:])
1149 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1151 if test "x$ac_system" = "xAIX"
1156 with_perfstat="no (AIX only)"
1157 with_procinfo="no (AIX only)"
1160 if test "x$with_perfstat" = "xyes"
1162 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1163 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1165 if test "x$with_perfstat" = "xyes"
1167 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1169 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1171 # Processes plugin under AIX.
1172 if test "x$with_procinfo" = "xyes"
1174 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1176 if test "x$with_procinfo" = "xyes"
1178 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1181 if test "x$ac_system" = "xSolaris"
1186 with_kstat="no (Solaris only)"
1187 with_devinfo="no (Solaris only)"
1190 if test "x$with_kstat" = "xyes"
1192 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1194 if test "x$with_kstat" = "xyes"
1196 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1197 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1199 if test "x$with_kstat" = "xyes"
1201 AC_DEFINE(HAVE_LIBKSTAT, 1,
1202 [Define to 1 if you have the 'kstat' library (-lkstat)])
1204 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1205 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1208 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1215 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1218 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1219 if test "x$with_kvm_getprocs" = "xyes"
1221 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1222 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1225 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1227 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1228 if test "x$with_kvm_getswapinfo" = "xyes"
1230 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1231 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1234 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1236 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1237 if test "x$with_kvm_nlist" = "xyes"
1239 AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1240 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1241 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1244 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1246 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1247 if test "x$with_kvm_openfiles" = "xyes"
1249 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1250 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1253 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1255 # --with-libcurl {{{
1256 with_curl_config="curl-config"
1259 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1261 if test "x$withval" = "xno"
1264 else if test "x$withval" = "xyes"
1268 if test -f "$withval" && test -x "$withval"
1270 with_curl_config="$withval"
1272 else if test -x "$withval/bin/curl-config"
1274 with_curl_config="$withval/bin/curl-config"
1283 if test "x$with_libcurl" = "xyes"
1285 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1286 curl_config_status=$?
1288 if test $curl_config_status -ne 0
1290 with_libcurl="no ($with_curl_config failed)"
1292 SAVE_CPPFLAGS="$CPPFLAGS"
1293 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1295 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1297 CPPFLAGS="$SAVE_CPPFLAGS"
1300 if test "x$with_libcurl" = "xyes"
1302 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1303 curl_config_status=$?
1305 if test $curl_config_status -ne 0
1307 with_libcurl="no ($with_curl_config failed)"
1309 AC_CHECK_LIB(curl, curl_easy_init,
1310 [with_libcurl="yes"],
1311 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1315 if test "x$with_libcurl" = "xyes"
1317 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1318 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1319 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1320 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1322 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1326 with_libdbi_cppflags=""
1327 with_libdbi_ldflags=""
1328 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1330 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1332 with_libdbi_cppflags="-I$withval/include"
1333 with_libdbi_ldflags="-L$withval/lib"
1336 with_libdbi="$withval"
1342 if test "x$with_libdbi" = "xyes"
1344 SAVE_CPPFLAGS="$CPPFLAGS"
1345 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1347 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1349 CPPFLAGS="$SAVE_CPPFLAGS"
1351 if test "x$with_libdbi" = "xyes"
1353 SAVE_CPPFLAGS="$CPPFLAGS"
1354 SAVE_LDFLAGS="$LDFLAGS"
1355 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1356 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1358 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1360 CPPFLAGS="$SAVE_CPPFLAGS"
1361 LDFLAGS="$SAVE_LDFLAGS"
1363 if test "x$with_libdbi" = "xyes"
1365 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1366 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1367 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1368 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1369 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1370 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1372 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1375 # --with-libesmtp {{{
1376 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1378 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1380 LDFLAGS="$LDFLAGS -L$withval/lib"
1381 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1384 with_libesmtp="$withval"
1390 if test "x$with_libesmtp" = "xyes"
1392 AC_CHECK_LIB(esmtp, smtp_create_session,
1394 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1395 ], [with_libesmtp="no (libesmtp not found)"])
1397 if test "x$with_libesmtp" = "xyes"
1399 AC_CHECK_HEADERS(libesmtp.h,
1401 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1402 ], [with_libesmtp="no (libesmtp.h not found)"])
1404 if test "x$with_libesmtp" = "xyes"
1410 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1411 [Wether or not to use the esmtp library])
1412 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1415 # --with-libganglia {{{
1416 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1418 if test -f "$withval" && test -x "$withval"
1420 with_libganglia_config="$withval"
1421 with_libganglia="yes"
1422 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1424 with_libganglia_config="$withval/bin/ganglia-config"
1425 with_libganglia="yes"
1426 else if test -d "$withval"
1428 GANGLIA_CPPFLAGS="-I$withval/include"
1429 GANGLIA_LDFLAGS="-L$withval/lib"
1430 with_libganglia="yes"
1432 with_libganglia_config="ganglia-config"
1433 with_libganglia="$withval"
1437 with_libganglia_config="ganglia-config"
1438 with_libganglia="yes"
1441 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1443 if test "x$GANGLIA_CPPFLAGS" = "x"
1445 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1448 if test "x$GANGLIA_LDFLAGS" = "x"
1450 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1453 if test "x$GANGLIA_LIBS" = "x"
1455 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1459 SAVE_CPPFLAGS="$CPPFLAGS"
1460 SAVE_LDFLAGS="$LDFLAGS"
1461 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1462 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1464 if test "x$with_libganglia" = "xyes"
1466 AC_CHECK_HEADERS(gm_protocol.h,
1468 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1469 [Define to 1 if you have the <gm_protocol.h> header file.])
1470 ], [with_libganglia="no (gm_protocol.h not found)"])
1473 if test "x$with_libganglia" = "xyes"
1475 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1477 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1478 [Define to 1 if you have the ganglia library (-lganglia).])
1479 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1482 CPPFLAGS="$SAVE_CPPFLAGS"
1483 LDFLAGS="$SAVE_LDFLAGS"
1485 AC_SUBST(GANGLIA_CPPFLAGS)
1486 AC_SUBST(GANGLIA_LDFLAGS)
1487 AC_SUBST(GANGLIA_LIBS)
1488 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1491 # --with-libgcrypt {{{
1492 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1493 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1494 GCRYPT_LIBS="$GCRYPT_LIBS"
1495 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1497 if test -f "$withval" && test -x "$withval"
1499 with_libgcrypt_config="$withval"
1500 with_libgcrypt="yes"
1501 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1503 with_libgcrypt_config="$withval/bin/gcrypt-config"
1504 with_libgcrypt="yes"
1505 else if test -d "$withval"
1507 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1508 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1509 with_libgcrypt="yes"
1511 with_libgcrypt_config="gcrypt-config"
1512 with_libgcrypt="$withval"
1516 with_libgcrypt_config="libgcrypt-config"
1517 with_libgcrypt="yes"
1520 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1522 if test "x$GCRYPT_CPPFLAGS" = "x"
1524 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1527 if test "x$GCRYPT_LDFLAGS" = "x"
1529 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1530 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1533 if test "x$GCRYPT_LIBS" = "x"
1535 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1539 SAVE_CPPFLAGS="$CPPFLAGS"
1540 SAVE_LDFLAGS="$LDFLAGS"
1541 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1542 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1544 if test "x$with_libgcrypt" = "xyes"
1546 if test "x$GCRYPT_CPPFLAGS" != "x"
1548 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1550 AC_CHECK_HEADERS(gcrypt.h,
1551 [with_libgcrypt="yes"],
1552 [with_libgcrypt="no (gcrypt.h not found)"])
1555 if test "x$with_libgcrypt" = "xyes"
1557 if test "x$GCRYPT_LDFLAGS" != "x"
1559 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1561 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1562 [with_libgcrypt="yes"],
1563 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1565 if test "$with_libgcrypt" != "no"; then
1566 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1570 CPPFLAGS="$SAVE_CPPFLAGS"
1571 LDFLAGS="$SAVE_LDFLAGS"
1573 if test "x$with_libgcrypt" = "xyes"
1575 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1578 AC_SUBST(GCRYPT_CPPFLAGS)
1579 AC_SUBST(GCRYPT_LDFLAGS)
1580 AC_SUBST(GCRYPT_LIBS)
1581 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1584 # --with-libiptc {{{
1585 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1587 if test "x$withval" = "xshipped"
1590 else if test "x$withval" = "xyes"
1592 with_libiptc="pkgconfig"
1593 else if test "x$withval" = "xno"
1598 with_libiptc_cflags="-I$withval/include"
1599 with_libiptc_libs="-L$withval/lib"
1603 if test "x$ac_system" = "xLinux"
1605 with_libiptc="pkgconfig"
1607 with_libiptc="no (Linux only)"
1611 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
1613 with_libiptc="no (Don't have pkg-config)"
1616 if test "x$with_libiptc" = "xpkgconfig"
1618 $PKG_CONFIG --exists 'libiptc' 2>/dev/null
1621 with_libiptc="no (pkg-config doesn't know libiptc)"
1624 if test "x$with_libiptc" = "xpkgconfig"
1626 with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
1629 with_libiptc="no ($PKG_CONFIG failed)"
1631 with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
1634 with_libiptc="no ($PKG_CONFIG failed)"
1638 SAVE_CPPFLAGS="$CPPFLAGS"
1639 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
1641 # check whether the header file for libiptc is available.
1642 if test "x$with_libiptc" = "xpkgconfig"
1644 AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
1645 [with_libiptc="no (header file missing)"])
1647 # If the header file is available, check for the required type declaractions.
1648 # They may be missing in old versions of libiptc. In that case, they will be
1649 # declared in the iptables plugin.
1650 if test "x$with_libiptc" = "xpkgconfig"
1652 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
1654 # Check for the iptc_init symbol in the library.
1655 # This could be in iptc or ip4tc
1656 if test "x$with_libiptc" = "xpkgconfig"
1659 AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
1660 [with_libiptc="pkgconfig"],
1661 [with_libiptc="no"],
1662 [$with_libiptc_libs])
1665 if test "x$with_libiptc" = "xpkgconfig"
1670 CPPFLAGS="$SAVE_CPPFLAGS"
1672 if test "x$with_libiptc" = "xown"
1674 with_libiptc_cflags=""
1675 with_libiptc_libs=""
1677 if test "x$with_libiptc" = "xown"
1679 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1681 with_libiptc="no (Linux iptables headers not found)"
1684 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1687 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
1688 if test "x$with_libiptc" = "xown"
1690 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1694 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1695 if test "x$with_libiptc" = "xyes"
1697 BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
1698 BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
1699 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1700 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1705 with_java_home="$JAVA_HOME"
1706 with_java_vmtype="client"
1711 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1713 if test "x$withval" = "xno"
1716 else if test "x$withval" = "xyes"
1720 with_java_home="$withval"
1725 if test "x$with_java" = "xyes"
1727 if test -d "$with_java_home"
1729 AC_MSG_CHECKING([for jni.h])
1730 TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1731 if test "x$TMPVAR" != "x"
1733 AC_MSG_RESULT([found in $TMPVAR])
1734 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
1736 AC_MSG_RESULT([not found])
1739 AC_MSG_CHECKING([for jni_md.h])
1740 TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1741 if test "x$TMPVAR" != "x"
1743 AC_MSG_RESULT([found in $TMPVAR])
1744 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
1746 AC_MSG_RESULT([not found])
1749 AC_MSG_CHECKING([for libjvm.so])
1750 TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1751 if test "x$TMPVAR" != "x"
1753 AC_MSG_RESULT([found in $TMPVAR])
1754 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
1756 AC_MSG_RESULT([not found])
1759 if test "x$JAVAC" = "x"
1761 AC_MSG_CHECKING([for javac])
1762 TMPVAR=`find "$with_java_home" -name javac -type f | head -n 1`
1763 if test "x$TMPVAR" != "x"
1766 AC_MSG_RESULT([$JAVAC])
1768 AC_MSG_RESULT([not found])
1771 if test "x$JAR" = "x"
1773 AC_MSG_CHECKING([for jar])
1774 TMPVAR=`find "$with_java_home" -name jar -type f | head -n 1`
1775 if test "x$TMPVAR" != "x"
1778 AC_MSG_RESULT([$JAR])
1780 AC_MSG_RESULT([not found])
1783 else if test "x$with_java_home" != "x"
1785 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1789 if test "x$JAVA_CPPFLAGS" != "x"
1791 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1793 if test "x$JAVA_CFLAGS" != "x"
1795 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1797 if test "x$JAVA_LDFLAGS" != "x"
1799 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1801 if test "x$JAVAC" = "x"
1803 with_javac_path="$PATH"
1804 if test "x$with_java_home" != "x"
1806 with_javac_path="$with_java_home:with_javac_path"
1807 if test -d "$with_java_home/bin"
1809 with_javac_path="$with_java_home/bin:with_javac_path"
1813 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1815 if test "x$JAVAC" = "x"
1817 with_java="no (javac not found)"
1819 if test "x$JAR" = "x"
1821 with_jar_path="$PATH"
1822 if test "x$with_java_home" != "x"
1824 with_jar_path="$with_java_home:$with_jar_path"
1825 if test -d "$with_java_home/bin"
1827 with_jar_path="$with_java_home/bin:$with_jar_path"
1831 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
1833 if test "x$JAR" = "x"
1835 with_java="no (jar not found)"
1838 SAVE_CPPFLAGS="$CPPFLAGS"
1839 SAVE_CFLAGS="$CFLAGS"
1840 SAVE_LDFLAGS="$LDFLAGS"
1841 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1842 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1843 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1845 if test "x$with_java" = "xyes"
1847 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1849 if test "x$with_java" = "xyes"
1851 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1853 [with_java="no (libjvm not found)"],
1856 if test "x$with_java" = "xyes"
1858 JAVA_LIBS="$JAVA_LIBS -ljvm"
1859 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1862 CPPFLAGS="$SAVE_CPPFLAGS"
1863 CFLAGS="$SAVE_CFLAGS"
1864 LDFLAGS="$SAVE_LDFLAGS"
1866 AC_SUBST(JAVA_CPPFLAGS)
1867 AC_SUBST(JAVA_CFLAGS)
1868 AC_SUBST(JAVA_LDFLAGS)
1870 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1873 # --with-libmemcached {{{
1874 with_libmemcached_cppflags=""
1875 with_libmemcached_ldflags=""
1876 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1878 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1880 with_libmemcached_cppflags="-I$withval/include"
1881 with_libmemcached_ldflags="-L$withval/lib"
1882 with_libmemcached="yes"
1884 with_libmemcached="$withval"
1888 with_libmemcached="yes"
1890 if test "x$with_libmemcached" = "xyes"
1892 SAVE_CPPFLAGS="$CPPFLAGS"
1893 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1895 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1897 CPPFLAGS="$SAVE_CPPFLAGS"
1899 if test "x$with_libmemcached" = "xyes"
1901 SAVE_CPPFLAGS="$CPPFLAGS"
1902 SAVE_LDFLAGS="$LDFLAGS"
1903 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1904 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1906 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1908 CPPFLAGS="$SAVE_CPPFLAGS"
1909 LDFLAGS="$SAVE_LDFLAGS"
1911 if test "x$with_libmemcached" = "xyes"
1913 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1914 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1915 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1916 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1917 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1918 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1919 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1921 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1924 # --with-libmodbus {{{
1925 with_libmodbus_config=""
1926 with_libmodbus_cflags=""
1927 with_libmodbus_libs=""
1928 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
1930 if test "x$withval" = "xno"
1933 else if test "x$withval" = "xyes"
1935 with_libmodbus="use_pkgconfig"
1936 else if test -d "$with_libmodbus/lib"
1938 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
1939 with_libmodbus_cflags="-I$withval/include"
1940 with_libmodbus_libs="-L$withval/lib -lmodbus"
1941 with_libmodbus="yes"
1944 [with_libmodbus="use_pkgconfig"])
1946 # configure using pkg-config
1947 if test "x$with_libmodbus" = "xuse_pkgconfig"
1949 if test "x$PKG_CONFIG" = "x"
1951 with_libmodbus="no (Don't have pkg-config)"
1954 if test "x$with_libmodbus" = "xuse_pkgconfig"
1956 AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
1957 $PKG_CONFIG --exists 'modbus' 2>/dev/null
1960 with_libmodbus="no (pkg-config doesn't know library)"
1963 if test "x$with_libmodbus" = "xuse_pkgconfig"
1965 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
1968 with_libmodbus="no ($PKG_CONFIG failed)"
1970 with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
1973 with_libmodbus="no ($PKG_CONFIG failed)"
1976 if test "x$with_libmodbus" = "xuse_pkgconfig"
1978 with_libmodbus="yes"
1981 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
1982 # the actual checks.
1983 if test "x$with_libmodbus" = "xyes"
1985 SAVE_CPPFLAGS="$CPPFLAGS"
1986 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1988 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
1990 CPPFLAGS="$SAVE_CPPFLAGS"
1992 if test "x$with_libmodbus" = "xyes"
1994 SAVE_CPPFLAGS="$CPPFLAGS"
1995 SAVE_LDFLAGS="$LDFLAGS"
1997 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1998 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2000 AC_CHECK_LIB(modbus, modbus_init_tcp,
2001 [with_libmodbus="yes"],
2002 [with_libmodbus="no (symbol modbus_init_tcp not found)"])
2004 CPPFLAGS="$SAVE_CPPFLAGS"
2005 LDFLAGS="$SAVE_LDFLAGS"
2007 if test "x$with_libmodbus" = "xyes"
2009 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2010 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2011 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2012 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2016 # --with-libmysql {{{
2017 with_mysql_config="mysql_config"
2018 with_mysql_cflags=""
2020 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2022 if test "x$withval" = "xno"
2025 else if test "x$withval" = "xyes"
2029 if test -f "$withval" && test -x "$withval";
2031 with_mysql_config="$withval"
2032 else if test -x "$withval/bin/mysql_config"
2034 with_mysql_config="$withval/bin/mysql_config"
2042 if test "x$with_libmysql" = "xyes"
2044 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2045 mysql_config_status=$?
2047 if test $mysql_config_status -ne 0
2049 with_libmysql="no ($with_mysql_config failed)"
2051 SAVE_CPPFLAGS="$CPPFLAGS"
2052 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2055 have_mysql_mysql_h="no"
2056 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2058 if test "x$have_mysql_h" = "xno"
2060 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2063 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2065 with_libmysql="no (mysql.h not found)"
2068 CPPFLAGS="$SAVE_CPPFLAGS"
2071 if test "x$with_libmysql" = "xyes"
2073 with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2074 mysql_config_status=$?
2076 if test $mysql_config_status -ne 0
2078 with_libmysql="no ($with_mysql_config failed)"
2080 AC_CHECK_LIB(mysqlclient, mysql_init,
2081 [with_libmysql="yes"],
2082 [with_libmysql="no (symbol 'mysql_init' not found)"],
2085 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2086 [with_libmysql="yes"],
2087 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2091 if test "x$with_libmysql" = "xyes"
2093 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2094 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2095 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2096 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2098 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2101 # --with-libnetlink {{{
2102 with_libnetlink_cflags=""
2103 with_libnetlink_libs="-lnetlink"
2104 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2106 echo "libnetlink: withval = $withval"
2107 if test "x$withval" = "xyes"
2109 with_libnetlink="yes"
2110 else if test "x$withval" = "xno"
2112 with_libnetlink="no"
2114 if test -d "$withval/include"
2116 with_libnetlink_cflags="-I$withval/include"
2117 with_libnetlink_libs="-L$withval/lib -lnetlink"
2118 with_libnetlink="yes"
2120 AC_MSG_ERROR("no such directory: $withval/include")
2125 if test "x$ac_system" = "xLinux"
2127 with_libnetlink="yes"
2129 with_libnetlink="no (Linux only library)"
2132 if test "x$with_libnetlink" = "xyes"
2134 SAVE_CFLAGS="$CFLAGS"
2135 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2137 with_libnetlink="no (libnetlink.h not found)"
2139 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2141 with_libnetlink="yes"
2145 #include <sys/types.h>
2146 #include <asm/types.h>
2147 #include <sys/socket.h>
2148 #include <linux/netlink.h>
2149 #include <linux/rtnetlink.h>])
2150 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2152 #include <sys/types.h>
2153 #include <asm/types.h>
2154 #include <sys/socket.h>])
2156 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2159 #include <sys/types.h>
2160 #include <asm/types.h>
2161 #include <sys/socket.h>
2162 #include <linux/netlink.h>
2163 #include <linux/rtnetlink.h>
2165 int retval = TCA_STATS2;
2169 [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2171 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2172 [[[#include <stdio.h>
2173 #include <sys/types.h>
2174 #include <asm/types.h>
2175 #include <sys/socket.h>
2176 #include <linux/netlink.h>
2177 #include <linux/rtnetlink.h>
2181 int retval = TCA_STATS;
2184 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2187 CFLAGS="$SAVE_CFLAGS"
2189 if test "x$with_libnetlink" = "xyes"
2191 AC_CHECK_LIB(netlink, rtnl_open,
2192 [with_libnetlink="yes"],
2193 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2194 [$with_libnetlink_libs])
2196 if test "x$with_libnetlink" = "xyes"
2198 SAVE_CFLAGS="$CFLAGS"
2199 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2202 [if function 'rtnl_dump_filter' expects five arguments],
2203 [c_cv_rtnl_dump_filter_five_args],
2204 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2206 #include <asm/types.h>
2207 #include <sys/socket.h>
2208 #if HAVE_LIBNETLINK_H
2209 # include <libnetlink.h>
2210 #elif HAVE_IPROUTE_LIBNETLINK_H
2211 # include <iproute/libnetlink.h>
2212 #elif HAVE_LINUX_LIBNETLINK_H
2213 # include <linux/libnetlink.h>
2216 if (rtnl_dump_filter(NULL, NULL, NULL, NULL, NULL))
2221 [c_cv_rtnl_dump_filter_five_args="yes"],
2222 [c_cv_rtnl_dump_filter_five_args="no"]
2227 [if function 'rtnl_dump_filter' expects three arguments],
2228 [c_cv_rtnl_dump_filter_three_args],
2229 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2232 #include <asm/types.h>
2233 #include <sys/socket.h>
2234 #if HAVE_LIBNETLINK_H
2235 # include <libnetlink.h>
2236 #elif HAVE_IPROUTE_LIBNETLINK_H
2237 # include <iproute/libnetlink.h>
2238 #elif HAVE_LINUX_LIBNETLINK_H
2239 # include <linux/libnetlink.h>
2242 if (rtnl_dump_filter(NULL, NULL, NULL))
2247 [c_cv_rtnl_dump_filter_three_args="yes"],
2248 [c_cv_rtnl_dump_filter_three_args="no"]
2252 CFLAGS="$SAVE_CFLAGS"
2254 if test "x$c_cv_rtnl_dump_filter_five_args" = "xyes"
2256 AC_DEFINE(RTNL_DUMP_FILTER_FIVE_ARGS, 1,
2257 [Define to 1 if function 'rtnl_dump_filter' expects five arguments.])
2259 if test "x$c_cv_rtnl_dump_filter_three_args" = "xyes"
2261 AC_DEFINE(RTNL_DUMP_FILTER_THREE_ARGS, 1,
2262 [Define to 1 if function 'rtnl_dump_filter' expects three arguments.])
2265 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2266 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2267 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2268 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2270 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2273 # --with-libnetapp {{{
2274 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2275 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2276 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2277 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2278 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2279 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2280 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2282 if test -d "$withval"
2284 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2285 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2286 with_libnetapp="yes"
2288 with_libnetapp="$withval"
2292 with_libnetapp="yes"
2295 SAVE_CPPFLAGS="$CPPFLAGS"
2296 SAVE_LDFLAGS="$LDFLAGS"
2297 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2298 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2300 if test "x$with_libnetapp" = "xyes"
2302 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2304 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2306 AC_CHECK_HEADERS(netapp_api.h,
2307 [with_libnetapp="yes"],
2308 [with_libnetapp="no (netapp_api.h not found)"])
2311 if test "x$with_libnetapp" = "xyes"
2313 if test "x$LIBNETAPP_LDFLAGS" != "x"
2315 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2318 if test "x$LIBNETAPP_LIBS" = "x"
2320 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2322 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2324 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2325 [with_libnetapp="yes"],
2326 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2328 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2331 CPPFLAGS="$SAVE_CPPFLAGS"
2332 LDFLAGS="$SAVE_LDFLAGS"
2334 if test "x$with_libnetapp" = "xyes"
2336 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2339 AC_SUBST(LIBNETAPP_CPPFLAGS)
2340 AC_SUBST(LIBNETAPP_LDFLAGS)
2341 AC_SUBST(LIBNETAPP_LIBS)
2342 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2345 # --with-libnetsnmp {{{
2346 with_snmp_config="net-snmp-config"
2349 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2351 if test "x$withval" = "xno"
2353 with_libnetsnmp="no"
2354 else if test "x$withval" = "xyes"
2356 with_libnetsnmp="yes"
2358 if test -x "$withval"
2360 with_snmp_config="$withval"
2361 with_libnetsnmp="yes"
2363 with_snmp_config="$withval/bin/net-snmp-config"
2364 with_libnetsnmp="yes"
2368 [with_libnetsnmp="yes"])
2369 if test "x$with_libnetsnmp" = "xyes"
2371 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2372 snmp_config_status=$?
2374 if test $snmp_config_status -ne 0
2376 with_libnetsnmp="no ($with_snmp_config failed)"
2378 SAVE_CPPFLAGS="$CPPFLAGS"
2379 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2381 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2383 CPPFLAGS="$SAVE_CPPFLAGS"
2386 if test "x$with_libnetsnmp" = "xyes"
2388 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2389 snmp_config_status=$?
2391 if test $snmp_config_status -ne 0
2393 with_libnetsnmp="no ($with_snmp_config failed)"
2395 AC_CHECK_LIB(netsnmp, init_snmp,
2396 [with_libnetsnmp="yes"],
2397 [with_libnetsnmp="no (libnetsnmp not found)"],
2401 if test "x$with_libnetsnmp" = "xyes"
2403 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2404 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2405 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2406 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2408 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2411 # --with-liboconfig {{{
2412 with_own_liboconfig="no"
2413 liboconfig_LDFLAGS="$LDFLAGS"
2414 liboconfig_CPPFLAGS="$CPPFLAGS"
2415 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2417 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2419 if test -d "$withval/lib"
2421 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2423 if test -d "$withval/include"
2425 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2428 if test "x$withval" = "xno"
2430 AC_MSG_ERROR("liboconfig is required")
2434 with_liboconfig="yes"
2437 save_LDFLAGS="$LDFLAGS"
2438 save_CPPFLAGS="$CPPFLAGS"
2439 LDFLAGS="$liboconfig_LDFLAGS"
2440 CPPFLAGS="$liboconfig_CPPFLAGS"
2441 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2443 with_liboconfig="yes"
2444 with_own_liboconfig="no"
2447 with_liboconfig="yes"
2448 with_own_liboconfig="yes"
2449 LDFLAGS="$save_LDFLAGS"
2450 CPPFLAGS="$save_CPPFLAGS"
2453 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2454 if test "x$with_own_liboconfig" = "xyes"
2456 with_liboconfig="yes (shipped version)"
2460 # --with-liboping {{{
2461 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2463 if test "x$withval" = "xyes"
2466 else if test "x$withval" = "xno"
2471 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2472 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2475 [with_liboping="yes"])
2477 SAVE_CPPFLAGS="$CPPFLAGS"
2478 SAVE_LDFLAGS="$LDFLAGS"
2480 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2481 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2483 if test "x$with_liboping" = "xyes"
2485 if test "x$LIBOPING_CPPFLAGS" != "x"
2487 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2489 AC_CHECK_HEADERS(oping.h,
2490 [with_liboping="yes"],
2491 [with_liboping="no ('oping.h' not found)"])
2493 if test "x$with_liboping" = "xyes"
2495 if test "x$LIBOPING_LDFLAGS" != "x"
2497 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2499 AC_CHECK_LIB(oping, ping_construct,
2500 [with_liboping="yes"],
2501 [with_liboping="no (symbol 'ping_construct' not found)"])
2504 CPPFLAGS="$SAVE_CPPFLAGS"
2505 LDFLAGS="$SAVE_LDFLAGS"
2507 if test "x$with_liboping" = "xyes"
2509 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2510 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2511 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2512 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2514 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2518 with_oracle_cppflags=""
2520 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2522 if test "x$withval" = "xyes"
2524 if test "x$ORACLE_HOME" = "x"
2526 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2529 else if test "x$withval" = "xno"
2534 ORACLE_HOME="$withval"
2538 if test "x$ORACLE_HOME" = "x"
2540 with_oracle="no (ORACLE_HOME is not set)"
2545 if test "x$ORACLE_HOME" != "x"
2547 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2549 if test -e "$ORACLE_HOME/lib/ldflags"
2551 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2553 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2554 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2556 if test "x$with_oracle" = "xyes"
2558 SAVE_CPPFLAGS="$CPPFLAGS"
2559 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2561 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2563 CPPFLAGS="$SAVE_CPPFLAGS"
2565 if test "x$with_oracle" = "xyes"
2567 SAVE_CPPFLAGS="$CPPFLAGS"
2568 SAVE_LDFLAGS="$LDFLAGS"
2569 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2570 LDFLAGS="$LDFLAGS $with_oracle_libs"
2572 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2574 CPPFLAGS="$SAVE_CPPFLAGS"
2575 LDFLAGS="$SAVE_LDFLAGS"
2577 if test "x$with_oracle" = "xyes"
2579 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2580 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2581 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2582 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2586 # --with-libowcapi {{{
2587 with_libowcapi_cppflags=""
2588 with_libowcapi_libs="-lowcapi"
2589 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2591 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2593 with_libowcapi_cppflags="-I$withval/include"
2594 with_libowcapi_libs="-L$withval/lib -lowcapi"
2595 with_libowcapi="yes"
2597 with_libowcapi="$withval"
2601 with_libowcapi="yes"
2603 if test "x$with_libowcapi" = "xyes"
2605 SAVE_CPPFLAGS="$CPPFLAGS"
2606 CPPFLAGS="$with_libowcapi_cppflags"
2608 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2610 CPPFLAGS="$SAVE_CPPFLAGS"
2612 if test "x$with_libowcapi" = "xyes"
2614 SAVE_LDFLAGS="$LDFLAGS"
2615 SAVE_CPPFLAGS="$CPPFLAGS"
2616 LDFLAGS="$with_libowcapi_libs"
2617 CPPFLAGS="$with_libowcapi_cppflags"
2619 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2621 LDFLAGS="$SAVE_LDFLAGS"
2622 CPPFLAGS="$SAVE_CPPFLAGS"
2624 if test "x$with_libowcapi" = "xyes"
2626 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2627 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2628 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2629 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2633 # --with-libpcap {{{
2634 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2636 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2638 LDFLAGS="$LDFLAGS -L$withval/lib"
2639 CPPFLAGS="$CPPFLAGS -I$withval/include"
2642 with_libpcap="$withval"
2648 if test "x$with_libpcap" = "xyes"
2650 AC_CHECK_LIB(pcap, pcap_open_live,
2652 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2653 ], [with_libpcap="no (libpcap not found)"])
2655 if test "x$with_libpcap" = "xyes"
2657 AC_CHECK_HEADERS(pcap.h,,
2658 [with_libpcap="no (pcap.h not found)"])
2660 if test "x$with_libpcap" = "xyes"
2662 AC_CHECK_HEADERS(pcap-bpf.h)
2664 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2667 # --with-libperl {{{
2668 perl_interpreter="perl"
2669 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2671 if test -f "$withval" && test -x "$withval"
2673 perl_interpreter="$withval"
2675 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2677 LDFLAGS="$LDFLAGS -L$withval/lib"
2678 CPPFLAGS="$CPPFLAGS -I$withval/include"
2679 perl_interpreter="$withval/bin/perl"
2682 with_libperl="$withval"
2689 AC_MSG_CHECKING([for perl])
2690 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2691 if test -x "$perl_interpreter"
2693 AC_MSG_RESULT([yes ($perl_interpreter)])
2699 AC_SUBST(PERL, "$perl_interpreter")
2701 if test "x$with_libperl" = "xyes" \
2702 && test -n "$perl_interpreter"
2704 SAVE_CFLAGS="$CFLAGS"
2705 SAVE_LDFLAGS="$LDFLAGS"
2706 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2707 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2708 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2709 CFLAGS="$CFLAGS $PERL_CFLAGS"
2710 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2712 AC_CACHE_CHECK([for libperl],
2713 [c_cv_have_libperl],
2717 #define PERL_NO_GET_CONTEXT
2724 load_module (PERL_LOADMOD_NOIMPORT,
2725 newSVpv ("Collectd::Plugin::FooBar", 24),
2728 [c_cv_have_libperl="yes"],
2729 [c_cv_have_libperl="no"]
2733 if test "x$c_cv_have_libperl" = "xyes"
2735 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2736 AC_SUBST(PERL_CFLAGS)
2737 AC_SUBST(PERL_LDFLAGS)
2742 CFLAGS="$SAVE_CFLAGS"
2743 LDFLAGS="$SAVE_LDFLAGS"
2744 else if test -z "$perl_interpreter"; then
2745 with_libperl="no (no perl interpreter found)"
2746 c_cv_have_libperl="no"
2748 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2750 if test "x$with_libperl" = "xyes"
2752 SAVE_CFLAGS="$CFLAGS"
2753 SAVE_LDFLAGS="$LDFLAGS"
2754 CFLAGS="$CFLAGS $PERL_CFLAGS"
2755 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2757 AC_CACHE_CHECK([if perl supports ithreads],
2758 [c_cv_have_perl_ithreads],
2766 #if !defined(USE_ITHREADS)
2767 # error "Perl does not support ithreads!"
2768 #endif /* !defined(USE_ITHREADS) */
2771 [c_cv_have_perl_ithreads="yes"],
2772 [c_cv_have_perl_ithreads="no"]
2776 if test "x$c_cv_have_perl_ithreads" = "xyes"
2778 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2781 CFLAGS="$SAVE_CFLAGS"
2782 LDFLAGS="$SAVE_LDFLAGS"
2785 if test "x$with_libperl" = "xyes"
2787 SAVE_CFLAGS="$CFLAGS"
2788 SAVE_LDFLAGS="$LDFLAGS"
2789 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2790 # (see issues #41 and #42)
2791 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2792 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2794 AC_CACHE_CHECK([for broken Perl_load_module()],
2795 [c_cv_have_broken_perl_load_module],
2799 #define PERL_NO_GET_CONTEXT
2806 load_module (PERL_LOADMOD_NOIMPORT,
2807 newSVpv ("Collectd::Plugin::FooBar", 24),
2810 [c_cv_have_broken_perl_load_module="no"],
2811 [c_cv_have_broken_perl_load_module="yes"]
2815 CFLAGS="$SAVE_CFLAGS"
2816 LDFLAGS="$SAVE_LDFLAGS"
2818 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2819 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2821 if test "x$with_libperl" = "xyes"
2823 SAVE_CFLAGS="$CFLAGS"
2824 SAVE_LDFLAGS="$LDFLAGS"
2825 CFLAGS="$CFLAGS $PERL_CFLAGS"
2826 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2829 [struct mgvtbl.svt_local],
2830 [have_struct_mgvtbl_svt_local="yes"],
2831 [have_struct_mgvtbl_svt_local="no"],
2838 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2840 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2841 [Define if Perl's struct mgvtbl has member svt_local.])
2844 CFLAGS="$SAVE_CFLAGS"
2845 LDFLAGS="$SAVE_LDFLAGS"
2850 with_pg_config="pg_config"
2851 with_libpq_includedir=""
2852 with_libpq_libdir=""
2853 with_libpq_cppflags=""
2854 with_libpq_ldflags=""
2855 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2858 if test "x$withval" = "xno"
2861 else if test "x$withval" = "xyes"
2865 if test -f "$withval" && test -x "$withval";
2867 with_pg_config="$withval"
2868 else if test -x "$withval/bin/pg_config"
2870 with_pg_config="$withval/bin/pg_config"
2878 if test "x$with_libpq" = "xyes"
2880 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2883 if test $pg_config_status -eq 0
2885 if test -n "$with_libpq_includedir"; then
2886 for dir in $with_libpq_includedir; do
2887 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2891 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2894 SAVE_CPPFLAGS="$CPPFLAGS"
2895 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2897 AC_CHECK_HEADERS(libpq-fe.h, [],
2898 [with_libpq="no (libpq-fe.h not found)"], [])
2900 CPPFLAGS="$SAVE_CPPFLAGS"
2902 if test "x$with_libpq" = "xyes"
2904 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2907 if test $pg_config_status -eq 0
2909 if test -n "$with_libpq_libdir"; then
2910 for dir in $with_libpq_libdir; do
2911 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2915 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2918 SAVE_LDFLAGS="$LDFLAGS"
2919 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2921 AC_CHECK_LIB(pq, PQconnectdb,
2923 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2925 AC_CHECK_LIB(pq, PQserverVersion,
2927 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2929 LDFLAGS="$SAVE_LDFLAGS"
2931 if test "x$with_libpq" = "xyes"
2933 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2934 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2935 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2936 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2938 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2941 # --with-libpthread {{{
2942 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2943 [ if test "x$withval" != "xno" \
2944 && test "x$withval" != "xyes"
2946 LDFLAGS="$LDFLAGS -L$withval/lib"
2947 CPPFLAGS="$CPPFLAGS -I$withval/include"
2948 with_libpthread="yes"
2950 if test "x$withval" = "xno"
2952 with_libpthread="no (disabled)"
2955 ], [with_libpthread="yes"])
2956 if test "x$with_libpthread" = "xyes"
2958 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2961 if test "x$with_libpthread" = "xyes"
2963 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2965 if test "x$with_libpthread" = "xyes"
2971 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2972 [Wether or not to use pthread (POSIX threads) library])
2973 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2978 with_python_path="$PATH"
2979 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
2981 if test "x$withval" = "xyes" || test "x$withval" = "xno"
2983 with_python="$withval"
2984 else if test -x "$withval"
2986 with_python_prog="$withval"
2987 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
2989 else if test -d "$withval"
2991 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
2994 AC_MSG_WARN([Argument not recognized: $withval])
2996 ], [with_python="yes"])
2999 SAVE_CPPFLAGS="$CPPFLAGS"
3000 SAVE_LDFLAGS="$LDFLAGS"
3003 PATH="$with_python_path"
3005 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3007 AC_MSG_CHECKING([for python])
3008 with_python_prog="`which python 2>/dev/null`"
3009 if test "x$with_python_prog" = "x"
3011 AC_MSG_RESULT([not found])
3012 with_python="no (interpreter not found)"
3014 AC_MSG_RESULT([$with_python_prog])
3018 if test "x$with_python" = "xyes"
3020 AC_MSG_CHECKING([for Python CPPFLAGS])
3021 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3022 python_config_status=$?
3024 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3026 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3029 AC_MSG_RESULT([$python_include_path])
3033 if test "x$with_python" = "xyes"
3035 CPPFLAGS="-I$python_include_path $CPPFLAGS"
3036 AC_CHECK_HEADERS(Python.h,
3037 [with_python="yes"],
3038 [with_python="no ('Python.h' not found)"])
3041 if test "x$with_python" = "xyes"
3043 AC_MSG_CHECKING([for Python LDFLAGS])
3044 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`
3045 python_config_status=$?
3047 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3049 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3052 AC_MSG_RESULT([$python_library_path])
3056 if test "x$with_python" = "xyes"
3058 AC_MSG_CHECKING([for Python LIBS])
3059 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`
3060 python_config_status=$?
3062 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3064 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3067 AC_MSG_RESULT([$python_library_flags])
3071 if test "x$with_python" = "xyes"
3073 LDFLAGS="-L$python_library_path $LDFLAGS"
3074 LIBS="$python_library_flags $LIBS"
3076 AC_CHECK_FUNC(PyObject_CallFunction,
3077 [with_python="yes"],
3078 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3082 CPPFLAGS="$SAVE_CPPFLAGS"
3083 LDFLAGS="$SAVE_LDFLAGS"
3086 if test "x$with_python" = "xyes"
3088 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3089 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3090 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3091 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3092 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3093 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3097 # --with-librouteros {{{
3098 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3100 if test "x$withval" = "xyes"
3102 with_librouteros="yes"
3103 else if test "x$withval" = "xno"
3105 with_librouteros="no"
3107 with_librouteros="yes"
3108 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3109 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3112 [with_librouteros="yes"])
3114 SAVE_CPPFLAGS="$CPPFLAGS"
3115 SAVE_LDFLAGS="$LDFLAGS"
3117 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3118 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3120 if test "x$with_librouteros" = "xyes"
3122 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3124 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3126 AC_CHECK_HEADERS(routeros_api.h,
3127 [with_librouteros="yes"],
3128 [with_librouteros="no ('routeros_api.h' not found)"])
3130 if test "x$with_librouteros" = "xyes"
3132 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3134 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3136 AC_CHECK_LIB(routeros, ros_interface,
3137 [with_librouteros="yes"],
3138 [with_librouteros="no (symbol 'ros_interface' not found)"])
3141 CPPFLAGS="$SAVE_CPPFLAGS"
3142 LDFLAGS="$SAVE_LDFLAGS"
3144 if test "x$with_librouteros" = "xyes"
3146 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3147 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3148 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3149 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3151 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3155 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3158 librrd_threadsafe="yes"
3159 librrd_rrdc_update="no"
3160 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3161 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3163 librrd_cflags="-I$withval/include"
3164 librrd_ldflags="-L$withval/lib"
3167 with_librrd="$withval"
3169 ], [with_librrd="yes"])
3170 if test "x$with_librrd" = "xyes"
3172 SAVE_CPPFLAGS="$CPPFLAGS"
3173 SAVE_LDFLAGS="$LDFLAGS"
3175 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3176 LDFLAGS="$LDFLAGS $librrd_ldflags"
3178 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3180 CPPFLAGS="$SAVE_CPPFLAGS"
3181 LDFLAGS="$SAVE_LDFLAGS"
3183 if test "x$with_librrd" = "xyes"
3185 SAVE_CPPFLAGS="$CPPFLAGS"
3186 SAVE_LDFLAGS="$LDFLAGS"
3188 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3189 LDFLAGS="$LDFLAGS $librrd_ldflags"
3191 AC_CHECK_LIB(rrd_th, rrd_update_r,
3193 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3195 [librrd_threadsafe="no"
3196 AC_CHECK_LIB(rrd, rrd_update,
3198 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3200 [with_librrd="no (symbol 'rrd_update' not found)"],
3205 if test "x$librrd_threadsafe" = "xyes"
3207 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3209 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3212 CPPFLAGS="$SAVE_CPPFLAGS"
3213 LDFLAGS="$SAVE_LDFLAGS"
3215 if test "x$with_librrd" = "xyes"
3217 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3218 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3219 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3220 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3222 if test "x$librrd_threadsafe" = "xyes"
3224 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3228 # --with-libsensors {{{
3229 with_sensors_cflags=""
3230 with_sensors_ldflags=""
3231 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3233 if test "x$withval" = "xno"
3235 with_libsensors="no"
3237 with_libsensors="yes"
3238 if test "x$withval" != "xyes"
3240 with_sensors_cflags="-I$withval/include"
3241 with_sensors_ldflags="-L$withval/lib"
3242 with_libsensors="yes"
3247 if test "x$ac_system" = "xLinux"
3249 with_libsensors="yes"
3251 with_libsensors="no (Linux only library)"
3254 if test "x$with_libsensors" = "xyes"
3256 SAVE_CPPFLAGS="$CPPFLAGS"
3257 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3259 # AC_CHECK_HEADERS(sensors/sensors.h,
3261 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3263 # [with_libsensors="no (sensors/sensors.h not found)"])
3264 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3266 CPPFLAGS="$SAVE_CPPFLAGS"
3268 if test "x$with_libsensors" = "xyes"
3270 SAVE_CPPFLAGS="$CPPFLAGS"
3271 SAVE_LDFLAGS="$LDFLAGS"
3272 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3273 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3275 AC_CHECK_LIB(sensors, sensors_init,
3277 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3279 [with_libsensors="no (libsensors not found)"])
3281 CPPFLAGS="$SAVE_CPPFLAGS"
3282 LDFLAGS="$SAVE_LDFLAGS"
3284 if test "x$with_libsensors" = "xyes"
3286 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3287 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3288 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3289 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3291 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3294 # --with-libstatgrab {{{
3295 with_libstatgrab_cflags=""
3296 with_libstatgrab_ldflags=""
3297 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3299 if test "x$withval" != "xno" \
3300 && test "x$withval" != "xyes"
3302 with_libstatgrab_cflags="-I$withval/include"
3303 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3304 with_libstatgrab="yes"
3305 with_libstatgrab_pkg_config="no"
3307 with_libstatgrab="$withval"
3308 with_libstatgrab_pkg_config="yes"
3312 with_libstatgrab="yes"
3313 with_libstatgrab_pkg_config="yes"
3316 if test "x$with_libstatgrab" = "xyes" \
3317 && test "x$with_libstatgrab_pkg_config" = "xyes"
3319 if test "x$PKG_CONFIG" != "x"
3321 AC_MSG_CHECKING([pkg-config for libstatgrab])
3323 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3326 with_libstatgrab_pkg_config="no"
3327 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
3328 temp_result="not found"
3330 AC_MSG_RESULT([$temp_result])
3332 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3333 with_libstatgrab_pkg_config="no"
3334 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3338 if test "x$with_libstatgrab" = "xyes" \
3339 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3340 && test "x$with_libstatgrab_cflags" = "x"
3342 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3343 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3346 with_libstatgrab_cflags="$temp_result"
3348 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3349 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3351 AC_MSG_RESULT([$temp_result])
3354 if test "x$with_libstatgrab" = "xyes" \
3355 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3356 && test "x$with_libstatgrab_ldflags" = "x"
3358 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3359 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3362 with_libstatgrab_ldflags="$temp_result"
3364 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3365 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3367 AC_MSG_RESULT([$temp_result])
3370 if test "x$with_libstatgrab" = "xyes"
3372 SAVE_CPPFLAGS="$CPPFLAGS"
3373 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3375 AC_CHECK_HEADERS(statgrab.h,
3376 [with_libstatgrab="yes"],
3377 [with_libstatgrab="no (statgrab.h not found)"])
3379 CPPFLAGS="$SAVE_CPPFLAGS"
3382 if test "x$with_libstatgrab" = "xyes"
3384 SAVE_CFLAGS="$CFLAGS"
3385 SAVE_LDFLAGS="$LDFLAGS"
3387 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3388 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3390 AC_CHECK_LIB(statgrab, sg_init,
3391 [with_libstatgrab="yes"],
3392 [with_libstatgrab="no (symbol sg_init not found)"])
3394 CFLAGS="$SAVE_CFLAGS"
3395 LDFLAGS="$SAVE_LDFLAGS"
3398 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3399 if test "x$with_libstatgrab" = "xyes"
3401 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3402 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3403 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3404 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3405 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3409 # --with-libtokyotyrant {{{
3410 with_libtokyotyrant_cppflags=""
3411 with_libtokyotyrant_ldflags=""
3412 with_libtokyotyrant_libs=""
3413 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3415 if test "x$withval" = "xno"
3417 with_libtokyotyrant="no"
3418 else if test "x$withval" = "xyes"
3420 with_libtokyotyrant="yes"
3422 with_libtokyotyrant_cppflags="-I$withval/include"
3423 with_libtokyotyrant_ldflags="-L$withval/include"
3424 with_libtokyotyrant_libs="-ltokyotyrant"
3425 with_libtokyotyrant="yes"
3429 with_libtokyotyrant="yes"
3432 if test "x$with_libtokyotyrant" = "xyes"
3434 if $PKG_CONFIG --exists tokyotyrant
3436 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3437 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`"
3438 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`"
3442 SAVE_CPPFLAGS="$CPPFLAGS"
3443 SAVE_LDFLAGS="$LDFLAGS"
3444 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3445 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3447 if test "x$with_libtokyotyrant" = "xyes"
3449 AC_CHECK_HEADERS(tcrdb.h,
3451 AC_DEFINE(HAVE_TCRDB_H, 1,
3452 [Define to 1 if you have the <tcrdb.h> header file.])
3453 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3456 if test "x$with_libtokyotyrant" = "xyes"
3458 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3460 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3461 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3463 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3464 [$with_libtokyotyrant_libs])
3467 CPPFLAGS="$SAVE_CPPFLAGS"
3468 LDFLAGS="$SAVE_LDFLAGS"
3470 if test "x$with_libtokyotyrant" = "xyes"
3472 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3473 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3474 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3475 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3476 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3477 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3479 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3482 # --with-libupsclient {{{
3483 with_libupsclient_config=""
3484 with_libupsclient_cflags=""
3485 with_libupsclient_libs=""
3486 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3488 if test "x$withval" = "xno"
3490 with_libupsclient="no"
3491 else if test "x$withval" = "xyes"
3493 with_libupsclient="use_pkgconfig"
3495 if test -x "$withval"
3497 with_libupsclient_config="$withval"
3498 with_libupsclient="use_libupsclient_config"
3499 else if test -x "$withval/bin/libupsclient-config"
3501 with_libupsclient_config="$withval/bin/libupsclient-config"
3502 with_libupsclient="use_libupsclient_config"
3504 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3505 with_libupsclient_cflags="-I$withval/include"
3506 with_libupsclient_libs="-L$withval/lib -lupsclient"
3507 with_libupsclient="yes"
3511 [with_libupsclient="use_pkgconfig"])
3513 # configure using libupsclient-config
3514 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3516 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3517 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3520 with_libupsclient="no ($with_libupsclient_config failed)"
3522 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3525 with_libupsclient="no ($with_libupsclient_config failed)"
3528 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3530 with_libupsclient="yes"
3533 # configure using pkg-config
3534 if test "x$with_libupsclient" = "xuse_pkgconfig"
3536 if test "x$PKG_CONFIG" = "x"
3538 with_libupsclient="no (Don't have pkg-config)"
3541 if test "x$with_libupsclient" = "xuse_pkgconfig"
3543 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3544 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3547 with_libupsclient="no (pkg-config doesn't know library)"
3550 if test "x$with_libupsclient" = "xuse_pkgconfig"
3552 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3555 with_libupsclient="no ($PKG_CONFIG failed)"
3557 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3560 with_libupsclient="no ($PKG_CONFIG failed)"
3563 if test "x$with_libupsclient" = "xuse_pkgconfig"
3565 with_libupsclient="yes"
3568 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3569 # the actual checks.
3570 if test "x$with_libupsclient" = "xyes"
3572 SAVE_CPPFLAGS="$CPPFLAGS"
3573 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3575 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3577 CPPFLAGS="$SAVE_CPPFLAGS"
3579 if test "x$with_libupsclient" = "xyes"
3581 SAVE_CPPFLAGS="$CPPFLAGS"
3582 SAVE_LDFLAGS="$LDFLAGS"
3584 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3585 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3587 AC_CHECK_LIB(upsclient, upscli_connect,
3588 [with_libupsclient="yes"],
3589 [with_libupsclient="no (symbol upscli_connect not found)"])
3591 CPPFLAGS="$SAVE_CPPFLAGS"
3592 LDFLAGS="$SAVE_LDFLAGS"
3594 if test "x$with_libupsclient" = "xyes"
3596 SAVE_CPPFLAGS="$CPPFLAGS"
3597 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3599 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3600 [#include <stdlib.h>
3602 #include <upsclient.h>])
3604 CPPFLAGS="$SAVE_CPPFLAGS"
3606 if test "x$with_libupsclient" = "xyes"
3608 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3609 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3610 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3611 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3615 # --with-libxmms {{{
3616 with_xmms_config="xmms-config"
3619 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3621 if test "x$withval" != "xno" \
3622 && test "x$withval" != "xyes"
3624 if test -f "$withval" && test -x "$withval";
3626 with_xmms_config="$withval"
3627 else if test -x "$withval/bin/xmms-config"
3629 with_xmms_config="$withval/bin/xmms-config"
3632 else if test "x$withval" = "xno"
3642 if test "x$with_libxmms" = "xyes"
3644 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3645 xmms_config_status=$?
3647 if test $xmms_config_status -ne 0
3652 if test "x$with_libxmms" = "xyes"
3654 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3655 xmms_config_status=$?
3657 if test $xmms_config_status -ne 0
3662 if test "x$with_libxmms" = "xyes"
3664 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3666 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3667 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3668 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3669 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3676 with_libxmms_numeric=0
3677 if test "x$with_libxmms" = "xyes"
3679 with_libxmms_numeric=1
3681 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3682 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3685 # --with-libyajl {{{
3686 with_libyajl_cppflags=""
3687 with_libyajl_ldflags=""
3688 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3690 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3692 with_libyajl_cppflags="-I$withval/include"
3693 with_libyajl_ldflags="-L$withval/lib"
3696 with_libyajl="$withval"
3702 if test "x$with_libyajl" = "xyes"
3704 SAVE_CPPFLAGS="$CPPFLAGS"
3705 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3707 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3708 AC_CHECK_HEADERS(yajl/yajl_version.h)
3710 CPPFLAGS="$SAVE_CPPFLAGS"
3712 if test "x$with_libyajl" = "xyes"
3714 SAVE_CPPFLAGS="$CPPFLAGS"
3715 SAVE_LDFLAGS="$LDFLAGS"
3716 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3717 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3719 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3721 CPPFLAGS="$SAVE_CPPFLAGS"
3722 LDFLAGS="$SAVE_LDFLAGS"
3724 if test "x$with_libyajl" = "xyes"
3726 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3727 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3728 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3729 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3730 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3731 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3732 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3734 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3737 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3738 with_libxml2="no (pkg-config isn't available)"
3739 with_libxml2_cflags=""
3740 with_libxml2_ldflags=""
3741 with_libvirt="no (pkg-config isn't available)"
3742 with_libvirt_cflags=""
3743 with_libvirt_ldflags=""
3744 if test "x$PKG_CONFIG" != "x"
3746 $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
3751 with_libxml2="no (pkg-config doesn't know library)"
3754 $PKG_CONFIG --exists libvirt 2>/dev/null
3759 with_libvirt="no (pkg-config doesn't know library)"
3762 if test "x$with_libxml2" = "xyes"
3764 with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
3769 with_libxml2_ldflags="$PKG_CONFIG --libs libxml-2.0`"
3775 if test "x$with_libxml2" = "xyes"
3777 SAVE_CPPFLAGS="$CPPFLAGS"
3778 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3780 AC_CHECK_HEADERS(libxml/parser.h, [],
3781 [with_libxml2="no (libxml/parser.h not found)"])
3783 CPPFLAGS="$SAVE_CPPFLAGS"
3785 if test "x$with_libxml2" = "xyes"
3787 SAVE_CFLAGS="$CFLAGS"
3788 SAVE_LDFLAGS="$LDFLAGS"
3790 CFLAGS="$CFLAGS $with_libxml2_cflags"
3791 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3793 AC_CHECK_LIB(xml2, xmlXPathEval,
3794 [with_libxml2="yes"],
3795 [with_libxml2="no (symbol xmlXPathEval not found)"])
3797 CFLAGS="$SAVE_CFLAGS"
3798 LDFLAGS="$SAVE_LDFLAGS"
3800 dnl Add the right compiler flags and libraries.
3801 if test "x$with_libxml2" = "xyes"; then
3802 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3803 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3804 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3805 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3807 if test "x$with_libvirt" = "xyes"
3809 with_libvirt_cflags="$PKG_CONFIG --cflags libvirt`"
3814 with_libvirt_ldflags="$PKG_CONFIG --libs libvirt`"
3820 if test "x$with_libvirt" = "xyes"
3822 SAVE_CPPFLAGS="$CPPFLAGS"
3823 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3825 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3826 [with_libvirt="no (libvirt/libvirt.h not found)"])
3828 CPPFLAGS="$SAVE_CPPFLAGS"
3830 if test "x$with_libvirt" = "xyes"
3832 SAVE_CFLAGS="$CFLAGS"
3833 SAVE_LDFLAGS="$LDFLAGS"
3835 CFLAGS="$CFLAGS $with_libvirt_cflags"
3836 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3838 AC_CHECK_LIB(virt, virDomainBlockStats,
3839 [with_libvirt="yes"],
3840 [with_libvirt="no (symbol virDomainBlockStats not found)"])
3842 CFLAGS="$SAVE_CFLAGS"
3843 LDFLAGS="$SAVE_LDFLAGS"
3845 dnl Add the right compiler flags and libraries.
3846 if test "x$with_libvirt" = "xyes"; then
3847 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3848 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3849 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3850 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3854 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3855 with_libopenipmipthread="yes"
3856 with_libopenipmipthread_cflags=""
3857 with_libopenipmipthread_libs=""
3859 AC_MSG_CHECKING([for pkg-config])
3861 if test "x$PKG_CONFIG" = "x"
3863 with_libopenipmipthread="no"
3866 temp_result="$PKG_CONFIG"
3868 AC_MSG_RESULT([$temp_result])
3870 if test "x$with_libopenipmipthread" = "xyes"
3872 AC_MSG_CHECKING([for libOpenIPMIpthread])
3873 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3876 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3878 AC_MSG_RESULT([$with_libopenipmipthread])
3881 if test "x$with_libopenipmipthread" = "xyes"
3883 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3884 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3887 with_libopenipmipthread_cflags="$temp_result"
3889 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3890 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3892 AC_MSG_RESULT([$temp_result])
3895 if test "x$with_libopenipmipthread" = "xyes"
3897 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3898 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3901 with_libopenipmipthread_ldflags="$temp_result"
3903 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3904 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3906 AC_MSG_RESULT([$temp_result])
3909 if test "x$with_libopenipmipthread" = "xyes"
3911 SAVE_CPPFLAGS="$CPPFLAGS"
3912 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3914 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3915 [with_libopenipmipthread="yes"],
3916 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3917 [#include <OpenIPMI/ipmiif.h>
3918 #include <OpenIPMI/ipmi_err.h>
3919 #include <OpenIPMI/ipmi_posix.h>
3920 #include <OpenIPMI/ipmi_conn.h>
3923 CPPFLAGS="$SAVE_CPPFLAGS"
3926 if test "x$with_libopenipmipthread" = "xyes"
3928 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3929 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3930 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3931 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3935 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3936 [with_libnotify="yes"],
3937 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3939 # Check for enabled/disabled features
3942 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3943 # ------------------------------------------------------------
3945 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3950 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3955 m4_define([EnDis],[disabled])dnl
3956 m4_define([YesNo],[no])dnl
3962 m4_define([EnDis],[enabled])dnl
3963 m4_define([YesNo],[yes])dnl
3966 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3970 m4_if([$3], [feature], [],
3974 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3980 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3982 enable_$1='[YesNo]'dnl
3984 if test "x$enable_$1" = "xno"
3988 if test "x$enable_$1" = "xyes"
3992 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3997 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3998 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4000 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4002 # AC_PLUGIN(name, default, info)
4003 # ------------------------------------------------------------
4010 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
4012 if test "x$enableval" = "xyes"
4015 else if test "x$enableval" = "xforce"
4020 enable_plugin="no (disabled on command line)"
4024 if test "x$enable_all_plugins" = "xauto"
4026 if test "x$2" = "xyes"
4033 enable_plugin="$enable_all_plugins"
4036 if test "x$enable_plugin" = "xyes"
4038 if test "x$2" = "xyes" || test "x$force" = "xyes"
4040 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4041 if test "x$2" != "xyes"
4043 dependency_warning="yes"
4045 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4046 dependency_error="yes"
4047 enable_plugin="no (dependency error)"
4050 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4051 enable_$1="$enable_plugin"
4053 )# AC_PLUGIN(name, default, info)
4055 m4_divert_once([HELP_ENABLE], [
4056 collectd features:])
4057 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4058 AC_COLLECTD([debug], [enable], [feature], [debugging])
4059 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
4060 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
4062 dependency_warning="no"
4063 dependency_error="no"
4068 plugin_conntrack="no"
4069 plugin_contextswitch="no"
4072 plugin_curl_json="no"
4073 plugin_curl_xml="no"
4077 plugin_interface="no"
4084 plugin_multimeter="no"
4088 plugin_processes="no"
4089 plugin_protocols="no"
4093 plugin_tcpconns="no"
4100 plugin_wireless="no"
4104 if test "x$ac_system" = "xLinux"
4106 plugin_battery="yes"
4107 plugin_conntrack="yes"
4108 plugin_contextswitch="yes"
4110 plugin_cpufreq="yes"
4112 plugin_entropy="yes"
4113 plugin_interface="yes"
4118 plugin_fscache="yes"
4119 plugin_processes="yes"
4120 plugin_protocols="yes"
4123 plugin_tcpconns="yes"
4124 plugin_thermal="yes"
4127 plugin_vserver="yes"
4128 plugin_wireless="yes"
4130 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4136 if test "x$ac_system" = "xOpenBSD"
4138 plugin_tcpconns="yes"
4142 if test "x$with_libiokit" = "xyes"
4144 plugin_battery="yes"
4149 if test "x$with_perfstat" = "xyes"
4155 plugin_interface="yes"
4159 if test "x$with_procinfo" = "xyes"
4161 plugin_processes="yes"
4165 if test "x$with_kstat" = "xyes"
4168 plugin_zfs_arc="yes"
4171 if test "x$with_devinfo$with_kstat" = "xyesyes"
4175 plugin_interface="yes"
4180 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
4186 if test "x$with_libstatgrab" = "xyes"
4190 plugin_interface="yes"
4197 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4203 if test "x$with_libopenipmipthread" = "xyes"
4208 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4210 plugin_curl_json="yes"
4213 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4215 plugin_curl_xml="yes"
4218 if test "x$have_processor_info" = "xyes"
4222 if test "x$have_sysctl" = "xyes"
4229 if test "x$have_sysctlbyname" = "xyes"
4233 plugin_tcpconns="yes"
4236 # Df plugin: Check if we know how to determine mount points first.
4237 #if test "x$have_listmntent" = "xyes"; then
4240 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4244 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4248 #if test "x$have_getmntent" = "xseq"
4252 if test "x$c_cv_have_one_getmntent" = "xyes"
4257 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4258 if test "x$plugin_df" = "xyes"
4261 if test "x$have_statfs" = "xyes"
4265 if test "x$have_statvfs" = "xyes"
4271 if test "x$have_getifaddrs" = "xyes"
4273 plugin_interface="yes"
4276 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4278 plugin_libvirt="yes"
4281 if test "x$have_getloadavg" = "xyes"
4286 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4291 # Mac OS X memory interface
4292 if test "x$have_host_statistics" = "xyes"
4297 if test "x$have_termios_h" = "xyes"
4299 plugin_multimeter="yes"
4303 if test "x$have_thread_info" = "xyes"
4305 plugin_processes="yes"
4308 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4310 plugin_processes="yes"
4313 if test "x$with_kvm_getswapinfo" = "xyes"
4318 if test "x$have_swapctl" = "xyes"
4323 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4325 plugin_tcpconns="yes"
4328 if test "x$have_getutent" = "xyes"
4332 if test "x$have_getutxent" = "xyes"
4337 m4_divert_once([HELP_ENABLE], [
4340 AC_ARG_ENABLE([all-plugins],
4341 AC_HELP_STRING([--enable-all-plugins],
4342 [enable all plugins (auto by def)]),
4344 if test "x$enableval" = "xyes"
4346 enable_all_plugins="yes"
4347 else if test "x$enableval" = "xauto"
4349 enable_all_plugins="auto"
4351 enable_all_plugins="no"
4354 [enable_all_plugins="auto"])
4356 m4_divert_once([HELP_ENABLE], [])
4358 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4359 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4360 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4361 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4362 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4363 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4364 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4365 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4366 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4367 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4368 AC_PLUGIN([csv], [yes], [CSV output plugin])
4369 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4370 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4371 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4372 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4373 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4374 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4375 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4376 AC_PLUGIN([email], [yes], [EMail statistics])
4377 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4378 AC_PLUGIN([exec], [yes], [Execution of external programs])
4379 AC_PLUGIN([filecount], [yes], [Count files in directories])
4380 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4381 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4382 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4383 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4384 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4385 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4386 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4387 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4388 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4389 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4390 AC_PLUGIN([load], [$plugin_load], [System load])
4391 AC_PLUGIN([logfile], [yes], [File logging plugin])
4392 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4393 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4394 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4395 AC_PLUGIN([match_regex], [yes], [The regex match])
4396 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4397 AC_PLUGIN([match_value], [yes], [The value match])
4398 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4399 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4400 AC_PLUGIN([memcached], [yes], [memcached statistics])
4401 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4402 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4403 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4404 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4405 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4406 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4407 AC_PLUGIN([network], [yes], [Network communication plugin])
4408 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4409 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4410 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4411 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4412 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4413 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4414 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4415 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4416 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4417 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4418 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4419 # FIXME: Check for libevent, too.
4420 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4421 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4422 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4423 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4424 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4425 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4426 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4427 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4428 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4429 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4430 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4431 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4432 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4433 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4434 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4435 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4436 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4437 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4438 AC_PLUGIN([target_notification], [yes], [The notification target])
4439 AC_PLUGIN([target_replace], [yes], [The replace target])
4440 AC_PLUGIN([target_scale],[yes], [The scale target])
4441 AC_PLUGIN([target_set], [yes], [The set target])
4442 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4443 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4444 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4445 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4446 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4447 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4448 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4449 AC_PLUGIN([users], [$plugin_users], [User statistics])
4450 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4451 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4452 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4453 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4454 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4455 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4456 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4458 dnl Default configuration file
4459 # Load either syslog or logfile
4460 LOAD_PLUGIN_SYSLOG=""
4461 LOAD_PLUGIN_LOGFILE=""
4463 AC_MSG_CHECKING([which default log plugin to load])
4464 default_log_plugin="none"
4465 if test "x$enable_syslog" = "xyes"
4467 default_log_plugin="syslog"
4469 LOAD_PLUGIN_SYSLOG="##"
4472 if test "x$enable_logfile" = "xyes"
4474 if test "x$default_log_plugin" = "xnone"
4476 default_log_plugin="logfile"
4478 LOAD_PLUGIN_LOGFILE="#"
4481 LOAD_PLUGIN_LOGFILE="##"
4483 AC_MSG_RESULT([$default_log_plugin])
4485 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4486 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4488 DEFAULT_LOG_LEVEL="info"
4489 if test "x$enable_debug" = "xyes"
4491 DEFAULT_LOG_LEVEL="debug"
4493 AC_SUBST(DEFAULT_LOG_LEVEL)
4495 # Load only one of rrdtool, network, csv in the default config.
4496 LOAD_PLUGIN_RRDTOOL=""
4497 LOAD_PLUGIN_NETWORK=""
4500 AC_MSG_CHECKING([which default write plugin to load])
4501 default_write_plugin="none"
4502 if test "x$enable_rrdtool" = "xyes"
4504 default_write_plugin="rrdtool"
4506 LOAD_PLUGIN_RRDTOOL="##"
4509 if test "x$enable_network" = "xyes"
4511 if test "x$default_write_plugin" = "xnone"
4513 default_write_plugin="network"
4515 LOAD_PLUGIN_NETWORK="#"
4518 LOAD_PLUGIN_NETWORK="##"
4521 if test "x$enable_csv" = "xyes"
4523 if test "x$default_write_plugin" = "xnone"
4525 default_write_plugin="csv"
4530 LOAD_PLUGIN_CSV="##"
4532 AC_MSG_RESULT([$default_write_plugin])
4534 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4535 AC_SUBST(LOAD_PLUGIN_NETWORK)
4536 AC_SUBST(LOAD_PLUGIN_CSV)
4539 if test "x$ac_system" = "xLinux" \
4540 && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
4542 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4545 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
4547 enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
4551 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4553 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4555 PERL_BINDINGS_OPTIONS="$withval"
4556 with_perl_bindings="yes"
4558 PERL_BINDINGS_OPTIONS=""
4559 with_perl_bindings="$withval"
4563 PERL_BINDINGS_OPTIONS=""
4564 if test -n "$perl_interpreter"
4566 with_perl_bindings="yes"
4568 with_perl_bindings="no (no perl interpreter found)"
4571 if test "x$with_perl_bindings" = "xyes"
4573 PERL_BINDINGS="perl"
4577 AC_SUBST(PERL_BINDINGS)
4578 AC_SUBST(PERL_BINDINGS_OPTIONS)
4580 dnl libcollectdclient
4581 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4582 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4583 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4585 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4587 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4589 AC_SUBST(LCC_VERSION_MAJOR)
4590 AC_SUBST(LCC_VERSION_MINOR)
4591 AC_SUBST(LCC_VERSION_PATCH)
4592 AC_SUBST(LCC_VERSION_EXTRA)
4593 AC_SUBST(LCC_VERSION_STRING)
4595 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4597 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/owniptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
4599 if test "x$with_librrd" = "xyes" \
4600 && test "x$librrd_threadsafe" != "xyes"
4602 with_librrd="yes (warning: librrd is not thread-safe)"
4605 if test "x$with_libperl" = "xyes"
4607 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4609 enable_perl="no (needs libperl)"
4612 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4614 enable_perl="no (libperl doesn't support ithreads)"
4617 if test "x$with_perl_bindings" = "xyes" \
4618 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4620 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4627 libcurl . . . . . . . $with_libcurl
4628 libdbi . . . . . . . $with_libdbi
4629 libesmtp . . . . . . $with_libesmtp
4630 libganglia . . . . . $with_libganglia
4631 libgcrypt . . . . . . $with_libgcrypt
4632 libiokit . . . . . . $with_libiokit
4633 libiptc . . . . . . . $with_libiptc
4634 libjvm . . . . . . . $with_java
4635 libkstat . . . . . . $with_kstat
4636 libkvm . . . . . . . $with_libkvm
4637 libmemcached . . . . $with_libmemcached
4638 libmodbus . . . . . . $with_libmodbus
4639 libmysql . . . . . . $with_libmysql
4640 libnetapp . . . . . . $with_libnetapp
4641 libnetlink . . . . . $with_libnetlink
4642 libnetsnmp . . . . . $with_libnetsnmp
4643 libnotify . . . . . . $with_libnotify
4644 liboconfig . . . . . $with_liboconfig
4645 libopenipmi . . . . . $with_libopenipmipthread
4646 liboping . . . . . . $with_liboping
4647 libpcap . . . . . . . $with_libpcap
4648 libperfstat . . . . . $with_perfstat
4649 libperl . . . . . . . $with_libperl
4650 libpq . . . . . . . . $with_libpq
4651 libpthread . . . . . $with_libpthread
4652 librouteros . . . . . $with_librouteros
4653 librrd . . . . . . . $with_librrd
4654 libsensors . . . . . $with_libsensors
4655 libstatgrab . . . . . $with_libstatgrab
4656 libtokyotyrant . . . $with_libtokyotyrant
4657 libupsclient . . . . $with_libupsclient
4658 libvirt . . . . . . . $with_libvirt
4659 libxml2 . . . . . . . $with_libxml2
4660 libxmms . . . . . . . $with_libxmms
4661 libyajl . . . . . . . $with_libyajl
4662 libevent . . . . . . $with_libevent
4663 protobuf-c . . . . . $have_protoc_c
4664 oracle . . . . . . . $with_oracle
4665 python . . . . . . . $with_python
4668 daemon mode . . . . . $enable_daemon
4669 debug . . . . . . . . $enable_debug
4672 perl . . . . . . . . $with_perl_bindings
4675 apache . . . . . . . $enable_apache
4676 apcups . . . . . . . $enable_apcups
4677 apple_sensors . . . . $enable_apple_sensors
4678 ascent . . . . . . . $enable_ascent
4679 battery . . . . . . . $enable_battery
4680 bind . . . . . . . . $enable_bind
4681 conntrack . . . . . . $enable_conntrack
4682 contextswitch . . . . $enable_contextswitch
4683 cpu . . . . . . . . . $enable_cpu
4684 cpufreq . . . . . . . $enable_cpufreq
4685 csv . . . . . . . . . $enable_csv
4686 curl . . . . . . . . $enable_curl
4687 curl_json . . . . . . $enable_curl_json
4688 curl_xml . . . . . . $enable_curl_xml
4689 dbi . . . . . . . . . $enable_dbi
4690 df . . . . . . . . . $enable_df
4691 disk . . . . . . . . $enable_disk
4692 dns . . . . . . . . . $enable_dns
4693 email . . . . . . . . $enable_email
4694 entropy . . . . . . . $enable_entropy
4695 exec . . . . . . . . $enable_exec
4696 filecount . . . . . . $enable_filecount
4697 fscache . . . . . . . $enable_fscache
4698 gmond . . . . . . . . $enable_gmond
4699 hddtemp . . . . . . . $enable_hddtemp
4700 interface . . . . . . $enable_interface
4701 ipmi . . . . . . . . $enable_ipmi
4702 iptables . . . . . . $enable_iptables
4703 ipvs . . . . . . . . $enable_ipvs
4704 irq . . . . . . . . . $enable_irq
4705 java . . . . . . . . $enable_java
4706 libvirt . . . . . . . $enable_libvirt
4707 load . . . . . . . . $enable_load
4708 logfile . . . . . . . $enable_logfile
4709 madwifi . . . . . . . $enable_madwifi
4710 match_empty_counter . $enable_match_empty_counter
4711 match_hashed . . . . $enable_match_hashed
4712 match_regex . . . . . $enable_match_regex
4713 match_timediff . . . $enable_match_timediff
4714 match_value . . . . . $enable_match_value
4715 mbmon . . . . . . . . $enable_mbmon
4716 memcachec . . . . . . $enable_memcachec
4717 memcached . . . . . . $enable_memcached
4718 memory . . . . . . . $enable_memory
4719 modbus . . . . . . . $enable_modbus
4720 multimeter . . . . . $enable_multimeter
4721 mysql . . . . . . . . $enable_mysql
4722 netapp . . . . . . . $enable_netapp
4723 netlink . . . . . . . $enable_netlink
4724 network . . . . . . . $enable_network
4725 nfs . . . . . . . . . $enable_nfs
4726 nginx . . . . . . . . $enable_nginx
4727 notify_desktop . . . $enable_notify_desktop
4728 notify_email . . . . $enable_notify_email
4729 ntpd . . . . . . . . $enable_ntpd
4730 nut . . . . . . . . . $enable_nut
4731 olsrd . . . . . . . . $enable_olsrd
4732 onewire . . . . . . . $enable_onewire
4733 openvpn . . . . . . . $enable_openvpn
4734 oracle . . . . . . . $enable_oracle
4735 perl . . . . . . . . $enable_perl
4736 pinba . . . . . . . . $enable_pinba
4737 ping . . . . . . . . $enable_ping
4738 postgresql . . . . . $enable_postgresql
4739 powerdns . . . . . . $enable_powerdns
4740 processes . . . . . . $enable_processes
4741 protocols . . . . . . $enable_protocols
4742 python . . . . . . . $enable_python
4743 routeros . . . . . . $enable_routeros
4744 rrdcached . . . . . . $enable_rrdcached
4745 rrdtool . . . . . . . $enable_rrdtool
4746 sensors . . . . . . . $enable_sensors
4747 serial . . . . . . . $enable_serial
4748 snmp . . . . . . . . $enable_snmp
4749 swap . . . . . . . . $enable_swap
4750 syslog . . . . . . . $enable_syslog
4751 table . . . . . . . . $enable_table
4752 tail . . . . . . . . $enable_tail
4753 tape . . . . . . . . $enable_tape
4754 target_notification . $enable_target_notification
4755 target_replace . . . $enable_target_replace
4756 target_scale . . . . $enable_target_scale
4757 target_set . . . . . $enable_target_set
4758 tcpconns . . . . . . $enable_tcpconns
4759 teamspeak2 . . . . . $enable_teamspeak2
4760 ted . . . . . . . . . $enable_ted
4761 thermal . . . . . . . $enable_thermal
4762 tokyotyrant . . . . . $enable_tokyotyrant
4763 unixsock . . . . . . $enable_unixsock
4764 uptime . . . . . . . $enable_uptime
4765 users . . . . . . . . $enable_users
4766 uuid . . . . . . . . $enable_uuid
4767 vmem . . . . . . . . $enable_vmem
4768 vserver . . . . . . . $enable_vserver
4769 wireless . . . . . . $enable_wireless
4770 write_http . . . . . $enable_write_http
4771 xmms . . . . . . . . $enable_xmms
4772 zfs_arc . . . . . . . $enable_zfs_arc
4776 if test "x$dependency_error" = "xyes"; then
4777 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4780 if test "x$dependency_warning" = "xyes"; then
4781 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4784 # vim: set fdm=marker :