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)
6 m4_ifdef([LT_PACKAGE_VERSION],
9 LT_CONFIG_LTDL_DIR([libltdl])
11 LTDL_INIT([convenience])
12 AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
17 AC_LIBLTDL_CONVENIENCE
21 AC_CONFIG_SUBDIRS(libltdl)
22 AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
26 AM_INIT_AUTOMAKE(dist-bzip2)
29 AC_PREFIX_DEFAULT("/opt/collectd")
34 # Checks for programs.
42 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
50 AC_MSG_CHECKING([for kernel type ($host_os)])
53 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
57 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
67 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
73 AC_MSG_RESULT([$ac_system])
75 if test "x$ac_system" = "xLinux"
77 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
78 if test -z "$KERNEL_DIR"
80 KERNEL_DIR="/lib/modules/`uname -r`/source"
83 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
84 AC_SUBST(KERNEL_CFLAGS)
87 if test "x$ac_system" = "xSolaris"
89 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
92 # Where to install .pc files.
93 pkgconfigdir="${libdir}/pkgconfig"
94 AC_SUBST(pkgconfigdir)
96 # Check for standards compliance mode
97 AC_ARG_ENABLE(standards,
98 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
99 [enable_standards="$enableval"],
100 [enable_standards="no"])
101 if test "x$enable_standards" = "xyes"
103 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
104 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Define to enforce POSIX.1-2001 compliance.])
105 AC_DEFINE(_XOPEN_SOURCE, 600, [Define to enforce X/Open 6 (XSI) compliance.])
106 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
108 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
111 # Checks for header files.
118 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)
121 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
126 # include <sys/types.h>
129 AC_CHECK_HEADERS(netinet/in.h, [], [],
134 # include <sys/types.h>
136 #if HAVE_NETINET_IN_SYSTM_H
137 # include <netinet/in_systm.h>
140 AC_CHECK_HEADERS(netinet/ip.h, [], [],
145 # include <sys/types.h>
147 #if HAVE_NETINET_IN_SYSTM_H
148 # include <netinet/in_systm.h>
150 #if HAVE_NETINET_IN_H
151 # include <netinet/in.h>
154 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
159 # include <sys/types.h>
161 #if HAVE_NETINET_IN_SYSTM_H
162 # include <netinet/in_systm.h>
164 #if HAVE_NETINET_IN_H
165 # include <netinet/in.h>
167 #if HAVE_NETINET_IP_H
168 # include <netinet/ip.h>
171 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
176 # include <sys/types.h>
178 #if HAVE_NETINET_IN_SYSTM_H
179 # include <netinet/in_systm.h>
181 #if HAVE_NETINET_IN_H
182 # include <netinet/in.h>
184 #if HAVE_NETINET_IP_H
185 # include <netinet/ip.h>
188 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
193 # include <sys/types.h>
195 #if HAVE_NETINET_IN_SYSTM_H
196 # include <netinet/in_systm.h>
198 #if HAVE_NETINET_IN_H
199 # include <netinet/in.h>
202 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
207 # include <sys/types.h>
209 #if HAVE_NETINET_IN_SYSTM_H
210 # include <netinet/in_systm.h>
212 #if HAVE_NETINET_IN_H
213 # include <netinet/in.h>
215 #if HAVE_NETINET_IP6_H
216 # include <netinet/ip6.h>
219 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
224 # include <sys/types.h>
226 #if HAVE_NETINET_IN_SYSTM_H
227 # include <netinet/in_systm.h>
229 #if HAVE_NETINET_IN_H
230 # include <netinet/in.h>
232 #if HAVE_NETINET_IP_H
233 # include <netinet/ip.h>
236 AC_CHECK_HEADERS(netinet/udp.h, [], [],
241 # include <sys/types.h>
243 #if HAVE_NETINET_IN_SYSTM_H
244 # include <netinet/in_systm.h>
246 #if HAVE_NETINET_IN_H
247 # include <netinet/in.h>
249 #if HAVE_NETINET_IP_H
250 # include <netinet/ip.h>
255 AC_CHECK_HEADERS(sys/dkstat.h)
256 if test "x$ac_system" = "xDarwin"
258 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)
259 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
261 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
264 # include <sys/types.h>
267 # include <sys/param.h>
271 AC_MSG_CHECKING([for sysctl kern.cp_times])
272 if test -x /sbin/sysctl
274 /sbin/sysctl kern.cp_times 2>/dev/null
278 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
279 [Define if sysctl supports kern.cp_times])
288 AC_CHECK_HEADERS(linux/major.h libgen.h)
290 # For the battery plugin
291 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
293 #if HAVE_IOKIT_IOKITLIB_H
294 # include <IOKit/IOKitLib.h>
296 #if HAVE_IOKIT_IOTYPES_H
297 # include <IOKit/IOTypes.h>
301 # For the swap module
302 have_linux_wireless_h="no"
303 if test "x$ac_system" = "xLinux"
305 AC_CHECK_HEADERS(linux/wireless.h,
306 [have_linux_wireless_h="yes"],
307 [have_linux_wireless_h="no"],
310 #include <sys/ioctl.h>
311 #include <sys/socket.h>
315 # For the swap module
316 have_sys_swap_h="yes"
317 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
319 #undef _FILE_OFFSET_BITS
320 #undef _LARGEFILE64_SOURCE
322 # include <sys/types.h>
325 # include <sys/param.h>
329 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
332 if test "x$GCC" = "xyes"
334 hint_64="CFLAGS='-m64'"
336 hint_64="CFLAGS='-xarch=v9'"
338 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
342 # For the processes plugin
344 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
346 # For interface plugin
347 AC_CHECK_HEADERS(ifaddrs.h)
348 AC_CHECK_HEADERS(net/if.h, [], [],
351 # include <sys/types.h>
353 #if HAVE_SYS_SOCKET_H
354 # include <sys/socket.h>
357 AC_CHECK_HEADERS(linux/if.h, [], [],
360 # include <sys/types.h>
362 #if HAVE_SYS_SOCKET_H
363 # include <sys/socket.h>
366 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
369 # include <sys/types.h>
371 #if HAVE_SYS_SOCKET_H
372 # include <sys/socket.h>
375 # include <linux/if.h>
380 have_net_ip_vs_h="no"
382 if test "x$ac_system" = "xLinux"
384 SAVE_CFLAGS="$CFLAGS"
385 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
387 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
388 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
390 CFLAGS="$SAVE_CFLAGS"
394 AC_CHECK_HEADERS(sys/ucred.h, [], [],
397 # include <sys/types.h>
400 # include <sys/param.h>
404 # For mount interface
405 AC_CHECK_HEADERS(sys/mount.h, [], [],
408 # include <sys/types.h>
411 # include <sys/param.h>
415 # For the email plugin
416 AC_CHECK_HEADERS(linux/un.h, [], [],
418 #if HAVE_SYS_SOCKET_H
419 # include <sys/socket.h>
423 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)
426 AC_CHECK_HEADERS(arpa/nameser.h)
427 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
429 #if HAVE_ARPA_NAMESER_H
430 # include <arpa/nameser.h>
434 AC_CHECK_HEADERS(net/if_arp.h, [], [],
435 [#if HAVE_SYS_SOCKET_H
436 # include <sys/socket.h>
439 AC_CHECK_HEADERS(net/ppp_defs.h)
440 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
441 [#if HAVE_NET_PPP_DEFS_H
442 # include <net/ppp_defs.h>
445 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
450 # include <sys/types.h>
452 #if HAVE_SYS_SOCKET_H
453 # include <sys/socket.h>
458 #if HAVE_NETINET_IN_H
459 # include <netinet/in.h>
463 # For the multimeter plugin
465 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
468 # Checks for typedefs, structures, and compiler characteristics.
477 # Checks for library functions.
479 AC_PROG_GCC_TRADITIONAL
480 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
484 AC_CACHE_CHECK([for strtok_r],
485 [c_cv_have_strtok_r_default],
494 char buffer[] = "foo,bar,baz";
501 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
504 printf ("token = %s;\n", token);
507 [c_cv_have_strtok_r_default="yes"],
508 [c_cv_have_strtok_r_default="no"]
512 if test "x$c_cv_have_strtok_r_default" = "xno"
514 SAVE_CFLAGS="$CFLAGS"
515 CFLAGS="$CFLAGS -D_REENTRANT=1"
517 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
518 [c_cv_have_strtok_r_reentrant],
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_reentrant="yes"],
541 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
546 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
548 socket_needs_socket="no"
549 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
550 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
552 nanosleep_needs_rt="no"
553 nanosleep_needs_posix4="no"
554 AC_CHECK_FUNCS(nanosleep,
556 AC_CHECK_LIB(rt, nanosleep,
557 [nanosleep_needs_rt="yes"],
558 AC_CHECK_LIB(posix4, nanosleep,
559 [nanosleep_needs_posix4="yes"],
560 AC_MSG_ERROR(cannot find nanosleep))))
561 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
562 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$nanosleep_needs_posix4" = "xyes")
564 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
565 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
566 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
567 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
568 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
569 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
570 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
571 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
572 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
573 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
574 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
575 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
578 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
581 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
583 if test "x$withval" = "xno"; then
585 else if test "x$withval" = "xyes"; then
592 if test "x$nan_type" = "xnone"; then
593 AC_CACHE_CHECK([whether NAN is defined by default],
594 [c_cv_have_nan_default],
600 static float foo = NAN;
608 [c_cv_have_nan_default="yes"],
609 [c_cv_have_nan_default="no"]
612 if test "x$c_cv_have_nan_default" = "xyes"
617 if test "x$nan_type" = "xnone"; then
618 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
619 [c_cv_have_nan_isoc],
624 #define __USE_ISOC99 1
626 static float foo = NAN;
634 [c_cv_have_nan_isoc="yes"],
635 [c_cv_have_nan_isoc="no"]
638 if test "x$c_cv_have_nan_isoc" = "xyes"
643 if test "x$nan_type" = "xnone"; then
644 SAVE_LDFLAGS=$LDFLAGS
645 LDFLAGS="$LDFLAGS -lm"
646 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
647 [c_cv_have_nan_zero],
656 #define NAN (0.0 / 0.0)
658 # define isnan(f) ((f) != (f))
660 static float foo = NAN;
668 [c_cv_have_nan_zero="yes"],
669 [c_cv_have_nan_zero="no"]
672 LDFLAGS=$SAVE_LDFLAGS
673 if test "x$c_cv_have_nan_zero" = "xyes"
679 if test "x$nan_type" = "xdefault"; then
680 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
681 [Define if NAN is defined by default and can initialize static variables.])
682 else if test "x$nan_type" = "xisoc99"; then
683 AC_DEFINE(NAN_STATIC_ISOC, 1,
684 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
685 else if test "x$nan_type" = "xzero"; then
686 AC_DEFINE(NAN_ZERO_ZERO, 1,
687 [Define if NAN can be defined as (0.0 / 0.0)])
689 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
692 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
694 if test "x$withval" = "xnothing"; then
695 fp_layout_type="nothing"
696 else if test "x$withval" = "xendianflip"; then
697 fp_layout_type="endianflip"
698 else if test "x$withval" = "xintswap"; then
699 fp_layout_type="intswap"
701 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
704 [fp_layout_type="unknown"])
706 if test "x$fp_layout_type" = "xunknown"; then
707 AC_CACHE_CHECK([if doubles are stored in x86 representation],
708 [c_cv_fp_layout_need_nothing],
719 # include <inttypes.h>
722 # include <stdbool.h>
732 memcpy ((void *) &i0, (void *) &d, 8);
735 memcpy ((void *) c, (void *) &i1, 8);
737 if ((c[0] == 0x2f) && (c[1] == 0x25)
738 && (c[2] == 0xc0) && (c[3] == 0xc7)
739 && (c[4] == 0x43) && (c[5] == 0x2b)
740 && (c[6] == 0x1f) && (c[7] == 0x5b))
745 [c_cv_fp_layout_need_nothing="yes"],
746 [c_cv_fp_layout_need_nothing="no"]
749 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
750 fp_layout_type="nothing"
753 if test "x$fp_layout_type" = "xunknown"; then
754 AC_CACHE_CHECK([if endianflip converts to x86 representation],
755 [c_cv_fp_layout_need_endianflip],
766 # include <inttypes.h>
769 # include <stdbool.h>
771 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
772 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
773 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
774 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
775 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
776 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
777 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
778 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
787 memcpy ((void *) &i0, (void *) &d, 8);
789 i1 = endianflip (i0);
790 memcpy ((void *) c, (void *) &i1, 8);
792 if ((c[0] == 0x2f) && (c[1] == 0x25)
793 && (c[2] == 0xc0) && (c[3] == 0xc7)
794 && (c[4] == 0x43) && (c[5] == 0x2b)
795 && (c[6] == 0x1f) && (c[7] == 0x5b))
800 [c_cv_fp_layout_need_endianflip="yes"],
801 [c_cv_fp_layout_need_endianflip="no"]
804 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
805 fp_layout_type="endianflip"
808 if test "x$fp_layout_type" = "xunknown"; then
809 AC_CACHE_CHECK([if intswap converts to x86 representation],
810 [c_cv_fp_layout_need_intswap],
821 # include <inttypes.h>
824 # include <stdbool.h>
826 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
827 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
836 memcpy ((void *) &i0, (void *) &d, 8);
839 memcpy ((void *) c, (void *) &i1, 8);
841 if ((c[0] == 0x2f) && (c[1] == 0x25)
842 && (c[2] == 0xc0) && (c[3] == 0xc7)
843 && (c[4] == 0x43) && (c[5] == 0x2b)
844 && (c[6] == 0x1f) && (c[7] == 0x5b))
849 [c_cv_fp_layout_need_intswap="yes"],
850 [c_cv_fp_layout_need_intswap="no"]
853 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
854 fp_layout_type="intswap"
858 if test "x$fp_layout_type" = "xnothing"; then
859 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
860 [Define if doubles are stored in x86 representation.])
861 else if test "x$fp_layout_type" = "xendianflip"; then
862 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
863 [Define if endianflip is needed to convert to x86 representation.])
864 else if test "x$fp_layout_type" = "xintswap"; then
865 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
866 [Define if intswap is needed to convert to x86 representation.])
868 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
872 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
874 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
876 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
879 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
880 if test "x$have_getmntent" = "xno"; then
881 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
883 if test "x$have_getmntent" = "xno"; then
884 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
886 if test "x$have_getmntent" = "xno"; then
887 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
890 if test "x$have_getmntent" = "xc"; then
891 AC_CACHE_CHECK([whether getmntent takes one argument],
892 [c_cv_have_one_getmntent],
894 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
895 #include "$srcdir/src/utils_mount.h"]],
899 fh = setmntent ("/etc/mtab", "r");
903 [c_cv_have_one_getmntent="yes"],
904 [c_cv_have_one_getmntent="no"]
907 AC_CACHE_CHECK([whether getmntent takes two arguments],
908 [c_cv_have_two_getmntent],
910 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
911 #include "$srcdir/src/utils_mount.h"]],
916 fh = fopen ("/etc/mnttab", "r");
917 status = getmntent (fh, &mt);
920 [c_cv_have_two_getmntent="yes"],
921 [c_cv_have_two_getmntent="no"]
926 # Check for different versions of `getmntent' here..
928 if test "x$have_getmntent" = "xc"; then
929 if test "x$c_cv_have_one_getmntent" = "xyes"; then
930 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
931 [Define if the function getmntent exists and takes one argument.])
933 if test "x$c_cv_have_two_getmntent" = "xyes"; then
934 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
935 [Define if the function getmntent exists and takes two arguments.])
938 if test "x$have_getmntent" = "xsun"; then
939 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
940 [Define if the function getmntent exists. It's the version from libsun.])
942 if test "x$have_getmntent" = "xseq"; then
943 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
944 [Define if the function getmntent exists. It's the version from libseq.])
946 if test "x$have_getmntent" = "xgen"; then
947 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
948 [Define if the function getmntent exists. It's the version from libgen.])
952 AC_MSG_CHECKING([if have htonll defined])
957 #include <sys/types.h>
958 #include <netinet/in.h>
960 # include <inttypes.h>
967 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
970 AC_MSG_RESULT([$have_htonll])
972 # Check for structures
973 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
974 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
977 #include <sys/types.h>
978 #include <sys/socket.h>
981 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
982 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
985 #include <sys/types.h>
986 #include <sys/socket.h>
987 #include <linux/if.h>
988 #include <linux/netdevice.h>
991 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
994 #include <netinet/in.h>
998 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1000 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1001 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1002 have_struct_kinfo_proc_freebsd="yes"
1005 have_struct_kinfo_proc_freebsd="no"
1009 #include <sys/param.h>
1010 #include <sys/sysctl.h>
1011 #include <sys/user.h>
1014 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1016 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1017 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1018 have_struct_kinfo_proc_openbsd="yes"
1021 have_struct_kinfo_proc_openbsd="no"
1024 #include <sys/param.h>
1025 #include <sys/sysctl.h>
1029 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1030 [#define _BSD_SOURCE
1032 # include <stdint.h>
1034 #if HAVE_SYS_TYPES_H
1035 # include <sys/types.h>
1037 #if HAVE_NETINET_IN_SYSTM_H
1038 # include <netinet/in_systm.h>
1040 #if HAVE_NETINET_IN_H
1041 # include <netinet/in.h>
1043 #if HAVE_NETINET_IP_H
1044 # include <netinet/ip.h>
1046 #if HAVE_NETINET_UDP_H
1047 # include <netinet/udp.h>
1050 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1051 [#define _BSD_SOURCE
1053 # include <stdint.h>
1055 #if HAVE_SYS_TYPES_H
1056 # include <sys/types.h>
1058 #if HAVE_NETINET_IN_SYSTM_H
1059 # include <netinet/in_systm.h>
1061 #if HAVE_NETINET_IN_H
1062 # include <netinet/in.h>
1064 #if HAVE_NETINET_IP_H
1065 # include <netinet/ip.h>
1067 #if HAVE_NETINET_UDP_H
1068 # include <netinet/udp.h>
1072 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1082 # Checks for libraries begin here
1084 with_libresolv="yes"
1085 AC_CHECK_LIB(resolv, res_search,
1087 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1089 [with_libresolv="no"])
1090 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1092 dnl Check for HAL (hardware abstraction library)
1094 AC_CHECK_LIB(hal,libhal_device_property_exists,
1095 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1097 if test "x$with_libhal" = "xyes"; then
1098 if test "x$PKG_CONFIG" != "x"; then
1099 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1100 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1101 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1102 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1106 m4_divert_once([HELP_WITH], [
1107 collectd additional packages:])
1109 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1111 if test "x$ac_system" = "xAIX"
1116 with_perfstat="no (AIX only)"
1117 with_procinfo="no (AIX only)"
1120 if test "x$with_perfstat" = "xyes"
1122 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1123 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1125 if test "x$with_perfstat" = "xyes"
1127 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1129 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1131 # Processes plugin under AIX.
1132 if test "x$with_procinfo" = "xyes"
1134 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1136 if test "x$with_procinfo" = "xyes"
1138 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1141 if test "x$ac_system" = "xSolaris"
1146 with_kstat="no (Solaris only)"
1147 with_devinfo="no (Solaris only)"
1150 if test "x$with_kstat" = "xyes"
1152 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1154 if test "x$with_kstat" = "xyes"
1156 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1157 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1159 if test "x$with_kstat" = "xyes"
1161 AC_DEFINE(HAVE_LIBKSTAT, 1,
1162 [Define to 1 if you have the 'kstat' library (-lkstat)])
1164 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1165 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1168 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1175 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1178 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1179 if test "x$with_kvm_getprocs" = "xyes"
1181 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1182 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1185 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1187 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1188 if test "x$with_kvm_getswapinfo" = "xyes"
1190 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1191 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1194 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1196 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1197 if test "x$with_kvm_nlist" = "xyes"
1199 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1200 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1203 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1205 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1206 if test "x$with_kvm_openfiles" = "xyes"
1208 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1209 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1212 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1214 # --with-libcurl {{{
1215 with_curl_config="curl-config"
1218 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1220 if test "x$withval" = "xno"
1223 else if test "x$withval" = "xyes"
1227 if test -f "$withval" && test -x "$withval"
1229 with_curl_config="$withval"
1231 else if test -x "$withval/bin/curl-config"
1233 with_curl_config="$withval/bin/curl-config"
1242 if test "x$with_libcurl" = "xyes"
1244 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1245 curl_config_status=$?
1247 if test $curl_config_status -ne 0
1249 with_libcurl="no ($with_curl_config failed)"
1251 SAVE_CPPFLAGS="$CPPFLAGS"
1252 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1254 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1256 CPPFLAGS="$SAVE_CPPFLAGS"
1259 if test "x$with_libcurl" = "xyes"
1261 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1262 curl_config_status=$?
1264 if test $curl_config_status -ne 0
1266 with_libcurl="no ($with_curl_config failed)"
1268 AC_CHECK_LIB(curl, curl_easy_init,
1269 [with_libcurl="yes"],
1270 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1274 if test "x$with_libcurl" = "xyes"
1276 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1277 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1278 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1279 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1281 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1285 with_libdbi_cppflags=""
1286 with_libdbi_ldflags=""
1287 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1289 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1291 with_libdbi_cppflags="-I$withval/include"
1292 with_libdbi_ldflags="-L$withval/lib"
1295 with_libdbi="$withval"
1301 if test "x$with_libdbi" = "xyes"
1303 SAVE_CPPFLAGS="$CPPFLAGS"
1304 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1306 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1308 CPPFLAGS="$SAVE_CPPFLAGS"
1310 if test "x$with_libdbi" = "xyes"
1312 SAVE_CPPFLAGS="$CPPFLAGS"
1313 SAVE_LDFLAGS="$LDFLAGS"
1314 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1315 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1317 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1319 CPPFLAGS="$SAVE_CPPFLAGS"
1320 LDFLAGS="$SAVE_LDFLAGS"
1322 if test "x$with_libdbi" = "xyes"
1324 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1325 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1326 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1327 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1328 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1329 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1331 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1334 # --with-libesmtp {{{
1335 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1337 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1339 LDFLAGS="$LDFLAGS -L$withval/lib"
1340 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1343 with_libesmtp="$withval"
1349 if test "x$with_libesmtp" = "xyes"
1351 AC_CHECK_LIB(esmtp, smtp_create_session,
1353 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1354 ], [with_libesmtp="no (libesmtp not found)"])
1356 if test "x$with_libesmtp" = "xyes"
1358 AC_CHECK_HEADERS(libesmtp.h,
1360 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1361 ], [with_libesmtp="no (libesmtp.h not found)"])
1363 if test "x$with_libesmtp" = "xyes"
1369 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1370 [Wether or not to use the esmtp library])
1371 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1374 # --with-libganglia {{{
1375 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1377 if test -f "$withval" && test -x "$withval"
1379 with_libganglia_config="$withval"
1380 with_libganglia="yes"
1381 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1383 with_libganglia_config="$withval/bin/ganglia-config"
1384 with_libganglia="yes"
1385 else if test -d "$withval"
1387 GANGLIA_CPPFLAGS="-I$withval/include"
1388 GANGLIA_LDFLAGS="-L$withval/lib"
1389 with_libganglia="yes"
1391 with_libganglia_config="ganglia-config"
1392 with_libganglia="$withval"
1396 with_libganglia_config="ganglia-config"
1397 with_libganglia="yes"
1400 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1402 if test "x$GANGLIA_CPPFLAGS" = "x"
1404 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1407 if test "x$GANGLIA_LDFLAGS" = "x"
1409 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1412 if test "x$GANGLIA_LIBS" = "x"
1414 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1418 SAVE_CPPFLAGS="$CPPFLAGS"
1419 SAVE_LDFLAGS="$LDFLAGS"
1420 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1421 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1423 if test "x$with_libganglia" = "xyes"
1425 AC_CHECK_HEADERS(gm_protocol.h,
1427 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1428 [Define to 1 if you have the <gm_protocol.h> header file.])
1429 ], [with_libganglia="no (gm_protocol.h not found)"])
1432 if test "x$with_libganglia" = "xyes"
1434 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1436 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1437 [Define to 1 if you have the ganglia library (-lganglia).])
1438 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1441 CPPFLAGS="$SAVE_CPPFLAGS"
1442 LDFLAGS="$SAVE_LDFLAGS"
1444 AC_SUBST(GANGLIA_CPPFLAGS)
1445 AC_SUBST(GANGLIA_LDFLAGS)
1446 AC_SUBST(GANGLIA_LIBS)
1447 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1450 # --with-libgcrypt {{{
1451 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1452 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1453 GCRYPT_LIBS="$GCRYPT_LIBS"
1454 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1456 if test -f "$withval" && test -x "$withval"
1458 with_libgcrypt_config="$withval"
1459 with_libgcrypt="yes"
1460 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1462 with_libgcrypt_config="$withval/bin/gcrypt-config"
1463 with_libgcrypt="yes"
1464 else if test -d "$withval"
1466 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1467 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1468 with_libgcrypt="yes"
1470 with_libgcrypt_config="gcrypt-config"
1471 with_libgcrypt="$withval"
1475 with_libgcrypt_config="libgcrypt-config"
1476 with_libgcrypt="yes"
1479 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1481 if test "x$GCRYPT_CPPFLAGS" = "x"
1483 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1486 if test "x$GCRYPT_LDFLAGS" = "x"
1488 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1489 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1492 if test "x$GCRYPT_LIBS" = "x"
1494 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1498 SAVE_CPPFLAGS="$CPPFLAGS"
1499 SAVE_LDFLAGS="$LDFLAGS"
1500 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1501 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1503 if test "x$with_libgcrypt" = "xyes"
1505 if test "x$GCRYPT_CPPFLAGS" != "x"
1507 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1509 AC_CHECK_HEADERS(gcrypt.h,
1510 [with_libgcrypt="yes"],
1511 [with_libgcrypt="no (gcrypt.h not found)"])
1514 if test "x$with_libgcrypt" = "xyes"
1516 if test "x$GCRYPT_LDFLAGS" != "x"
1518 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1520 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1521 [with_libgcrypt="yes"],
1522 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1524 if test "$with_libgcrypt" != "no"; then
1525 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1529 CPPFLAGS="$SAVE_CPPFLAGS"
1530 LDFLAGS="$SAVE_LDFLAGS"
1532 if test "x$with_libgcrypt" = "xyes"
1534 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1537 AC_SUBST(GCRYPT_CPPFLAGS)
1538 AC_SUBST(GCRYPT_LDFLAGS)
1539 AC_SUBST(GCRYPT_LIBS)
1540 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1543 # --with-libiptc {{{
1544 with_own_libiptc="no"
1545 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1547 if test "x$withval" = "xshipped"
1549 with_own_libiptc="yes"
1551 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1553 LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS -I$withval/include"
1554 LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS -L$withval/lib"
1557 with_libiptc="$withval"
1561 if test "x$ac_system" = "xLinux"
1565 with_libiptc="no (Linux only)"
1568 SAVE_CPPFLAGS="$CPPFLAGS"
1569 SAVE_LDFLAGS="$LDFLAGS"
1570 CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
1571 LDFLAGS="$LDFLAGS $LIBIPTC_LDFLAGS"
1572 # check whether the header file for libiptc is available.
1573 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1575 AC_CHECK_HEADERS(libiptc/libiptc.h,
1577 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1581 with_own_libiptc="yes"
1584 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1586 AC_CHECK_HEADERS(libiptc/libip6tc.h,
1588 AC_DEFINE(HAVE_LIBIPTC_LIBIP6TC_H, 1, [Define to 1 if you have the <libiptc/libip6tc.h> header file.])
1592 with_own_libiptc="yes"
1595 # If the header file is available, check for the required type declaractions.
1596 # They may be missing in old versions of libiptc. In that case, they will be
1597 # declared in the iptables plugin.
1598 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1600 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [],
1603 # include "$srcdir/src/owniptc/libiptc.h"
1604 # include "$srcdir/src/owniptc/libip6tc.h"
1606 # include <libiptc/libiptc.h>
1607 # include <libiptc/libip6tc.h>
1611 # Check for the iptc_init symbol in the library.
1612 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1614 AC_CHECK_LIB(iptc, iptc_init,
1616 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1620 with_own_libiptc="yes"
1623 # The system wide version failed for some reason. Check if we have the required
1624 # headers to build the shipped version.
1625 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xyes"
1627 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1629 with_libiptc="no (Linux iptables headers not found)"
1630 with_own_libiptc="no"
1633 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1636 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1637 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1638 if test "x$with_libiptc" = "xyes"
1640 BUILD_WITH_LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS"
1641 BUILD_WITH_LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS"
1642 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1643 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1645 if test "x$with_own_libiptc" = "xyes"
1647 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1649 CPPFLAGS="$SAVE_CPPFLAGS"
1650 LDFLAGS="$SAVE_LDFLAGS"
1654 with_java_home="$JAVA_HOME"
1655 with_java_vmtype="client"
1660 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1662 if test "x$withval" = "xno"
1665 else if test "x$withval" = "xyes"
1669 with_java_home="$withval"
1674 if test "x$with_java" = "xyes"
1676 if test -d "$with_java_home"
1678 AC_MSG_CHECKING([for jni.h])
1679 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1680 if test "x$TMPDIR" != "x"
1682 AC_MSG_RESULT([found in $TMPDIR])
1683 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1685 AC_MSG_RESULT([not found])
1688 AC_MSG_CHECKING([for jni_md.h])
1689 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1690 if test "x$TMPDIR" != "x"
1692 AC_MSG_RESULT([found in $TMPDIR])
1693 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1695 AC_MSG_RESULT([not found])
1698 AC_MSG_CHECKING([for libjvm.so])
1699 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1700 if test "x$TMPDIR" != "x"
1702 AC_MSG_RESULT([found in $TMPDIR])
1703 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1705 AC_MSG_RESULT([not found])
1708 if test "x$JAVAC" = "x"
1710 AC_MSG_CHECKING([for javac])
1711 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1712 if test "x$TMPDIR" != "x"
1715 AC_MSG_RESULT([$JAVAC])
1717 AC_MSG_RESULT([not found])
1720 if test "x$JAR" = "x"
1722 AC_MSG_CHECKING([for jar])
1723 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1724 if test "x$TMPDIR" != "x"
1727 AC_MSG_RESULT([$JAR])
1729 AC_MSG_RESULT([not found])
1732 else if test "x$with_java_home" != "x"
1734 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1738 if test "x$JAVA_CPPFLAGS" != "x"
1740 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1742 if test "x$JAVA_CFLAGS" != "x"
1744 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1746 if test "x$JAVA_LDFLAGS" != "x"
1748 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1750 if test "x$JAVAC" = "x"
1752 with_javac_path="$PATH"
1753 if test "x$with_java_home" != "x"
1755 with_javac_path="$with_java_home:with_javac_path"
1756 if test -d "$with_java_home/bin"
1758 with_javac_path="$with_java_home/bin:with_javac_path"
1762 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1764 if test "x$JAVAC" = "x"
1766 with_java="no (javac not found)"
1768 if test "x$JAR" = "x"
1770 with_jar_path="$PATH"
1771 if test "x$with_java_home" != "x"
1773 with_jar_path="$with_java_home:$with_jar_path"
1774 if test -d "$with_java_home/bin"
1776 with_jar_path="$with_java_home/bin:$with_jar_path"
1780 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
1782 if test "x$JAR" = "x"
1784 with_java="no (jar not found)"
1787 SAVE_CPPFLAGS="$CPPFLAGS"
1788 SAVE_CFLAGS="$CFLAGS"
1789 SAVE_LDFLAGS="$LDFLAGS"
1790 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1791 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1792 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1794 if test "x$with_java" = "xyes"
1796 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1798 if test "x$with_java" = "xyes"
1800 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1802 [with_java="no (libjvm not found)"],
1805 if test "x$with_java" = "xyes"
1807 JAVA_LIBS="$JAVA_LIBS -ljvm"
1808 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1811 CPPFLAGS="$SAVE_CPPFLAGS"
1812 CFLAGS="$SAVE_CFLAGS"
1813 LDFLAGS="$SAVE_LDFLAGS"
1815 AC_SUBST(JAVA_CPPFLAGS)
1816 AC_SUBST(JAVA_CFLAGS)
1817 AC_SUBST(JAVA_LDFLAGS)
1819 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1822 # --with-libmemcached {{{
1823 with_libmemcached_cppflags=""
1824 with_libmemcached_ldflags=""
1825 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1827 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1829 with_libmemcached_cppflags="-I$withval/include"
1830 with_libmemcached_ldflags="-L$withval/lib"
1831 with_libmemcached="yes"
1833 with_libmemcached="$withval"
1837 with_libmemcached="yes"
1839 if test "x$with_libmemcached" = "xyes"
1841 SAVE_CPPFLAGS="$CPPFLAGS"
1842 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1844 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1846 CPPFLAGS="$SAVE_CPPFLAGS"
1848 if test "x$with_libmemcached" = "xyes"
1850 SAVE_CPPFLAGS="$CPPFLAGS"
1851 SAVE_LDFLAGS="$LDFLAGS"
1852 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1853 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1855 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1857 CPPFLAGS="$SAVE_CPPFLAGS"
1858 LDFLAGS="$SAVE_LDFLAGS"
1860 if test "x$with_libmemcached" = "xyes"
1862 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1863 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1864 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1865 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1866 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1867 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1868 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1870 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1873 # --with-libmodbus {{{
1874 with_libmodbus_config=""
1875 with_libmodbus_cflags=""
1876 with_libmodbus_libs=""
1877 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
1879 if test "x$withval" = "xno"
1882 else if test "x$withval" = "xyes"
1884 with_libmodbus="use_pkgconfig"
1885 else if test -d "$with_libmodbus/lib"
1887 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
1888 with_libmodbus_cflags="-I$withval/include"
1889 with_libmodbus_libs="-L$withval/lib -lmodbus"
1890 with_libmodbus="yes"
1893 [with_libmodbus="use_pkgconfig"])
1895 # configure using pkg-config
1896 if test "x$with_libmodbus" = "xuse_pkgconfig"
1898 if test "x$PKG_CONFIG" = "x"
1900 with_libmodbus="no (Don't have pkg-config)"
1903 if test "x$with_libmodbus" = "xuse_pkgconfig"
1905 AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
1906 $PKG_CONFIG --exists 'modbus' 2>/dev/null
1909 with_libmodbus="no (pkg-config doesn't know library)"
1912 if test "x$with_libmodbus" = "xuse_pkgconfig"
1914 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
1917 with_libmodbus="no ($PKG_CONFIG failed)"
1919 with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
1922 with_libmodbus="no ($PKG_CONFIG failed)"
1925 if test "x$with_libmodbus" = "xuse_pkgconfig"
1927 with_libmodbus="yes"
1930 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
1931 # the actual checks.
1932 if test "x$with_libmodbus" = "xyes"
1934 SAVE_CPPFLAGS="$CPPFLAGS"
1935 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1937 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
1939 CPPFLAGS="$SAVE_CPPFLAGS"
1941 if test "x$with_libmodbus" = "xyes"
1943 SAVE_CPPFLAGS="$CPPFLAGS"
1944 SAVE_LDFLAGS="$LDFLAGS"
1946 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1947 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
1949 AC_CHECK_LIB(modbus, modbus_init_tcp,
1950 [with_libmodbus="yes"],
1951 [with_libmodbus="no (symbol modbus_init_tcp not found)"])
1953 CPPFLAGS="$SAVE_CPPFLAGS"
1954 LDFLAGS="$SAVE_LDFLAGS"
1956 if test "x$with_libmodbus" = "xyes"
1958 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
1959 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
1960 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
1961 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
1965 # --with-libmysql {{{
1966 with_mysql_config="mysql_config"
1967 with_mysql_cflags=""
1969 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1971 if test "x$withval" = "xno"
1974 else if test "x$withval" = "xyes"
1978 if test -f "$withval" && test -x "$withval";
1980 with_mysql_config="$withval"
1981 else if test -x "$withval/bin/mysql_config"
1983 with_mysql_config="$withval/bin/mysql_config"
1991 if test "x$with_libmysql" = "xyes"
1993 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1994 mysql_config_status=$?
1996 if test $mysql_config_status -ne 0
1998 with_libmysql="no ($with_mysql_config failed)"
2000 SAVE_CPPFLAGS="$CPPFLAGS"
2001 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2004 have_mysql_mysql_h="no"
2005 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2007 if test "x$have_mysql_h" = "xno"
2009 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2012 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2014 with_libmysql="no (mysql.h not found)"
2017 CPPFLAGS="$SAVE_CPPFLAGS"
2020 if test "x$with_libmysql" = "xyes"
2022 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
2023 mysql_config_status=$?
2025 if test $mysql_config_status -ne 0
2027 with_libmysql="no ($with_mysql_config failed)"
2029 AC_CHECK_LIB(mysqlclient, mysql_init,
2030 [with_libmysql="yes"],
2031 [with_libmysql="no (symbol 'mysql_init' not found)"],
2034 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2035 [with_libmysql="yes"],
2036 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2040 if test "x$with_libmysql" = "xyes"
2042 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2043 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2044 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2045 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2047 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2050 # --with-libnetlink {{{
2051 with_libnetlink_cflags=""
2052 with_libnetlink_libs="-lnetlink"
2053 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2055 echo "libnetlink: withval = $withval"
2056 if test "x$withval" = "xyes"
2058 with_libnetlink="yes"
2059 else if test "x$withval" = "xno"
2061 with_libnetlink="no"
2063 if test -d "$withval/include"
2065 with_libnetlink_cflags="-I$withval/include"
2066 with_libnetlink_libs="-L$withval/lib -lnetlink"
2067 with_libnetlink="yes"
2069 AC_MSG_ERROR("no such directory: $withval/include")
2074 if test "x$ac_system" = "xLinux"
2076 with_libnetlink="yes"
2078 with_libnetlink="no (Linux only library)"
2081 if test "x$with_libnetlink" = "xyes"
2083 SAVE_CFLAGS="$CFLAGS"
2084 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2086 with_libnetlink="no (libnetlink.h not found)"
2088 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2090 with_libnetlink="yes"
2094 #include <sys/types.h>
2095 #include <asm/types.h>
2096 #include <sys/socket.h>
2097 #include <linux/netlink.h>
2098 #include <linux/rtnetlink.h>])
2099 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2101 #include <sys/types.h>
2102 #include <asm/types.h>
2103 #include <sys/socket.h>])
2107 #include <sys/types.h>
2108 #include <asm/types.h>
2109 #include <sys/socket.h>
2110 #include <linux/netlink.h>
2111 #include <linux/rtnetlink.h>
2115 int retval = TCA_STATS2;
2118 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2123 #include <sys/types.h>
2124 #include <asm/types.h>
2125 #include <sys/socket.h>
2126 #include <linux/netlink.h>
2127 #include <linux/rtnetlink.h>
2131 int retval = TCA_STATS;
2134 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2137 CFLAGS="$SAVE_CFLAGS"
2139 if test "x$with_libnetlink" = "xyes"
2141 AC_CHECK_LIB(netlink, rtnl_open,
2142 [with_libnetlink="yes"],
2143 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2144 [$with_libnetlink_libs])
2146 if test "x$with_libnetlink" = "xyes"
2148 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2149 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2150 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2151 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2153 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2156 # --with-libnetapp {{{
2157 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2158 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2159 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2160 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2161 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2162 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2163 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2165 if test -d "$withval"
2167 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2168 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2169 with_libnetapp="yes"
2171 with_libnetapp="$withval"
2175 with_libnetapp="yes"
2178 SAVE_CPPFLAGS="$CPPFLAGS"
2179 SAVE_LDFLAGS="$LDFLAGS"
2180 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2181 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2183 if test "x$with_libnetapp" = "xyes"
2185 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2187 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2189 AC_CHECK_HEADERS(netapp_api.h,
2190 [with_libnetapp="yes"],
2191 [with_libnetapp="no (netapp_api.h not found)"])
2194 if test "x$with_libnetapp" = "xyes"
2196 if test "x$LIBNETAPP_LDFLAGS" != "x"
2198 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2201 if test "x$LIBNETAPP_LIBS" = "x"
2203 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2205 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2207 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2208 [with_libnetapp="yes"],
2209 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2211 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2214 CPPFLAGS="$SAVE_CPPFLAGS"
2215 LDFLAGS="$SAVE_LDFLAGS"
2217 if test "x$with_libnetapp" = "xyes"
2219 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2222 AC_SUBST(LIBNETAPP_CPPFLAGS)
2223 AC_SUBST(LIBNETAPP_LDFLAGS)
2224 AC_SUBST(LIBNETAPP_LIBS)
2225 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2228 # --with-libnetsnmp {{{
2229 with_snmp_config="net-snmp-config"
2232 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2234 if test "x$withval" = "xno"
2236 with_libnetsnmp="no"
2237 else if test "x$withval" = "xyes"
2239 with_libnetsnmp="yes"
2241 if test -x "$withval"
2243 with_snmp_config="$withval"
2244 with_libnetsnmp="yes"
2246 with_snmp_config="$withval/bin/net-snmp-config"
2247 with_libnetsnmp="yes"
2251 [with_libnetsnmp="yes"])
2252 if test "x$with_libnetsnmp" = "xyes"
2254 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2255 snmp_config_status=$?
2257 if test $snmp_config_status -ne 0
2259 with_libnetsnmp="no ($with_snmp_config failed)"
2261 SAVE_CPPFLAGS="$CPPFLAGS"
2262 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2264 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2266 CPPFLAGS="$SAVE_CPPFLAGS"
2269 if test "x$with_libnetsnmp" = "xyes"
2271 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2272 snmp_config_status=$?
2274 if test $snmp_config_status -ne 0
2276 with_libnetsnmp="no ($with_snmp_config failed)"
2278 AC_CHECK_LIB(netsnmp, init_snmp,
2279 [with_libnetsnmp="yes"],
2280 [with_libnetsnmp="no (libnetsnmp not found)"],
2284 if test "x$with_libnetsnmp" = "xyes"
2286 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2287 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2288 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2289 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2291 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2294 # --with-liboconfig {{{
2295 with_own_liboconfig="no"
2296 liboconfig_LDFLAGS="$LDFLAGS"
2297 liboconfig_CPPFLAGS="$CPPFLAGS"
2298 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2300 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2302 if test -d "$withval/lib"
2304 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2306 if test -d "$withval/include"
2308 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2311 if test "x$withval" = "xno"
2313 AC_MSG_ERROR("liboconfig is required")
2317 with_liboconfig="yes"
2320 save_LDFLAGS="$LDFLAGS"
2321 save_CPPFLAGS="$CPPFLAGS"
2322 LDFLAGS="$liboconfig_LDFLAGS"
2323 CPPFLAGS="$liboconfig_CPPFLAGS"
2324 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2326 with_liboconfig="yes"
2327 with_own_liboconfig="no"
2330 with_liboconfig="yes"
2331 with_own_liboconfig="yes"
2332 LDFLAGS="$save_LDFLAGS"
2333 CPPFLAGS="$save_CPPFLAGS"
2336 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2337 if test "x$with_own_liboconfig" = "xyes"
2339 with_liboconfig="yes (shipped version)"
2343 # --with-liboping {{{
2344 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2346 if test "x$withval" = "xyes"
2349 else if test "x$withval" = "xno"
2354 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2355 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2358 [with_liboping="yes"])
2360 SAVE_CPPFLAGS="$CPPFLAGS"
2361 SAVE_LDFLAGS="$LDFLAGS"
2363 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2364 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2366 if test "x$with_liboping" = "xyes"
2368 if test "x$LIBOPING_CPPFLAGS" != "x"
2370 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2372 AC_CHECK_HEADERS(oping.h,
2373 [with_liboping="yes"],
2374 [with_liboping="no ('oping.h' not found)"])
2376 if test "x$with_liboping" = "xyes"
2378 if test "x$LIBOPING_LDFLAGS" != "x"
2380 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2382 AC_CHECK_LIB(oping, ping_construct,
2383 [with_liboping="yes"],
2384 [with_liboping="no (symbol 'ping_construct' not found)"])
2387 CPPFLAGS="$SAVE_CPPFLAGS"
2388 LDFLAGS="$SAVE_LDFLAGS"
2390 if test "x$with_liboping" = "xyes"
2392 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2393 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2394 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2395 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2397 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2401 with_oracle_cppflags=""
2403 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2405 if test "x$withval" = "xyes"
2407 if test "x$ORACLE_HOME" = "x"
2409 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2412 else if test "x$withval" = "xno"
2417 ORACLE_HOME="$withval"
2421 if test "x$ORACLE_HOME" = "x"
2423 with_oracle="no (ORACLE_HOME is not set)"
2428 if test "x$ORACLE_HOME" != "x"
2430 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2432 if test -e "$ORACLE_HOME/lib/ldflags"
2434 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2436 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2437 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2439 if test "x$with_oracle" = "xyes"
2441 SAVE_CPPFLAGS="$CPPFLAGS"
2442 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2444 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2446 CPPFLAGS="$SAVE_CPPFLAGS"
2448 if test "x$with_oracle" = "xyes"
2450 SAVE_CPPFLAGS="$CPPFLAGS"
2451 SAVE_LDFLAGS="$LDFLAGS"
2452 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2453 LDFLAGS="$LDFLAGS $with_oracle_libs"
2455 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2457 CPPFLAGS="$SAVE_CPPFLAGS"
2458 LDFLAGS="$SAVE_LDFLAGS"
2460 if test "x$with_oracle" = "xyes"
2462 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2463 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2464 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2465 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2469 # --with-libowcapi {{{
2470 with_libowcapi_cppflags=""
2471 with_libowcapi_libs="-lowcapi"
2472 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2474 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2476 with_libowcapi_cppflags="-I$withval/include"
2477 with_libowcapi_libs="-L$withval/lib -lowcapi"
2478 with_libowcapi="yes"
2480 with_libowcapi="$withval"
2484 with_libowcapi="yes"
2486 if test "x$with_libowcapi" = "xyes"
2488 SAVE_CPPFLAGS="$CPPFLAGS"
2489 CPPFLAGS="$with_libowcapi_cppflags"
2491 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2493 CPPFLAGS="$SAVE_CPPFLAGS"
2495 if test "x$with_libowcapi" = "xyes"
2497 SAVE_LDFLAGS="$LDFLAGS"
2498 SAVE_CPPFLAGS="$CPPFLAGS"
2499 LDFLAGS="$with_libowcapi_libs"
2500 CPPFLAGS="$with_libowcapi_cppflags"
2502 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2504 LDFLAGS="$SAVE_LDFLAGS"
2505 CPPFLAGS="$SAVE_CPPFLAGS"
2507 if test "x$with_libowcapi" = "xyes"
2509 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2510 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2511 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2512 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2516 # --with-libpcap {{{
2517 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2519 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2521 LDFLAGS="$LDFLAGS -L$withval/lib"
2522 CPPFLAGS="$CPPFLAGS -I$withval/include"
2525 with_libpcap="$withval"
2531 if test "x$with_libpcap" = "xyes"
2533 AC_CHECK_LIB(pcap, pcap_open_live,
2535 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2536 ], [with_libpcap="no (libpcap not found)"])
2538 if test "x$with_libpcap" = "xyes"
2540 AC_CHECK_HEADERS(pcap.h,
2542 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2543 ], [with_libpcap="no (pcap.h not found)"])
2545 if test "x$with_libpcap" = "xyes"
2551 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2552 [Wether or not to use the pcap library])
2553 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2556 # --with-libperl {{{
2557 perl_interpreter="perl"
2558 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2560 if test -x "$withval"
2562 perl_interpreter="$withval"
2564 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2566 LDFLAGS="$LDFLAGS -L$withval/lib"
2567 CPPFLAGS="$CPPFLAGS -I$withval/include"
2568 perl_interpreter="$withval/bin/perl"
2571 with_libperl="$withval"
2578 AC_MSG_CHECKING([for perl])
2579 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2580 if test -x "$perl_interpreter"
2582 AC_MSG_RESULT([yes ($perl_interpreter)])
2588 AC_SUBST(PERL, "$perl_interpreter")
2590 if test "x$with_libperl" = "xyes" \
2591 && test -n "$perl_interpreter"
2593 SAVE_CFLAGS="$CFLAGS"
2594 SAVE_LDFLAGS="$LDFLAGS"
2595 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2596 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2597 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2598 CFLAGS="$CFLAGS $PERL_CFLAGS"
2599 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2601 AC_CACHE_CHECK([for libperl],
2602 [c_cv_have_libperl],
2606 #define PERL_NO_GET_CONTEXT
2613 load_module (PERL_LOADMOD_NOIMPORT,
2614 newSVpv ("Collectd::Plugin::FooBar", 24),
2617 [c_cv_have_libperl="yes"],
2618 [c_cv_have_libperl="no"]
2622 if test "x$c_cv_have_libperl" = "xyes"
2624 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2625 AC_SUBST(PERL_CFLAGS)
2626 AC_SUBST(PERL_LDFLAGS)
2631 CFLAGS="$SAVE_CFLAGS"
2632 LDFLAGS="$SAVE_LDFLAGS"
2633 else if test -z "$perl_interpreter"; then
2634 with_libperl="no (no perl interpreter found)"
2635 c_cv_have_libperl="no"
2637 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2639 if test "x$with_libperl" = "xyes"
2641 SAVE_CFLAGS="$CFLAGS"
2642 SAVE_LDFLAGS="$LDFLAGS"
2643 CFLAGS="$CFLAGS $PERL_CFLAGS"
2644 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2646 AC_CACHE_CHECK([if perl supports ithreads],
2647 [c_cv_have_perl_ithreads],
2655 #if !defined(USE_ITHREADS)
2656 # error "Perl does not support ithreads!"
2657 #endif /* !defined(USE_ITHREADS) */
2660 [c_cv_have_perl_ithreads="yes"],
2661 [c_cv_have_perl_ithreads="no"]
2665 if test "x$c_cv_have_perl_ithreads" = "xyes"
2667 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2670 CFLAGS="$SAVE_CFLAGS"
2671 LDFLAGS="$SAVE_LDFLAGS"
2674 if test "x$with_libperl" = "xyes"
2676 SAVE_CFLAGS="$CFLAGS"
2677 SAVE_LDFLAGS="$LDFLAGS"
2678 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2679 # (see issues #41 and #42)
2680 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2681 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2683 AC_CACHE_CHECK([for broken Perl_load_module()],
2684 [c_cv_have_broken_perl_load_module],
2688 #define PERL_NO_GET_CONTEXT
2695 load_module (PERL_LOADMOD_NOIMPORT,
2696 newSVpv ("Collectd::Plugin::FooBar", 24),
2699 [c_cv_have_broken_perl_load_module="no"],
2700 [c_cv_have_broken_perl_load_module="yes"]
2704 CFLAGS="$SAVE_CFLAGS"
2705 LDFLAGS="$SAVE_LDFLAGS"
2707 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2708 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2710 if test "x$with_libperl" = "xyes"
2712 SAVE_CFLAGS="$CFLAGS"
2713 SAVE_LDFLAGS="$LDFLAGS"
2714 CFLAGS="$CFLAGS $PERL_CFLAGS"
2715 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2718 [struct mgvtbl.svt_local],
2719 [have_struct_mgvtbl_svt_local="yes"],
2720 [have_struct_mgvtbl_svt_local="no"],
2727 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2729 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2730 [Define if Perl's struct mgvtbl has member svt_local.])
2733 CFLAGS="$SAVE_CFLAGS"
2734 LDFLAGS="$SAVE_LDFLAGS"
2739 with_pg_config="pg_config"
2740 with_libpq_includedir=""
2741 with_libpq_libdir=""
2742 with_libpq_cppflags=""
2743 with_libpq_ldflags=""
2744 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2747 if test "x$withval" = "xno"
2750 else if test "x$withval" = "xyes"
2754 if test -f "$withval" && test -x "$withval";
2756 with_pg_config="$withval"
2757 else if test -x "$withval/bin/pg_config"
2759 with_pg_config="$withval/bin/pg_config"
2767 if test "x$with_libpq" = "xyes"
2769 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2772 if test $pg_config_status -eq 0
2774 if test -n "$with_libpq_includedir"; then
2775 for dir in $with_libpq_includedir; do
2776 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2780 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2783 SAVE_CPPFLAGS="$CPPFLAGS"
2784 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2786 AC_CHECK_HEADERS(libpq-fe.h, [],
2787 [with_libpq="no (libpq-fe.h not found)"], [])
2789 CPPFLAGS="$SAVE_CPPFLAGS"
2791 if test "x$with_libpq" = "xyes"
2793 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2796 if test $pg_config_status -eq 0
2798 if test -n "$with_libpq_libdir"; then
2799 for dir in $with_libpq_libdir; do
2800 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2804 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2807 SAVE_LDFLAGS="$LDFLAGS"
2808 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2810 AC_CHECK_LIB(pq, PQconnectdb,
2812 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2814 AC_CHECK_LIB(pq, PQserverVersion,
2816 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2818 LDFLAGS="$SAVE_LDFLAGS"
2820 if test "x$with_libpq" = "xyes"
2822 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2823 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2824 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2825 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2827 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2830 # --with-libpthread {{{
2831 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2832 [ if test "x$withval" != "xno" \
2833 && test "x$withval" != "xyes"
2835 LDFLAGS="$LDFLAGS -L$withval/lib"
2836 CPPFLAGS="$CPPFLAGS -I$withval/include"
2837 with_libpthread="yes"
2839 if test "x$withval" = "xno"
2841 with_libpthread="no (disabled)"
2844 ], [with_libpthread="yes"])
2845 if test "x$with_libpthread" = "xyes"
2847 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2850 if test "x$with_libpthread" = "xyes"
2852 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2854 if test "x$with_libpthread" = "xyes"
2860 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2861 [Wether or not to use pthread (POSIX threads) library])
2862 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2867 with_python_path="$PATH"
2868 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
2870 if test "x$withval" = "xyes" || test "x$withval" = "xno"
2872 with_python="$withval"
2873 else if test -x "$withval"
2875 with_python_prog="$withval"
2876 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
2878 else if test -d "$withval"
2880 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
2883 AC_MSG_WARN([Argument not recognized: $withval])
2885 ], [with_python="yes"])
2888 SAVE_CPPFLAGS="$CPPFLAGS"
2889 SAVE_LDFLAGS="$LDFLAGS"
2892 PATH="$with_python_path"
2894 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
2896 AC_MSG_CHECKING([for python])
2897 with_python_prog="`which python 2>/dev/null`"
2898 if test "x$with_python_prog" = "x"
2900 AC_MSG_RESULT([not found])
2901 with_python="no (interpreter not found)"
2903 AC_MSG_RESULT([$with_python_prog])
2907 if test "x$with_python" = "xyes"
2909 AC_MSG_CHECKING([for Python CPPFLAGS])
2910 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
2911 python_config_status=$?
2913 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
2915 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
2918 AC_MSG_RESULT([$python_include_path])
2922 if test "x$with_python" = "xyes"
2924 CPPFLAGS="-I$python_include_path $CPPFLAGS"
2925 AC_CHECK_HEADERS(Python.h,
2926 [with_python="yes"],
2927 [with_python="no ('Python.h' not found)"])
2930 if test "x$with_python" = "xyes"
2932 AC_MSG_CHECKING([for Python LDFLAGS])
2933 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`
2934 python_config_status=$?
2936 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
2938 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
2941 AC_MSG_RESULT([$python_library_path])
2945 if test "x$with_python" = "xyes"
2947 AC_MSG_CHECKING([for Python LIBS])
2948 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`
2949 python_config_status=$?
2951 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
2953 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
2956 AC_MSG_RESULT([$python_library_flags])
2960 if test "x$with_python" = "xyes"
2962 LDFLAGS="-L$python_library_path $LDFLAGS"
2963 LIBS="$python_library_flags $LIBS"
2965 AC_CHECK_FUNC(PyObject_CallFunction,
2966 [with_python="yes"],
2967 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
2971 CPPFLAGS="$SAVE_CPPFLAGS"
2972 LDFLAGS="$SAVE_LDFLAGS"
2975 if test "x$with_python" = "xyes"
2977 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
2978 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
2979 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
2980 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
2981 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
2982 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
2986 # --with-librouteros {{{
2987 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
2989 if test "x$withval" = "xyes"
2991 with_librouteros="yes"
2992 else if test "x$withval" = "xno"
2994 with_librouteros="no"
2996 with_librouteros="yes"
2997 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
2998 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3001 [with_librouteros="yes"])
3003 SAVE_CPPFLAGS="$CPPFLAGS"
3004 SAVE_LDFLAGS="$LDFLAGS"
3006 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3007 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3009 if test "x$with_librouteros" = "xyes"
3011 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3013 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3015 AC_CHECK_HEADERS(routeros_api.h,
3016 [with_librouteros="yes"],
3017 [with_librouteros="no ('routeros_api.h' not found)"])
3019 if test "x$with_librouteros" = "xyes"
3021 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3023 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3025 AC_CHECK_LIB(routeros, ros_interface,
3026 [with_librouteros="yes"],
3027 [with_librouteros="no (symbol 'ros_interface' not found)"])
3030 CPPFLAGS="$SAVE_CPPFLAGS"
3031 LDFLAGS="$SAVE_LDFLAGS"
3033 if test "x$with_librouteros" = "xyes"
3035 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3036 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3037 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3038 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3040 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3044 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3047 librrd_threadsafe="yes"
3048 librrd_rrdc_update="no"
3049 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3050 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3052 librrd_cflags="-I$withval/include"
3053 librrd_ldflags="-L$withval/lib"
3056 with_librrd="$withval"
3058 ], [with_librrd="yes"])
3059 if test "x$with_librrd" = "xyes"
3061 SAVE_CPPFLAGS="$CPPFLAGS"
3062 SAVE_LDFLAGS="$LDFLAGS"
3064 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3065 LDFLAGS="$LDFLAGS $librrd_ldflags"
3067 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3069 CPPFLAGS="$SAVE_CPPFLAGS"
3070 LDFLAGS="$SAVE_LDFLAGS"
3072 if test "x$with_librrd" = "xyes"
3074 SAVE_CPPFLAGS="$CPPFLAGS"
3075 SAVE_LDFLAGS="$LDFLAGS"
3077 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3078 LDFLAGS="$LDFLAGS $librrd_ldflags"
3080 AC_CHECK_LIB(rrd_th, rrd_update_r,
3082 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3084 [librrd_threadsafe="no"
3085 AC_CHECK_LIB(rrd, rrd_update,
3087 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3089 [with_librrd="no (symbol 'rrd_update' not found)"],
3094 if test "x$librrd_threadsafe" = "xyes"
3096 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3098 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3101 CPPFLAGS="$SAVE_CPPFLAGS"
3102 LDFLAGS="$SAVE_LDFLAGS"
3104 if test "x$with_librrd" = "xyes"
3106 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3107 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3108 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3109 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3111 if test "x$librrd_threadsafe" = "xyes"
3113 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3117 # --with-libsensors {{{
3118 with_sensors_cflags=""
3119 with_sensors_ldflags=""
3120 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3122 if test "x$withval" = "xno"
3124 with_libsensors="no"
3126 with_libsensors="yes"
3127 if test "x$withval" != "xyes"
3129 with_sensors_cflags="-I$withval/include"
3130 with_sensors_ldflags="-L$withval/lib"
3131 with_libsensors="yes"
3136 if test "x$ac_system" = "xLinux"
3138 with_libsensors="yes"
3140 with_libsensors="no (Linux only library)"
3143 if test "x$with_libsensors" = "xyes"
3145 SAVE_CPPFLAGS="$CPPFLAGS"
3146 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3148 # AC_CHECK_HEADERS(sensors/sensors.h,
3150 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3152 # [with_libsensors="no (sensors/sensors.h not found)"])
3153 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3155 CPPFLAGS="$SAVE_CPPFLAGS"
3157 if test "x$with_libsensors" = "xyes"
3159 SAVE_CPPFLAGS="$CPPFLAGS"
3160 SAVE_LDFLAGS="$LDFLAGS"
3161 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3162 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3164 AC_CHECK_LIB(sensors, sensors_init,
3166 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3168 [with_libsensors="no (libsensors not found)"])
3170 CPPFLAGS="$SAVE_CPPFLAGS"
3171 LDFLAGS="$SAVE_LDFLAGS"
3173 if test "x$with_libsensors" = "xyes"
3175 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3176 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3177 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3178 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3180 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3183 # --with-libstatgrab {{{
3184 with_libstatgrab_cflags=""
3185 with_libstatgrab_ldflags=""
3186 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3188 if test "x$withval" != "xno" \
3189 && test "x$withval" != "xyes"
3191 with_libstatgrab_cflags="-I$withval/include"
3192 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3193 with_libstatgrab="yes"
3194 with_libstatgrab_pkg_config="no"
3196 with_libstatgrab="$withval"
3197 with_libstatgrab_pkg_config="yes"
3201 with_libstatgrab="yes"
3202 with_libstatgrab_pkg_config="yes"
3205 if test "x$with_libstatgrab" = "xyes" \
3206 && test "x$with_libstatgrab_pkg_config" = "xyes"
3208 if test "x$PKG_CONFIG" != "x"
3210 AC_MSG_CHECKING([pkg-config for libstatgrab])
3212 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3215 with_libstatgrab_pkg_config="no"
3216 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
3217 temp_result="not found"
3219 AC_MSG_RESULT([$temp_result])
3221 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3222 with_libstatgrab_pkg_config="no"
3223 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3227 if test "x$with_libstatgrab" = "xyes" \
3228 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3229 && test "x$with_libstatgrab_cflags" = "x"
3231 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3232 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3235 with_libstatgrab_cflags="$temp_result"
3237 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3238 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3240 AC_MSG_RESULT([$temp_result])
3243 if test "x$with_libstatgrab" = "xyes" \
3244 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3245 && test "x$with_libstatgrab_ldflags" = "x"
3247 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3248 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3251 with_libstatgrab_ldflags="$temp_result"
3253 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3254 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3256 AC_MSG_RESULT([$temp_result])
3259 if test "x$with_libstatgrab" = "xyes"
3261 SAVE_CPPFLAGS="$CPPFLAGS"
3262 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3264 AC_CHECK_HEADERS(statgrab.h,
3265 [with_libstatgrab="yes"],
3266 [with_libstatgrab="no (statgrab.h not found)"])
3268 CPPFLAGS="$SAVE_CPPFLAGS"
3271 if test "x$with_libstatgrab" = "xyes"
3273 SAVE_CFLAGS="$CFLAGS"
3274 SAVE_LDFLAGS="$LDFLAGS"
3276 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3277 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3279 AC_CHECK_LIB(statgrab, sg_init,
3280 [with_libstatgrab="yes"],
3281 [with_libstatgrab="no (symbol sg_init not found)"])
3283 CFLAGS="$SAVE_CFLAGS"
3284 LDFLAGS="$SAVE_LDFLAGS"
3287 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3288 if test "x$with_libstatgrab" = "xyes"
3290 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3291 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3292 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3293 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3294 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3298 # --with-libtokyotyrant {{{
3299 with_libtokyotyrant_cppflags=""
3300 with_libtokyotyrant_ldflags=""
3301 with_libtokyotyrant_libs=""
3302 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3304 if test "x$withval" = "xno"
3306 with_libtokyotyrant="no"
3307 else if test "x$withval" = "xyes"
3309 with_libtokyotyrant="yes"
3311 with_libtokyotyrant_cppflags="-I$withval/include"
3312 with_libtokyotyrant_ldflags="-L$withval/include"
3313 with_libtokyotyrant_libs="-ltokyotyrant"
3314 with_libtokyotyrant="yes"
3318 with_libtokyotyrant="yes"
3321 if test "x$with_libtokyotyrant" = "xyes"
3323 if $PKG_CONFIG --exists tokyotyrant
3325 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3326 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3327 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3331 SAVE_CPPFLAGS="$CPPFLAGS"
3332 SAVE_LDFLAGS="$LDFLAGS"
3333 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3334 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3336 if test "x$with_libtokyotyrant" = "xyes"
3338 AC_CHECK_HEADERS(tcrdb.h,
3340 AC_DEFINE(HAVE_TCRDB_H, 1,
3341 [Define to 1 if you have the <tcrdb.h> header file.])
3342 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3345 if test "x$with_libtokyotyrant" = "xyes"
3347 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3349 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3350 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3352 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3353 [$with_libtokyotyrant_libs])
3356 CPPFLAGS="$SAVE_CPPFLAGS"
3357 LDFLAGS="$SAVE_LDFLAGS"
3359 if test "x$with_libtokyotyrant" = "xyes"
3361 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3362 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3363 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3364 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3365 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3366 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3368 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3371 # --with-libupsclient {{{
3372 with_libupsclient_config=""
3373 with_libupsclient_cflags=""
3374 with_libupsclient_libs=""
3375 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
3377 if test "x$withval" = "xno"
3379 with_libupsclient="no"
3380 else if test "x$withval" = "xyes"
3382 with_libupsclient="use_pkgconfig"
3384 if test -x "$withval"
3386 with_libupsclient_config="$withval"
3387 with_libupsclient="use_libupsclient_config"
3388 else if test -x "$withval/bin/libupsclient-config"
3390 with_libupsclient_config="$withval/bin/libupsclient-config"
3391 with_libupsclient="use_libupsclient_config"
3393 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3394 with_libupsclient_cflags="-I$withval/include"
3395 with_libupsclient_libs="-L$withval/lib -lupsclient"
3396 with_libupsclient="yes"
3400 [with_libupsclient="use_pkgconfig"])
3402 # configure using libupsclient-config
3403 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3405 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3406 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3409 with_libupsclient="no ($with_libupsclient_config failed)"
3411 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3414 with_libupsclient="no ($with_libupsclient_config failed)"
3417 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3419 with_libupsclient="yes"
3422 # configure using pkg-config
3423 if test "x$with_libupsclient" = "xuse_pkgconfig"
3425 if test "x$PKG_CONFIG" = "x"
3427 with_libupsclient="no (Don't have pkg-config)"
3430 if test "x$with_libupsclient" = "xuse_pkgconfig"
3432 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3433 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3436 with_libupsclient="no (pkg-config doesn't know library)"
3439 if test "x$with_libupsclient" = "xuse_pkgconfig"
3441 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3444 with_libupsclient="no ($PKG_CONFIG failed)"
3446 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3449 with_libupsclient="no ($PKG_CONFIG failed)"
3452 if test "x$with_libupsclient" = "xuse_pkgconfig"
3454 with_libupsclient="yes"
3457 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3458 # the actual checks.
3459 if test "x$with_libupsclient" = "xyes"
3461 SAVE_CPPFLAGS="$CPPFLAGS"
3462 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3464 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3466 CPPFLAGS="$SAVE_CPPFLAGS"
3468 if test "x$with_libupsclient" = "xyes"
3470 SAVE_CPPFLAGS="$CPPFLAGS"
3471 SAVE_LDFLAGS="$LDFLAGS"
3473 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3474 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3476 AC_CHECK_LIB(upsclient, upscli_connect,
3477 [with_libupsclient="yes"],
3478 [with_libupsclient="no (symbol upscli_connect not found)"])
3480 CPPFLAGS="$SAVE_CPPFLAGS"
3481 LDFLAGS="$SAVE_LDFLAGS"
3483 if test "x$with_libupsclient" = "xyes"
3485 SAVE_CPPFLAGS="$CPPFLAGS"
3486 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3488 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3489 [#include <stdlib.h>
3491 #include <upsclient.h>])
3493 CPPFLAGS="$SAVE_CPPFLAGS"
3495 if test "x$with_libupsclient" = "xyes"
3497 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3498 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3499 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3500 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3504 # --with-libxmms {{{
3505 with_xmms_config="xmms-config"
3508 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3510 if test "x$withval" != "xno" \
3511 && test "x$withval" != "xyes"
3513 if test -f "$withval" && test -x "$withval";
3515 with_xmms_config="$withval"
3516 else if test -x "$withval/bin/xmms-config"
3518 with_xmms_config="$withval/bin/xmms-config"
3521 else if test "x$withval" = "xno"
3531 if test "x$with_libxmms" = "xyes"
3533 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3534 xmms_config_status=$?
3536 if test $xmms_config_status -ne 0
3541 if test "x$with_libxmms" = "xyes"
3543 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3544 xmms_config_status=$?
3546 if test $xmms_config_status -ne 0
3551 if test "x$with_libxmms" = "xyes"
3553 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3555 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3556 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3557 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3558 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3565 with_libxmms_numeric=0
3566 if test "x$with_libxmms" = "xyes"
3568 with_libxmms_numeric=1
3570 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3571 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3574 # --with-libyajl {{{
3575 with_libyajl_cppflags=""
3576 with_libyajl_ldflags=""
3577 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3579 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3581 with_libyajl_cppflags="-I$withval/include"
3582 with_libyajl_ldflags="-L$withval/lib"
3585 with_libyajl="$withval"
3591 if test "x$with_libyajl" = "xyes"
3593 SAVE_CPPFLAGS="$CPPFLAGS"
3594 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3596 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3598 CPPFLAGS="$SAVE_CPPFLAGS"
3600 if test "x$with_libyajl" = "xyes"
3602 SAVE_CPPFLAGS="$CPPFLAGS"
3603 SAVE_LDFLAGS="$LDFLAGS"
3604 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3605 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3607 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3609 CPPFLAGS="$SAVE_CPPFLAGS"
3610 LDFLAGS="$SAVE_LDFLAGS"
3612 if test "x$with_libyajl" = "xyes"
3614 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3615 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3616 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3617 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3618 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3619 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3620 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3622 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3625 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3626 with_libxml2="no (pkg-config isn't available)"
3627 with_libxml2_cflags=""
3628 with_libxml2_ldflags=""
3629 with_libvirt="no (pkg-config isn't available)"
3630 with_libvirt_cflags=""
3631 with_libvirt_ldflags=""
3632 if test "x$PKG_CONFIG" != "x"
3634 pkg-config --exists 'libxml-2.0' 2>/dev/null
3639 with_libxml2="no (pkg-config doesn't know library)"
3642 pkg-config --exists libvirt 2>/dev/null
3647 with_libvirt="no (pkg-config doesn't know library)"
3650 if test "x$with_libxml2" = "xyes"
3652 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
3657 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
3663 if test "x$with_libxml2" = "xyes"
3665 SAVE_CPPFLAGS="$CPPFLAGS"
3666 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3668 AC_CHECK_HEADERS(libxml/parser.h, [],
3669 [with_libxml2="no (libxml/parser.h not found)"])
3671 CPPFLAGS="$SAVE_CPPFLAGS"
3673 if test "x$with_libxml2" = "xyes"
3675 SAVE_CFLAGS="$CFLAGS"
3676 SAVE_LDFLAGS="$LDFLAGS"
3678 CFLAGS="$CFLAGS $with_libxml2_cflags"
3679 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3681 AC_CHECK_LIB(xml2, xmlXPathEval,
3682 [with_libxml2="yes"],
3683 [with_libxml2="no (symbol xmlXPathEval not found)"])
3685 CFLAGS="$SAVE_CFLAGS"
3686 LDFLAGS="$SAVE_LDFLAGS"
3688 dnl Add the right compiler flags and libraries.
3689 if test "x$with_libxml2" = "xyes"; then
3690 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3691 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3692 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3693 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3695 if test "x$with_libvirt" = "xyes"
3697 with_libvirt_cflags="`pkg-config --cflags libvirt`"
3702 with_libvirt_ldflags="`pkg-config --libs libvirt`"
3708 if test "x$with_libvirt" = "xyes"
3710 SAVE_CPPFLAGS="$CPPFLAGS"
3711 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3713 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3714 [with_libvirt="no (libvirt/libvirt.h not found)"])
3716 CPPFLAGS="$SAVE_CPPFLAGS"
3718 if test "x$with_libvirt" = "xyes"
3720 SAVE_CFLAGS="$CFLAGS"
3721 SAVE_LDFLAGS="$LDFLAGS"
3723 CFLAGS="$CFLAGS $with_libvirt_cflags"
3724 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3726 AC_CHECK_LIB(virt, virDomainBlockStats,
3727 [with_libvirt="yes"],
3728 [with_libvirt="no (symbol virDomainBlockStats not found)"])
3730 CFLAGS="$SAVE_CFLAGS"
3731 LDFLAGS="$SAVE_LDFLAGS"
3733 dnl Add the right compiler flags and libraries.
3734 if test "x$with_libvirt" = "xyes"; then
3735 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3736 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3737 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3738 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3742 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3743 with_libopenipmipthread="yes"
3744 with_libopenipmipthread_cflags=""
3745 with_libopenipmipthread_libs=""
3747 AC_MSG_CHECKING([for pkg-config])
3749 if test "x$PKG_CONFIG" = "x"
3751 with_libopenipmipthread="no"
3754 temp_result="$PKG_CONFIG"
3756 AC_MSG_RESULT([$temp_result])
3758 if test "x$with_libopenipmipthread" = "xyes"
3760 AC_MSG_CHECKING([for libOpenIPMIpthread])
3761 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3764 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3766 AC_MSG_RESULT([$with_libopenipmipthread])
3769 if test "x$with_libopenipmipthread" = "xyes"
3771 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3772 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3775 with_libopenipmipthread_cflags="$temp_result"
3777 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3778 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3780 AC_MSG_RESULT([$temp_result])
3783 if test "x$with_libopenipmipthread" = "xyes"
3785 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3786 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3789 with_libopenipmipthread_ldflags="$temp_result"
3791 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3792 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3794 AC_MSG_RESULT([$temp_result])
3797 if test "x$with_libopenipmipthread" = "xyes"
3799 SAVE_CPPFLAGS="$CPPFLAGS"
3800 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3802 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3803 [with_libopenipmipthread="yes"],
3804 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3805 [#include <OpenIPMI/ipmiif.h>
3806 #include <OpenIPMI/ipmi_err.h>
3807 #include <OpenIPMI/ipmi_posix.h>
3808 #include <OpenIPMI/ipmi_conn.h>
3811 CPPFLAGS="$SAVE_CPPFLAGS"
3814 if test "x$with_libopenipmipthread" = "xyes"
3816 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3817 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3818 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3819 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3823 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3824 [with_libnotify="yes"],
3825 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3827 # Check for enabled/disabled features
3830 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3831 # ------------------------------------------------------------
3833 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3838 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3843 m4_define([EnDis],[disabled])dnl
3844 m4_define([YesNo],[no])dnl
3850 m4_define([EnDis],[enabled])dnl
3851 m4_define([YesNo],[yes])dnl
3854 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3858 m4_if([$3], [feature], [],
3862 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3868 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3870 enable_$1='[YesNo]'dnl
3872 if test "x$enable_$1" = "xno"
3876 if test "x$enable_$1" = "xyes"
3880 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3885 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3886 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3888 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3890 # AC_PLUGIN(name, default, info)
3891 # ------------------------------------------------------------
3898 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3900 if test "x$enableval" = "xyes"
3903 else if test "x$enableval" = "xforce"
3908 enable_plugin="no (disabled on command line)"
3912 if test "x$enable_all_plugins" = "xauto"
3914 if test "x$2" = "xyes"
3921 enable_plugin="$enable_all_plugins"
3924 if test "x$enable_plugin" = "xyes"
3926 if test "x$2" = "xyes" || test "x$force" = "xyes"
3928 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3929 if test "x$2" != "xyes"
3931 dependency_warning="yes"
3933 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3934 dependency_error="yes"
3935 enable_plugin="no (dependency error)"
3938 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3939 enable_$1="$enable_plugin"
3941 )# AC_PLUGIN(name, default, info)
3943 m4_divert_once([HELP_ENABLE], [
3944 collectd features:])
3945 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3946 AC_COLLECTD([debug], [enable], [feature], [debugging])
3947 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
3948 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
3950 dependency_warning="no"
3951 dependency_error="no"
3956 plugin_conntrack="no"
3957 plugin_contextswitch="no"
3960 plugin_curl_json="no"
3961 plugin_curl_xml="no"
3965 plugin_interface="no"
3972 plugin_multimeter="no"
3976 plugin_processes="no"
3977 plugin_protocols="no"
3981 plugin_tcpconns="no"
3988 plugin_wireless="no"
3992 if test "x$ac_system" = "xLinux"
3994 plugin_battery="yes"
3995 plugin_conntrack="yes"
3996 plugin_contextswitch="yes"
3998 plugin_cpufreq="yes"
4000 plugin_entropy="yes"
4001 plugin_interface="yes"
4006 plugin_fscache="yes"
4007 plugin_processes="yes"
4008 plugin_protocols="yes"
4011 plugin_tcpconns="yes"
4012 plugin_thermal="yes"
4015 plugin_vserver="yes"
4016 plugin_wireless="yes"
4018 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
4024 if test "x$ac_system" = "xOpenBSD"
4026 plugin_tcpconns="yes"
4030 if test "x$with_libiokit" = "xyes"
4032 plugin_battery="yes"
4037 if test "x$with_perfstat" = "xyes"
4043 plugin_interface="yes"
4047 if test "x$with_procinfo" = "xyes"
4049 plugin_processes="yes"
4053 if test "x$with_kstat" = "xyes"
4056 plugin_zfs_arc="yes"
4059 if test "x$with_devinfo$with_kstat" = "xyesyes"
4063 plugin_interface="yes"
4068 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
4074 if test "x$with_libstatgrab" = "xyes"
4078 plugin_interface="yes"
4085 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4091 if test "x$with_libopenipmipthread" = "xyes"
4096 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4098 plugin_curl_json="yes"
4101 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4103 plugin_curl_xml="yes"
4106 if test "x$have_processor_info" = "xyes"
4110 if test "x$have_sysctl" = "xyes"
4117 if test "x$have_sysctlbyname" = "xyes"
4121 plugin_tcpconns="yes"
4124 # Df plugin: Check if we know how to determine mount points first.
4125 #if test "x$have_listmntent" = "xyes"; then
4128 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4132 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4136 #if test "x$have_getmntent" = "xseq"
4140 if test "x$c_cv_have_one_getmntent" = "xyes"
4145 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4146 if test "x$plugin_df" = "xyes"
4149 if test "x$have_statfs" = "xyes"
4153 if test "x$have_statvfs" = "xyes"
4159 if test "x$have_getifaddrs" = "xyes"
4161 plugin_interface="yes"
4164 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4166 plugin_libvirt="yes"
4169 if test "x$have_getloadavg" = "xyes"
4174 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4179 # Mac OS X memory interface
4180 if test "x$have_host_statistics" = "xyes"
4185 if test "x$have_termios_h" = "xyes"
4187 plugin_multimeter="yes"
4191 if test "x$have_thread_info" = "xyes"
4193 plugin_processes="yes"
4196 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4198 plugin_processes="yes"
4201 if test "x$with_kvm_getswapinfo" = "xyes"
4206 if test "x$have_swapctl" = "xyes"
4211 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4213 plugin_tcpconns="yes"
4216 if test "x$have_getutent" = "xyes"
4220 if test "x$have_getutxent" = "xyes"
4225 m4_divert_once([HELP_ENABLE], [
4228 AC_ARG_ENABLE([all-plugins],
4229 AC_HELP_STRING([--enable-all-plugins],
4230 [enable all plugins (auto by def)]),
4232 if test "x$enableval" = "xyes"
4234 enable_all_plugins="yes"
4235 else if test "x$enableval" = "xauto"
4237 enable_all_plugins="auto"
4239 enable_all_plugins="no"
4242 [enable_all_plugins="auto"])
4244 m4_divert_once([HELP_ENABLE], [])
4246 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4247 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4248 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4249 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4250 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4251 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4252 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4253 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4254 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4255 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4256 AC_PLUGIN([csv], [yes], [CSV output plugin])
4257 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4258 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4259 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4260 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4261 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4262 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4263 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4264 AC_PLUGIN([email], [yes], [EMail statistics])
4265 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4266 AC_PLUGIN([exec], [yes], [Execution of external programs])
4267 AC_PLUGIN([filecount], [yes], [Count files in directories])
4268 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4269 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4270 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4271 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4272 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4273 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4274 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4275 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4276 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4277 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4278 AC_PLUGIN([load], [$plugin_load], [System load])
4279 AC_PLUGIN([logfile], [yes], [File logging plugin])
4280 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4281 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4282 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4283 AC_PLUGIN([match_regex], [yes], [The regex match])
4284 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4285 AC_PLUGIN([match_value], [yes], [The value match])
4286 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4287 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4288 AC_PLUGIN([memcached], [yes], [memcached statistics])
4289 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4290 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4291 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4292 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4293 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4294 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4295 AC_PLUGIN([network], [yes], [Network communication plugin])
4296 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4297 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4298 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4299 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4300 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4301 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4302 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4303 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4304 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4305 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4306 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4307 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4308 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4309 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4310 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4311 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4312 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4313 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4314 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4315 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4316 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4317 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4318 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4319 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4320 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4321 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4322 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4323 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4324 AC_PLUGIN([target_notification], [yes], [The notification target])
4325 AC_PLUGIN([target_replace], [yes], [The replace target])
4326 AC_PLUGIN([target_scale],[yes], [The scale target])
4327 AC_PLUGIN([target_set], [yes], [The set target])
4328 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4329 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4330 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4331 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4332 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4333 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4334 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4335 AC_PLUGIN([users], [$plugin_users], [User statistics])
4336 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4337 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4338 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4339 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4340 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4341 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4342 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4344 dnl Default configuration file
4345 # Load either syslog or logfile
4346 LOAD_PLUGIN_SYSLOG=""
4347 LOAD_PLUGIN_LOGFILE=""
4349 AC_MSG_CHECKING([which default log plugin to load])
4350 default_log_plugin="none"
4351 if test "x$enable_syslog" = "xyes"
4353 default_log_plugin="syslog"
4355 LOAD_PLUGIN_SYSLOG="##"
4358 if test "x$enable_logfile" = "xyes"
4360 if test "x$default_log_plugin" = "xnone"
4362 default_log_plugin="logfile"
4364 LOAD_PLUGIN_LOGFILE="#"
4367 LOAD_PLUGIN_LOGFILE="##"
4369 AC_MSG_RESULT([$default_log_plugin])
4371 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4372 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4374 DEFAULT_LOG_LEVEL="info"
4375 if test "x$enable_debug" = "xyes"
4377 DEFAULT_LOG_LEVEL="debug"
4379 AC_SUBST(DEFAULT_LOG_LEVEL)
4381 # Load only one of rrdtool, network, csv in the default config.
4382 LOAD_PLUGIN_RRDTOOL=""
4383 LOAD_PLUGIN_NETWORK=""
4386 AC_MSG_CHECKING([which default write plugin to load])
4387 default_write_plugin="none"
4388 if test "x$enable_rrdtool" = "xyes"
4390 default_write_plugin="rrdtool"
4392 LOAD_PLUGIN_RRDTOOL="##"
4395 if test "x$enable_network" = "xyes"
4397 if test "x$default_write_plugin" = "xnone"
4399 default_write_plugin="network"
4401 LOAD_PLUGIN_NETWORK="#"
4404 LOAD_PLUGIN_NETWORK="##"
4407 if test "x$enable_csv" = "xyes"
4409 if test "x$default_write_plugin" = "xnone"
4411 default_write_plugin="csv"
4416 LOAD_PLUGIN_CSV="##"
4418 AC_MSG_RESULT([$default_write_plugin])
4420 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4421 AC_SUBST(LOAD_PLUGIN_NETWORK)
4422 AC_SUBST(LOAD_PLUGIN_CSV)
4425 if test "x$ac_system" = "xLinux" \
4426 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
4428 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4432 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4434 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4436 PERL_BINDINGS_OPTIONS="$withval"
4437 with_perl_bindings="yes"
4439 PERL_BINDINGS_OPTIONS=""
4440 with_perl_bindings="$withval"
4444 PERL_BINDINGS_OPTIONS=""
4445 if test -n "$perl_interpreter"
4447 with_perl_bindings="yes"
4449 with_perl_bindings="no (no perl interpreter found)"
4452 if test "x$with_perl_bindings" = "xyes"
4454 PERL_BINDINGS="perl"
4458 AC_SUBST(PERL_BINDINGS)
4459 AC_SUBST(PERL_BINDINGS_OPTIONS)
4461 dnl libcollectdclient
4462 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4463 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4464 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4466 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4468 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4470 AC_SUBST(LCC_VERSION_MAJOR)
4471 AC_SUBST(LCC_VERSION_MINOR)
4472 AC_SUBST(LCC_VERSION_PATCH)
4473 AC_SUBST(LCC_VERSION_EXTRA)
4474 AC_SUBST(LCC_VERSION_STRING)
4476 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4478 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)
4480 if test "x$with_librrd" = "xyes" \
4481 && test "x$librrd_threadsafe" != "xyes"
4483 with_librrd="yes (warning: librrd is not thread-safe)"
4486 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
4488 with_libiptc="yes (shipped version)"
4491 if test "x$with_libperl" = "xyes"
4493 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4495 enable_perl="no (needs libperl)"
4498 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4500 enable_perl="no (libperl doesn't support ithreads)"
4503 if test "x$with_perl_bindings" = "xyes" \
4504 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4506 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4513 libcurl . . . . . . . $with_libcurl
4514 libdbi . . . . . . . $with_libdbi
4515 libesmtp . . . . . . $with_libesmtp
4516 libganglia . . . . . $with_libganglia
4517 libgcrypt . . . . . . $with_libgcrypt
4518 libiokit . . . . . . $with_libiokit
4519 libiptc . . . . . . . $with_libiptc
4520 libjvm . . . . . . . $with_java
4521 libkstat . . . . . . $with_kstat
4522 libkvm . . . . . . . $with_libkvm
4523 libmemcached . . . . $with_libmemcached
4524 libmodbus . . . . . . $with_libmodbus
4525 libmysql . . . . . . $with_libmysql
4526 libnetapp . . . . . . $with_libnetapp
4527 libnetlink . . . . . $with_libnetlink
4528 libnetsnmp . . . . . $with_libnetsnmp
4529 libnotify . . . . . . $with_libnotify
4530 liboconfig . . . . . $with_liboconfig
4531 libopenipmi . . . . . $with_libopenipmipthread
4532 liboping . . . . . . $with_liboping
4533 libpcap . . . . . . . $with_libpcap
4534 libperfstat . . . . . $with_perfstat
4535 libperl . . . . . . . $with_libperl
4536 libpq . . . . . . . . $with_libpq
4537 libpthread . . . . . $with_libpthread
4538 librouteros . . . . . $with_librouteros
4539 librrd . . . . . . . $with_librrd
4540 libsensors . . . . . $with_libsensors
4541 libstatgrab . . . . . $with_libstatgrab
4542 libtokyotyrant . . . $with_libtokyotyrant
4543 libupsclient . . . . $with_libupsclient
4544 libvirt . . . . . . . $with_libvirt
4545 libxml2 . . . . . . . $with_libxml2
4546 libxmms . . . . . . . $with_libxmms
4547 libyajl . . . . . . . $with_libyajl
4548 oracle . . . . . . . $with_oracle
4549 python . . . . . . . $with_python
4552 daemon mode . . . . . $enable_daemon
4553 debug . . . . . . . . $enable_debug
4556 perl . . . . . . . . $with_perl_bindings
4559 apache . . . . . . . $enable_apache
4560 apcups . . . . . . . $enable_apcups
4561 apple_sensors . . . . $enable_apple_sensors
4562 ascent . . . . . . . $enable_ascent
4563 battery . . . . . . . $enable_battery
4564 bind . . . . . . . . $enable_bind
4565 conntrack . . . . . . $enable_conntrack
4566 contextswitch . . . . $enable_contextswitch
4567 cpu . . . . . . . . . $enable_cpu
4568 cpufreq . . . . . . . $enable_cpufreq
4569 csv . . . . . . . . . $enable_csv
4570 curl . . . . . . . . $enable_curl
4571 curl_json . . . . . . $enable_curl_json
4572 curl_xml . . . . . . $enable_curl_xml
4573 dbi . . . . . . . . . $enable_dbi
4574 df . . . . . . . . . $enable_df
4575 disk . . . . . . . . $enable_disk
4576 dns . . . . . . . . . $enable_dns
4577 email . . . . . . . . $enable_email
4578 entropy . . . . . . . $enable_entropy
4579 exec . . . . . . . . $enable_exec
4580 filecount . . . . . . $enable_filecount
4581 fscache . . . . . . . $enable_fscache
4582 gmond . . . . . . . . $enable_gmond
4583 hddtemp . . . . . . . $enable_hddtemp
4584 interface . . . . . . $enable_interface
4585 ipmi . . . . . . . . $enable_ipmi
4586 iptables . . . . . . $enable_iptables
4587 ipvs . . . . . . . . $enable_ipvs
4588 irq . . . . . . . . . $enable_irq
4589 java . . . . . . . . $enable_java
4590 libvirt . . . . . . . $enable_libvirt
4591 load . . . . . . . . $enable_load
4592 logfile . . . . . . . $enable_logfile
4593 madwifi . . . . . . . $enable_madwifi
4594 match_empty_counter . $enable_match_empty_counter
4595 match_hashed . . . . $enable_match_hashed
4596 match_regex . . . . . $enable_match_regex
4597 match_timediff . . . $enable_match_timediff
4598 match_value . . . . . $enable_match_value
4599 mbmon . . . . . . . . $enable_mbmon
4600 memcachec . . . . . . $enable_memcachec
4601 memcached . . . . . . $enable_memcached
4602 memory . . . . . . . $enable_memory
4603 modbus . . . . . . . $enable_modbus
4604 multimeter . . . . . $enable_multimeter
4605 mysql . . . . . . . . $enable_mysql
4606 netapp . . . . . . . $enable_netapp
4607 netlink . . . . . . . $enable_netlink
4608 network . . . . . . . $enable_network
4609 nfs . . . . . . . . . $enable_nfs
4610 nginx . . . . . . . . $enable_nginx
4611 notify_desktop . . . $enable_notify_desktop
4612 notify_email . . . . $enable_notify_email
4613 ntpd . . . . . . . . $enable_ntpd
4614 nut . . . . . . . . . $enable_nut
4615 olsrd . . . . . . . . $enable_olsrd
4616 onewire . . . . . . . $enable_onewire
4617 openvpn . . . . . . . $enable_openvpn
4618 oracle . . . . . . . $enable_oracle
4619 perl . . . . . . . . $enable_perl
4620 ping . . . . . . . . $enable_ping
4621 postgresql . . . . . $enable_postgresql
4622 powerdns . . . . . . $enable_powerdns
4623 processes . . . . . . $enable_processes
4624 protocols . . . . . . $enable_protocols
4625 python . . . . . . . $enable_python
4626 routeros . . . . . . $enable_routeros
4627 rrdcached . . . . . . $enable_rrdcached
4628 rrdtool . . . . . . . $enable_rrdtool
4629 sensors . . . . . . . $enable_sensors
4630 serial . . . . . . . $enable_serial
4631 snmp . . . . . . . . $enable_snmp
4632 swap . . . . . . . . $enable_swap
4633 syslog . . . . . . . $enable_syslog
4634 table . . . . . . . . $enable_table
4635 tail . . . . . . . . $enable_tail
4636 tape . . . . . . . . $enable_tape
4637 target_notification . $enable_target_notification
4638 target_replace . . . $enable_target_replace
4639 target_scale . . . . $enable_target_scale
4640 target_set . . . . . $enable_target_set
4641 tcpconns . . . . . . $enable_tcpconns
4642 teamspeak2 . . . . . $enable_teamspeak2
4643 ted . . . . . . . . . $enable_ted
4644 thermal . . . . . . . $enable_thermal
4645 tokyotyrant . . . . . $enable_tokyotyrant
4646 unixsock . . . . . . $enable_unixsock
4647 uptime . . . . . . . $enable_uptime
4648 users . . . . . . . . $enable_users
4649 uuid . . . . . . . . $enable_uuid
4650 vmem . . . . . . . . $enable_vmem
4651 vserver . . . . . . . $enable_vserver
4652 wireless . . . . . . $enable_wireless
4653 write_http . . . . . $enable_write_http
4654 xmms . . . . . . . . $enable_xmms
4655 zfs_arc . . . . . . . $enable_zfs_arc
4659 if test "x$dependency_error" = "xyes"; then
4660 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4663 if test "x$dependency_warning" = "xyes"; then
4664 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4667 # vim: set fdm=marker :