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_CHECK_PROG([HAVE_PROTOC_C], [protoc-c], [yes], [no])
52 AC_MSG_CHECKING([for kernel type ($host_os)])
55 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
59 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
69 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
75 AC_MSG_RESULT([$ac_system])
77 if test "x$ac_system" = "xLinux"
79 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
80 if test -z "$KERNEL_DIR"
82 KERNEL_DIR="/lib/modules/`uname -r`/source"
85 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
86 AC_SUBST(KERNEL_CFLAGS)
89 if test "x$ac_system" = "xSolaris"
91 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
94 # Where to install .pc files.
95 pkgconfigdir="${libdir}/pkgconfig"
96 AC_SUBST(pkgconfigdir)
98 # Check for standards compliance mode
99 AC_ARG_ENABLE(standards,
100 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
101 [enable_standards="$enableval"],
102 [enable_standards="no"])
103 if test "x$enable_standards" = "xyes"
105 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
106 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Define to enforce POSIX.1-2001 compliance.])
107 AC_DEFINE(_XOPEN_SOURCE, 600, [Define to enforce X/Open 6 (XSI) compliance.])
108 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
110 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
113 # Checks for header files.
120 AC_CHECK_HEADERS(stdio.h stdint.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)
123 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
128 # include <sys/types.h>
131 AC_CHECK_HEADERS(netinet/in.h, [], [],
136 # include <sys/types.h>
138 #if HAVE_NETINET_IN_SYSTM_H
139 # include <netinet/in_systm.h>
142 AC_CHECK_HEADERS(netinet/ip.h, [], [],
147 # include <sys/types.h>
149 #if HAVE_NETINET_IN_SYSTM_H
150 # include <netinet/in_systm.h>
152 #if HAVE_NETINET_IN_H
153 # include <netinet/in.h>
156 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
161 # include <sys/types.h>
163 #if HAVE_NETINET_IN_SYSTM_H
164 # include <netinet/in_systm.h>
166 #if HAVE_NETINET_IN_H
167 # include <netinet/in.h>
169 #if HAVE_NETINET_IP_H
170 # include <netinet/ip.h>
173 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
178 # include <sys/types.h>
180 #if HAVE_NETINET_IN_SYSTM_H
181 # include <netinet/in_systm.h>
183 #if HAVE_NETINET_IN_H
184 # include <netinet/in.h>
186 #if HAVE_NETINET_IP_H
187 # include <netinet/ip.h>
190 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
195 # include <sys/types.h>
197 #if HAVE_NETINET_IN_SYSTM_H
198 # include <netinet/in_systm.h>
200 #if HAVE_NETINET_IN_H
201 # include <netinet/in.h>
204 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
209 # include <sys/types.h>
211 #if HAVE_NETINET_IN_SYSTM_H
212 # include <netinet/in_systm.h>
214 #if HAVE_NETINET_IN_H
215 # include <netinet/in.h>
217 #if HAVE_NETINET_IP6_H
218 # include <netinet/ip6.h>
221 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
226 # include <sys/types.h>
228 #if HAVE_NETINET_IN_SYSTM_H
229 # include <netinet/in_systm.h>
231 #if HAVE_NETINET_IN_H
232 # include <netinet/in.h>
234 #if HAVE_NETINET_IP_H
235 # include <netinet/ip.h>
238 AC_CHECK_HEADERS(netinet/udp.h, [], [],
243 # include <sys/types.h>
245 #if HAVE_NETINET_IN_SYSTM_H
246 # include <netinet/in_systm.h>
248 #if HAVE_NETINET_IN_H
249 # include <netinet/in.h>
251 #if HAVE_NETINET_IP_H
252 # include <netinet/ip.h>
257 AC_CHECK_HEADERS(sys/dkstat.h)
258 if test "x$ac_system" = "xDarwin"
260 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)
261 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
263 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
266 # include <sys/types.h>
269 # include <sys/param.h>
273 AC_MSG_CHECKING([for sysctl kern.cp_times])
274 if test -x /sbin/sysctl
276 /sbin/sysctl kern.cp_times 2>/dev/null
280 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
281 [Define if sysctl supports kern.cp_times])
290 AC_CHECK_HEADERS(linux/major.h libgen.h)
292 # For the battery plugin
293 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
295 #if HAVE_IOKIT_IOKITLIB_H
296 # include <IOKit/IOKitLib.h>
298 #if HAVE_IOKIT_IOTYPES_H
299 # include <IOKit/IOTypes.h>
303 # For the swap module
304 have_linux_wireless_h="no"
305 if test "x$ac_system" = "xLinux"
307 AC_CHECK_HEADERS(linux/wireless.h,
308 [have_linux_wireless_h="yes"],
309 [have_linux_wireless_h="no"],
312 #include <sys/ioctl.h>
313 #include <sys/socket.h>
317 # For the swap module
318 have_sys_swap_h="yes"
319 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
321 #undef _FILE_OFFSET_BITS
322 #undef _LARGEFILE64_SOURCE
324 # include <sys/types.h>
327 # include <sys/param.h>
331 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
334 if test "x$GCC" = "xyes"
336 hint_64="CFLAGS='-m64'"
338 hint_64="CFLAGS='-xarch=v9'"
340 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
344 # For the processes plugin
346 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
348 # For interface plugin
349 AC_CHECK_HEADERS(ifaddrs.h)
350 AC_CHECK_HEADERS(net/if.h, [], [],
353 # include <sys/types.h>
355 #if HAVE_SYS_SOCKET_H
356 # include <sys/socket.h>
359 AC_CHECK_HEADERS(linux/if.h, [], [],
362 # include <sys/types.h>
364 #if HAVE_SYS_SOCKET_H
365 # include <sys/socket.h>
368 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
371 # include <sys/types.h>
373 #if HAVE_SYS_SOCKET_H
374 # include <sys/socket.h>
377 # include <linux/if.h>
382 have_net_ip_vs_h="no"
384 if test "x$ac_system" = "xLinux"
386 SAVE_CFLAGS="$CFLAGS"
387 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
389 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
390 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
392 CFLAGS="$SAVE_CFLAGS"
396 AC_CHECK_HEADERS(sys/ucred.h, [], [],
399 # include <sys/types.h>
402 # include <sys/param.h>
406 # For mount interface
407 AC_CHECK_HEADERS(sys/mount.h, [], [],
410 # include <sys/types.h>
413 # include <sys/param.h>
417 # For the email plugin
418 AC_CHECK_HEADERS(linux/un.h, [], [],
420 #if HAVE_SYS_SOCKET_H
421 # include <sys/socket.h>
425 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)
428 AC_CHECK_HEADERS(arpa/nameser.h)
429 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
431 #if HAVE_ARPA_NAMESER_H
432 # include <arpa/nameser.h>
436 AC_CHECK_HEADERS(net/if_arp.h, [], [],
437 [#if HAVE_SYS_SOCKET_H
438 # include <sys/socket.h>
441 AC_CHECK_HEADERS(net/ppp_defs.h)
442 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
443 [#if HAVE_NET_PPP_DEFS_H
444 # include <net/ppp_defs.h>
447 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
452 # include <sys/types.h>
454 #if HAVE_SYS_SOCKET_H
455 # include <sys/socket.h>
460 #if HAVE_NETINET_IN_H
461 # include <netinet/in.h>
465 # For the multimeter plugin
467 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
470 # Checks for typedefs, structures, and compiler characteristics.
479 # Checks for library functions.
481 AC_PROG_GCC_TRADITIONAL
482 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf if_indextoname)
486 AC_CACHE_CHECK([for strtok_r],
487 [c_cv_have_strtok_r_default],
496 char buffer[] = "foo,bar,baz";
503 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
506 printf ("token = %s;\n", token);
509 [c_cv_have_strtok_r_default="yes"],
510 [c_cv_have_strtok_r_default="no"]
514 if test "x$c_cv_have_strtok_r_default" = "xno"
516 SAVE_CFLAGS="$CFLAGS"
517 CFLAGS="$CFLAGS -D_REENTRANT=1"
519 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
520 [c_cv_have_strtok_r_reentrant],
529 char buffer[] = "foo,bar,baz";
536 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
539 printf ("token = %s;\n", token);
542 [c_cv_have_strtok_r_reentrant="yes"],
543 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
548 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
550 socket_needs_socket="no"
551 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
552 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
554 nanosleep_needs_rt="no"
555 nanosleep_needs_posix4="no"
556 AC_CHECK_FUNCS(nanosleep,
558 AC_CHECK_LIB(rt, nanosleep,
559 [nanosleep_needs_rt="yes"],
560 AC_CHECK_LIB(posix4, nanosleep,
561 [nanosleep_needs_posix4="yes"],
562 AC_MSG_ERROR(cannot find nanosleep))))
563 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
564 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$nanosleep_needs_posix4" = "xyes")
566 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
567 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
568 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
569 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
570 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
571 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
572 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
573 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
574 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
575 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
576 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
577 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
580 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
583 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
585 if test "x$withval" = "xno"; then
587 else if test "x$withval" = "xyes"; then
594 if test "x$nan_type" = "xnone"; then
595 AC_CACHE_CHECK([whether NAN is defined by default],
596 [c_cv_have_nan_default],
602 static float foo = NAN;
610 [c_cv_have_nan_default="yes"],
611 [c_cv_have_nan_default="no"]
614 if test "x$c_cv_have_nan_default" = "xyes"
619 if test "x$nan_type" = "xnone"; then
620 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
621 [c_cv_have_nan_isoc],
626 #define __USE_ISOC99 1
628 static float foo = NAN;
636 [c_cv_have_nan_isoc="yes"],
637 [c_cv_have_nan_isoc="no"]
640 if test "x$c_cv_have_nan_isoc" = "xyes"
645 if test "x$nan_type" = "xnone"; then
646 SAVE_LDFLAGS=$LDFLAGS
647 LDFLAGS="$LDFLAGS -lm"
648 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
649 [c_cv_have_nan_zero],
658 #define NAN (0.0 / 0.0)
660 # define isnan(f) ((f) != (f))
662 static float foo = NAN;
670 [c_cv_have_nan_zero="yes"],
671 [c_cv_have_nan_zero="no"]
674 LDFLAGS=$SAVE_LDFLAGS
675 if test "x$c_cv_have_nan_zero" = "xyes"
681 if test "x$nan_type" = "xdefault"; then
682 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
683 [Define if NAN is defined by default and can initialize static variables.])
684 else if test "x$nan_type" = "xisoc99"; then
685 AC_DEFINE(NAN_STATIC_ISOC, 1,
686 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
687 else if test "x$nan_type" = "xzero"; then
688 AC_DEFINE(NAN_ZERO_ZERO, 1,
689 [Define if NAN can be defined as (0.0 / 0.0)])
691 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
694 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
696 if test "x$withval" = "xnothing"; then
697 fp_layout_type="nothing"
698 else if test "x$withval" = "xendianflip"; then
699 fp_layout_type="endianflip"
700 else if test "x$withval" = "xintswap"; then
701 fp_layout_type="intswap"
703 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
706 [fp_layout_type="unknown"])
708 if test "x$fp_layout_type" = "xunknown"; then
709 AC_CACHE_CHECK([if doubles are stored in x86 representation],
710 [c_cv_fp_layout_need_nothing],
721 # include <stdbool.h>
731 memcpy ((void *) &i0, (void *) &d, 8);
734 memcpy ((void *) c, (void *) &i1, 8);
736 if ((c[0] == 0x2f) && (c[1] == 0x25)
737 && (c[2] == 0xc0) && (c[3] == 0xc7)
738 && (c[4] == 0x43) && (c[5] == 0x2b)
739 && (c[6] == 0x1f) && (c[7] == 0x5b))
744 [c_cv_fp_layout_need_nothing="yes"],
745 [c_cv_fp_layout_need_nothing="no"]
748 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
749 fp_layout_type="nothing"
752 if test "x$fp_layout_type" = "xunknown"; then
753 AC_CACHE_CHECK([if endianflip converts to x86 representation],
754 [c_cv_fp_layout_need_endianflip],
765 # include <stdbool.h>
767 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
768 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
769 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
770 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
771 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
772 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
773 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
774 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
783 memcpy ((void *) &i0, (void *) &d, 8);
785 i1 = endianflip (i0);
786 memcpy ((void *) c, (void *) &i1, 8);
788 if ((c[0] == 0x2f) && (c[1] == 0x25)
789 && (c[2] == 0xc0) && (c[3] == 0xc7)
790 && (c[4] == 0x43) && (c[5] == 0x2b)
791 && (c[6] == 0x1f) && (c[7] == 0x5b))
796 [c_cv_fp_layout_need_endianflip="yes"],
797 [c_cv_fp_layout_need_endianflip="no"]
800 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
801 fp_layout_type="endianflip"
804 if test "x$fp_layout_type" = "xunknown"; then
805 AC_CACHE_CHECK([if intswap converts to x86 representation],
806 [c_cv_fp_layout_need_intswap],
817 # include <stdbool.h>
819 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
820 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
829 memcpy ((void *) &i0, (void *) &d, 8);
832 memcpy ((void *) c, (void *) &i1, 8);
834 if ((c[0] == 0x2f) && (c[1] == 0x25)
835 && (c[2] == 0xc0) && (c[3] == 0xc7)
836 && (c[4] == 0x43) && (c[5] == 0x2b)
837 && (c[6] == 0x1f) && (c[7] == 0x5b))
842 [c_cv_fp_layout_need_intswap="yes"],
843 [c_cv_fp_layout_need_intswap="no"]
846 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
847 fp_layout_type="intswap"
851 if test "x$fp_layout_type" = "xnothing"; then
852 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
853 [Define if doubles are stored in x86 representation.])
854 else if test "x$fp_layout_type" = "xendianflip"; then
855 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
856 [Define if endianflip is needed to convert to x86 representation.])
857 else if test "x$fp_layout_type" = "xintswap"; then
858 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
859 [Define if intswap is needed to convert to x86 representation.])
861 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
865 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
867 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
869 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
872 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
873 if test "x$have_getmntent" = "xno"; then
874 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
876 if test "x$have_getmntent" = "xno"; then
877 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
879 if test "x$have_getmntent" = "xno"; then
880 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
883 if test "x$have_getmntent" = "xc"; then
884 AC_CACHE_CHECK([whether getmntent takes one argument],
885 [c_cv_have_one_getmntent],
887 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
888 #include "$srcdir/src/utils_mount.h"]],
892 fh = setmntent ("/etc/mtab", "r");
896 [c_cv_have_one_getmntent="yes"],
897 [c_cv_have_one_getmntent="no"]
900 AC_CACHE_CHECK([whether getmntent takes two arguments],
901 [c_cv_have_two_getmntent],
903 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
904 #include "$srcdir/src/utils_mount.h"]],
909 fh = fopen ("/etc/mnttab", "r");
910 status = getmntent (fh, &mt);
913 [c_cv_have_two_getmntent="yes"],
914 [c_cv_have_two_getmntent="no"]
919 # Check for different versions of `getmntent' here..
921 if test "x$have_getmntent" = "xc"; then
922 if test "x$c_cv_have_one_getmntent" = "xyes"; then
923 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
924 [Define if the function getmntent exists and takes one argument.])
926 if test "x$c_cv_have_two_getmntent" = "xyes"; then
927 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
928 [Define if the function getmntent exists and takes two arguments.])
931 if test "x$have_getmntent" = "xsun"; then
932 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
933 [Define if the function getmntent exists. It's the version from libsun.])
935 if test "x$have_getmntent" = "xseq"; then
936 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
937 [Define if the function getmntent exists. It's the version from libseq.])
939 if test "x$have_getmntent" = "xgen"; then
940 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
941 [Define if the function getmntent exists. It's the version from libgen.])
945 AC_MSG_CHECKING([if have htonll defined])
950 #include <sys/types.h>
951 #include <netinet/in.h>
952 #ifdef HAVE_INTTYPES_H
953 #include <inttypes.h>
960 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
963 AC_MSG_RESULT([$have_htonll])
965 # Check for structures
966 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
967 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
970 #include <sys/types.h>
971 #include <sys/socket.h>
974 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
975 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
978 #include <sys/types.h>
979 #include <sys/socket.h>
980 #include <linux/if.h>
981 #include <linux/netdevice.h>
984 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
987 #include <netinet/in.h>
991 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
993 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
994 [Define if struct kinfo_proc exists in the FreeBSD variant.])
995 have_struct_kinfo_proc_freebsd="yes"
998 have_struct_kinfo_proc_freebsd="no"
1002 #include <sys/param.h>
1003 #include <sys/sysctl.h>
1004 #include <sys/user.h>
1007 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1009 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1010 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1011 have_struct_kinfo_proc_openbsd="yes"
1014 have_struct_kinfo_proc_openbsd="no"
1017 #include <sys/param.h>
1018 #include <sys/sysctl.h>
1022 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1023 [#define _BSD_SOURCE
1025 # include <stdint.h>
1027 #if HAVE_SYS_TYPES_H
1028 # include <sys/types.h>
1030 #if HAVE_NETINET_IN_SYSTM_H
1031 # include <netinet/in_systm.h>
1033 #if HAVE_NETINET_IN_H
1034 # include <netinet/in.h>
1036 #if HAVE_NETINET_IP_H
1037 # include <netinet/ip.h>
1039 #if HAVE_NETINET_UDP_H
1040 # include <netinet/udp.h>
1043 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1044 [#define _BSD_SOURCE
1046 # include <stdint.h>
1048 #if HAVE_SYS_TYPES_H
1049 # include <sys/types.h>
1051 #if HAVE_NETINET_IN_SYSTM_H
1052 # include <netinet/in_systm.h>
1054 #if HAVE_NETINET_IN_H
1055 # include <netinet/in.h>
1057 #if HAVE_NETINET_IP_H
1058 # include <netinet/ip.h>
1060 #if HAVE_NETINET_UDP_H
1061 # include <netinet/udp.h>
1065 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1075 # Checks for libraries begin here
1077 with_libresolv="yes"
1078 AC_CHECK_LIB(resolv, res_search,
1080 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1082 [with_libresolv="no"])
1083 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1085 dnl Check for HAL (hardware abstraction library)
1087 AC_CHECK_LIB(hal,libhal_device_property_exists,
1088 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1090 if test "x$with_libhal" = "xyes"; then
1091 if test "x$PKG_CONFIG" != "x"; then
1092 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1093 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1094 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1095 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1099 m4_divert_once([HELP_WITH], [
1100 collectd additional packages:])
1102 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1104 if test "x$ac_system" = "xAIX"
1109 with_perfstat="no (AIX only)"
1110 with_procinfo="no (AIX only)"
1113 if test "x$with_perfstat" = "xyes"
1115 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1116 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1118 if test "x$with_perfstat" = "xyes"
1120 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1122 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1124 # Processes plugin under AIX.
1125 if test "x$with_procinfo" = "xyes"
1127 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1129 if test "x$with_procinfo" = "xyes"
1131 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1134 if test "x$ac_system" = "xSolaris"
1139 with_kstat="no (Solaris only)"
1140 with_devinfo="no (Solaris only)"
1143 if test "x$with_kstat" = "xyes"
1145 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1147 if test "x$with_kstat" = "xyes"
1149 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1150 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1152 if test "x$with_kstat" = "xyes"
1154 AC_DEFINE(HAVE_LIBKSTAT, 1,
1155 [Define to 1 if you have the 'kstat' library (-lkstat)])
1157 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1158 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1161 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1168 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1171 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1172 if test "x$with_kvm_getprocs" = "xyes"
1174 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1175 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1178 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1180 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1181 if test "x$with_kvm_getswapinfo" = "xyes"
1183 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1184 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1187 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1189 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1190 if test "x$with_kvm_nlist" = "xyes"
1192 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1193 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1196 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1198 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1199 if test "x$with_kvm_openfiles" = "xyes"
1201 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1202 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1205 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1207 # --with-libcurl {{{
1208 with_curl_config="curl-config"
1211 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1213 if test "x$withval" = "xno"
1216 else if test "x$withval" = "xyes"
1220 if test -f "$withval" && test -x "$withval"
1222 with_curl_config="$withval"
1224 else if test -x "$withval/bin/curl-config"
1226 with_curl_config="$withval/bin/curl-config"
1235 if test "x$with_libcurl" = "xyes"
1237 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1238 curl_config_status=$?
1240 if test $curl_config_status -ne 0
1242 with_libcurl="no ($with_curl_config failed)"
1244 SAVE_CPPFLAGS="$CPPFLAGS"
1245 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1247 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1249 CPPFLAGS="$SAVE_CPPFLAGS"
1252 if test "x$with_libcurl" = "xyes"
1254 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1255 curl_config_status=$?
1257 if test $curl_config_status -ne 0
1259 with_libcurl="no ($with_curl_config failed)"
1261 AC_CHECK_LIB(curl, curl_easy_init,
1262 [with_libcurl="yes"],
1263 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1267 if test "x$with_libcurl" = "xyes"
1269 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1270 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1271 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1272 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1274 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1278 with_libdbi_cppflags=""
1279 with_libdbi_ldflags=""
1280 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1282 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1284 with_libdbi_cppflags="-I$withval/include"
1285 with_libdbi_ldflags="-L$withval/lib"
1288 with_libdbi="$withval"
1294 if test "x$with_libdbi" = "xyes"
1296 SAVE_CPPFLAGS="$CPPFLAGS"
1297 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1299 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1301 CPPFLAGS="$SAVE_CPPFLAGS"
1303 if test "x$with_libdbi" = "xyes"
1305 SAVE_CPPFLAGS="$CPPFLAGS"
1306 SAVE_LDFLAGS="$LDFLAGS"
1307 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1308 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1310 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1312 CPPFLAGS="$SAVE_CPPFLAGS"
1313 LDFLAGS="$SAVE_LDFLAGS"
1315 if test "x$with_libdbi" = "xyes"
1317 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1318 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1319 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1320 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1321 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1322 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1324 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1327 # --with-libesmtp {{{
1328 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1330 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1332 LDFLAGS="$LDFLAGS -L$withval/lib"
1333 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1336 with_libesmtp="$withval"
1342 if test "x$with_libesmtp" = "xyes"
1344 AC_CHECK_LIB(esmtp, smtp_create_session,
1346 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1347 ], [with_libesmtp="no (libesmtp not found)"])
1349 if test "x$with_libesmtp" = "xyes"
1351 AC_CHECK_HEADERS(libesmtp.h,
1353 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1354 ], [with_libesmtp="no (libesmtp.h not found)"])
1356 if test "x$with_libesmtp" = "xyes"
1362 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1363 [Wether or not to use the esmtp library])
1364 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1367 # --with-libganglia {{{
1368 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1370 if test -f "$withval" && test -x "$withval"
1372 with_libganglia_config="$withval"
1373 with_libganglia="yes"
1374 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1376 with_libganglia_config="$withval/bin/ganglia-config"
1377 with_libganglia="yes"
1378 else if test -d "$withval"
1380 GANGLIA_CPPFLAGS="-I$withval/include"
1381 GANGLIA_LDFLAGS="-L$withval/lib"
1382 with_libganglia="yes"
1384 with_libganglia_config="ganglia-config"
1385 with_libganglia="$withval"
1389 with_libganglia_config="ganglia-config"
1390 with_libganglia="yes"
1393 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1395 if test "x$GANGLIA_CPPFLAGS" = "x"
1397 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1400 if test "x$GANGLIA_LDFLAGS" = "x"
1402 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1405 if test "x$GANGLIA_LIBS" = "x"
1407 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1411 SAVE_CPPFLAGS="$CPPFLAGS"
1412 SAVE_LDFLAGS="$LDFLAGS"
1413 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1414 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1416 if test "x$with_libganglia" = "xyes"
1418 AC_CHECK_HEADERS(gm_protocol.h,
1420 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1421 [Define to 1 if you have the <gm_protocol.h> header file.])
1422 ], [with_libganglia="no (gm_protocol.h not found)"])
1425 if test "x$with_libganglia" = "xyes"
1427 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1429 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1430 [Define to 1 if you have the ganglia library (-lganglia).])
1431 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1434 CPPFLAGS="$SAVE_CPPFLAGS"
1435 LDFLAGS="$SAVE_LDFLAGS"
1437 AC_SUBST(GANGLIA_CPPFLAGS)
1438 AC_SUBST(GANGLIA_LDFLAGS)
1439 AC_SUBST(GANGLIA_LIBS)
1440 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1443 # --with-libgcrypt {{{
1444 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1445 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1446 GCRYPT_LIBS="$GCRYPT_LIBS"
1447 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1449 if test -f "$withval" && test -x "$withval"
1451 with_libgcrypt_config="$withval"
1452 with_libgcrypt="yes"
1453 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1455 with_libgcrypt_config="$withval/bin/gcrypt-config"
1456 with_libgcrypt="yes"
1457 else if test -d "$withval"
1459 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1460 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1461 with_libgcrypt="yes"
1463 with_libgcrypt_config="gcrypt-config"
1464 with_libgcrypt="$withval"
1468 with_libgcrypt_config="libgcrypt-config"
1469 with_libgcrypt="yes"
1472 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1474 if test "x$GCRYPT_CPPFLAGS" = "x"
1476 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1479 if test "x$GCRYPT_LDFLAGS" = "x"
1481 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1482 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1485 if test "x$GCRYPT_LIBS" = "x"
1487 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1491 SAVE_CPPFLAGS="$CPPFLAGS"
1492 SAVE_LDFLAGS="$LDFLAGS"
1493 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1494 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1496 if test "x$with_libgcrypt" = "xyes"
1498 if test "x$GCRYPT_CPPFLAGS" != "x"
1500 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1502 AC_CHECK_HEADERS(gcrypt.h,
1503 [with_libgcrypt="yes"],
1504 [with_libgcrypt="no (gcrypt.h not found)"])
1507 if test "x$with_libgcrypt" = "xyes"
1509 if test "x$GCRYPT_LDFLAGS" != "x"
1511 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1513 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1514 [with_libgcrypt="yes"],
1515 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1517 if test "$with_libgcrypt" != "no"; then
1518 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1522 CPPFLAGS="$SAVE_CPPFLAGS"
1523 LDFLAGS="$SAVE_LDFLAGS"
1525 if test "x$with_libgcrypt" = "xyes"
1527 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1530 AC_SUBST(GCRYPT_CPPFLAGS)
1531 AC_SUBST(GCRYPT_LDFLAGS)
1532 AC_SUBST(GCRYPT_LIBS)
1533 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1536 # --with-libiptc {{{
1537 with_own_libiptc="no"
1538 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1540 if test "x$withval" = "xshipped"
1542 with_own_libiptc="yes"
1544 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1546 LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS -I$withval/include"
1547 LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS -L$withval/lib"
1550 with_libiptc="$withval"
1554 if test "x$ac_system" = "xLinux"
1558 with_libiptc="no (Linux only)"
1561 SAVE_CPPFLAGS="$CPPFLAGS"
1562 SAVE_LDFLAGS="$LDFLAGS"
1563 CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
1564 LDFLAGS="$LDFLAGS $LIBIPTC_LDFLAGS"
1565 # check whether the header file for libiptc is available.
1566 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1568 AC_CHECK_HEADERS(libiptc/libiptc.h,
1570 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1574 with_own_libiptc="yes"
1577 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1579 AC_CHECK_HEADERS(libiptc/libip6tc.h,
1581 AC_DEFINE(HAVE_LIBIPTC_LIBIP6TC_H, 1, [Define to 1 if you have the <libiptc/libip6tc.h> header file.])
1585 with_own_libiptc="yes"
1588 # If the header file is available, check for the required type declaractions.
1589 # They may be missing in old versions of libiptc. In that case, they will be
1590 # declared in the iptables plugin.
1591 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1593 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [],
1596 # include "$srcdir/src/owniptc/libiptc.h"
1597 # include "$srcdir/src/owniptc/libip6tc.h"
1599 # include <libiptc/libiptc.h>
1600 # include <libiptc/libip6tc.h>
1604 # Check for the iptc_init symbol in the library.
1605 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1607 AC_CHECK_LIB(iptc, iptc_init,
1609 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1613 with_own_libiptc="yes"
1616 # The system wide version failed for some reason. Check if we have the required
1617 # headers to build the shipped version.
1618 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xyes"
1620 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1622 with_libiptc="no (Linux iptables headers not found)"
1623 with_own_libiptc="no"
1626 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1629 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1630 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1631 if test "x$with_libiptc" = "xyes"
1633 BUILD_WITH_LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS"
1634 BUILD_WITH_LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS"
1635 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1636 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1638 if test "x$with_own_libiptc" = "xyes"
1640 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1642 CPPFLAGS="$SAVE_CPPFLAGS"
1643 LDFLAGS="$SAVE_LDFLAGS"
1647 with_java_home="$JAVA_HOME"
1648 with_java_vmtype="client"
1653 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1655 if test "x$withval" = "xno"
1658 else if test "x$withval" = "xyes"
1662 with_java_home="$withval"
1667 if test "x$with_java" = "xyes"
1669 if test -d "$with_java_home"
1671 AC_MSG_CHECKING([for jni.h])
1672 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1673 if test "x$TMPDIR" != "x"
1675 AC_MSG_RESULT([found in $TMPDIR])
1676 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1678 AC_MSG_RESULT([not found])
1681 AC_MSG_CHECKING([for jni_md.h])
1682 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1683 if test "x$TMPDIR" != "x"
1685 AC_MSG_RESULT([found in $TMPDIR])
1686 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1688 AC_MSG_RESULT([not found])
1691 AC_MSG_CHECKING([for libjvm.so])
1692 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1693 if test "x$TMPDIR" != "x"
1695 AC_MSG_RESULT([found in $TMPDIR])
1696 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1698 AC_MSG_RESULT([not found])
1701 if test "x$JAVAC" = "x"
1703 AC_MSG_CHECKING([for javac])
1704 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1705 if test "x$TMPDIR" != "x"
1708 AC_MSG_RESULT([$JAVAC])
1710 AC_MSG_RESULT([not found])
1713 if test "x$JAR" = "x"
1715 AC_MSG_CHECKING([for jar])
1716 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1717 if test "x$TMPDIR" != "x"
1720 AC_MSG_RESULT([$JAR])
1722 AC_MSG_RESULT([not found])
1725 else if test "x$with_java_home" != "x"
1727 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1731 if test "x$JAVA_CPPFLAGS" != "x"
1733 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1735 if test "x$JAVA_CFLAGS" != "x"
1737 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1739 if test "x$JAVA_LDFLAGS" != "x"
1741 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1743 if test "x$JAVAC" = "x"
1745 with_javac_path="$PATH"
1746 if test "x$with_java_home" != "x"
1748 with_javac_path="$with_java_home:with_javac_path"
1749 if test -d "$with_java_home/bin"
1751 with_javac_path="$with_java_home/bin:with_javac_path"
1755 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1757 if test "x$JAVAC" = "x"
1759 with_java="no (javac not found)"
1761 if test "x$JAR" = "x"
1763 with_jar_path="$PATH"
1764 if test "x$with_java_home" != "x"
1766 with_jar_path="$with_java_home:$with_jar_path"
1767 if test -d "$with_java_home/bin"
1769 with_jar_path="$with_java_home/bin:$with_jar_path"
1773 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
1775 if test "x$JAR" = "x"
1777 with_java="no (jar not found)"
1780 SAVE_CPPFLAGS="$CPPFLAGS"
1781 SAVE_CFLAGS="$CFLAGS"
1782 SAVE_LDFLAGS="$LDFLAGS"
1783 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1784 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1785 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1787 if test "x$with_java" = "xyes"
1789 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1791 if test "x$with_java" = "xyes"
1793 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1795 [with_java="no (libjvm not found)"],
1798 if test "x$with_java" = "xyes"
1800 JAVA_LIBS="$JAVA_LIBS -ljvm"
1801 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1804 CPPFLAGS="$SAVE_CPPFLAGS"
1805 CFLAGS="$SAVE_CFLAGS"
1806 LDFLAGS="$SAVE_LDFLAGS"
1808 AC_SUBST(JAVA_CPPFLAGS)
1809 AC_SUBST(JAVA_CFLAGS)
1810 AC_SUBST(JAVA_LDFLAGS)
1812 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1815 # --with-libmemcached {{{
1816 with_libmemcached_cppflags=""
1817 with_libmemcached_ldflags=""
1818 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1820 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1822 with_libmemcached_cppflags="-I$withval/include"
1823 with_libmemcached_ldflags="-L$withval/lib"
1824 with_libmemcached="yes"
1826 with_libmemcached="$withval"
1830 with_libmemcached="yes"
1832 if test "x$with_libmemcached" = "xyes"
1834 SAVE_CPPFLAGS="$CPPFLAGS"
1835 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1837 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1839 CPPFLAGS="$SAVE_CPPFLAGS"
1841 if test "x$with_libmemcached" = "xyes"
1843 SAVE_CPPFLAGS="$CPPFLAGS"
1844 SAVE_LDFLAGS="$LDFLAGS"
1845 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1846 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1848 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1850 CPPFLAGS="$SAVE_CPPFLAGS"
1851 LDFLAGS="$SAVE_LDFLAGS"
1853 if test "x$with_libmemcached" = "xyes"
1855 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1856 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1857 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1858 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1859 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1860 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1861 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1863 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1866 # --with-libmodbus {{{
1867 with_libmodbus_config=""
1868 with_libmodbus_cflags=""
1869 with_libmodbus_libs=""
1870 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
1872 if test "x$withval" = "xno"
1875 else if test "x$withval" = "xyes"
1877 with_libmodbus="use_pkgconfig"
1878 else if test -d "$with_libmodbus/lib"
1880 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
1881 with_libmodbus_cflags="-I$withval/include"
1882 with_libmodbus_libs="-L$withval/lib -lmodbus"
1883 with_libmodbus="yes"
1886 [with_libmodbus="use_pkgconfig"])
1888 # configure using pkg-config
1889 if test "x$with_libmodbus" = "xuse_pkgconfig"
1891 if test "x$PKG_CONFIG" = "x"
1893 with_libmodbus="no (Don't have pkg-config)"
1896 if test "x$with_libmodbus" = "xuse_pkgconfig"
1898 AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
1899 $PKG_CONFIG --exists 'modbus' 2>/dev/null
1902 with_libmodbus="no (pkg-config doesn't know library)"
1905 if test "x$with_libmodbus" = "xuse_pkgconfig"
1907 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
1910 with_libmodbus="no ($PKG_CONFIG failed)"
1912 with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
1915 with_libmodbus="no ($PKG_CONFIG failed)"
1918 if test "x$with_libmodbus" = "xuse_pkgconfig"
1920 with_libmodbus="yes"
1923 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
1924 # the actual checks.
1925 if test "x$with_libmodbus" = "xyes"
1927 SAVE_CPPFLAGS="$CPPFLAGS"
1928 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1930 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
1932 CPPFLAGS="$SAVE_CPPFLAGS"
1934 if test "x$with_libmodbus" = "xyes"
1936 SAVE_CPPFLAGS="$CPPFLAGS"
1937 SAVE_LDFLAGS="$LDFLAGS"
1939 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1940 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
1942 AC_CHECK_LIB(modbus, modbus_init_tcp,
1943 [with_libmodbus="yes"],
1944 [with_libmodbus="no (symbol modbus_init_tcp not found)"])
1946 CPPFLAGS="$SAVE_CPPFLAGS"
1947 LDFLAGS="$SAVE_LDFLAGS"
1949 if test "x$with_libmodbus" = "xyes"
1951 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
1952 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
1953 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
1954 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
1958 # --with-libmysql {{{
1959 with_mysql_config="mysql_config"
1960 with_mysql_cflags=""
1962 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1964 if test "x$withval" = "xno"
1967 else if test "x$withval" = "xyes"
1971 if test -f "$withval" && test -x "$withval";
1973 with_mysql_config="$withval"
1974 else if test -x "$withval/bin/mysql_config"
1976 with_mysql_config="$withval/bin/mysql_config"
1984 if test "x$with_libmysql" = "xyes"
1986 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1987 mysql_config_status=$?
1989 if test $mysql_config_status -ne 0
1991 with_libmysql="no ($with_mysql_config failed)"
1993 SAVE_CPPFLAGS="$CPPFLAGS"
1994 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1997 have_mysql_mysql_h="no"
1998 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2000 if test "x$have_mysql_h" = "xno"
2002 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2005 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2007 with_libmysql="no (mysql.h not found)"
2010 CPPFLAGS="$SAVE_CPPFLAGS"
2013 if test "x$with_libmysql" = "xyes"
2015 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
2016 mysql_config_status=$?
2018 if test $mysql_config_status -ne 0
2020 with_libmysql="no ($with_mysql_config failed)"
2022 AC_CHECK_LIB(mysqlclient, mysql_init,
2023 [with_libmysql="yes"],
2024 [with_libmysql="no (symbol 'mysql_init' not found)"],
2027 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2028 [with_libmysql="yes"],
2029 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2033 if test "x$with_libmysql" = "xyes"
2035 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2036 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2037 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2038 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2040 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2043 # --with-libnetlink {{{
2044 with_libnetlink_cflags=""
2045 with_libnetlink_libs="-lnetlink"
2046 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2048 echo "libnetlink: withval = $withval"
2049 if test "x$withval" = "xyes"
2051 with_libnetlink="yes"
2052 else if test "x$withval" = "xno"
2054 with_libnetlink="no"
2056 if test -d "$withval/include"
2058 with_libnetlink_cflags="-I$withval/include"
2059 with_libnetlink_libs="-L$withval/lib -lnetlink"
2060 with_libnetlink="yes"
2062 AC_MSG_ERROR("no such directory: $withval/include")
2067 if test "x$ac_system" = "xLinux"
2069 with_libnetlink="yes"
2071 with_libnetlink="no (Linux only library)"
2074 if test "x$with_libnetlink" = "xyes"
2076 SAVE_CFLAGS="$CFLAGS"
2077 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2079 with_libnetlink="no (libnetlink.h not found)"
2081 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2083 with_libnetlink="yes"
2087 #include <sys/types.h>
2088 #include <asm/types.h>
2089 #include <sys/socket.h>
2090 #include <linux/netlink.h>
2091 #include <linux/rtnetlink.h>])
2092 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2094 #include <sys/types.h>
2095 #include <asm/types.h>
2096 #include <sys/socket.h>])
2100 #include <sys/types.h>
2101 #include <asm/types.h>
2102 #include <sys/socket.h>
2103 #include <linux/netlink.h>
2104 #include <linux/rtnetlink.h>
2108 int retval = TCA_STATS2;
2111 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2116 #include <sys/types.h>
2117 #include <asm/types.h>
2118 #include <sys/socket.h>
2119 #include <linux/netlink.h>
2120 #include <linux/rtnetlink.h>
2124 int retval = TCA_STATS;
2127 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2130 CFLAGS="$SAVE_CFLAGS"
2132 if test "x$with_libnetlink" = "xyes"
2134 AC_CHECK_LIB(netlink, rtnl_open,
2135 [with_libnetlink="yes"],
2136 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2137 [$with_libnetlink_libs])
2139 if test "x$with_libnetlink" = "xyes"
2141 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2142 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2143 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2144 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2146 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2149 # --with-libnetapp {{{
2150 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2151 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2152 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2153 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2154 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2155 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2156 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2158 if test -d "$withval"
2160 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2161 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2162 with_libnetapp="yes"
2164 with_libnetapp="$withval"
2168 with_libnetapp="yes"
2171 SAVE_CPPFLAGS="$CPPFLAGS"
2172 SAVE_LDFLAGS="$LDFLAGS"
2173 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2174 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2176 if test "x$with_libnetapp" = "xyes"
2178 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2180 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2182 AC_CHECK_HEADERS(netapp_api.h,
2183 [with_libnetapp="yes"],
2184 [with_libnetapp="no (netapp_api.h not found)"])
2187 if test "x$with_libnetapp" = "xyes"
2189 if test "x$LIBNETAPP_LDFLAGS" != "x"
2191 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2194 if test "x$LIBNETAPP_LIBS" = "x"
2196 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2198 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2200 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2201 [with_libnetapp="yes"],
2202 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2204 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2207 CPPFLAGS="$SAVE_CPPFLAGS"
2208 LDFLAGS="$SAVE_LDFLAGS"
2210 if test "x$with_libnetapp" = "xyes"
2212 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2215 AC_SUBST(LIBNETAPP_CPPFLAGS)
2216 AC_SUBST(LIBNETAPP_LDFLAGS)
2217 AC_SUBST(LIBNETAPP_LIBS)
2218 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2221 # --with-libnetsnmp {{{
2222 with_snmp_config="net-snmp-config"
2225 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2227 if test "x$withval" = "xno"
2229 with_libnetsnmp="no"
2230 else if test "x$withval" = "xyes"
2232 with_libnetsnmp="yes"
2234 if test -x "$withval"
2236 with_snmp_config="$withval"
2237 with_libnetsnmp="yes"
2239 with_snmp_config="$withval/bin/net-snmp-config"
2240 with_libnetsnmp="yes"
2244 [with_libnetsnmp="yes"])
2245 if test "x$with_libnetsnmp" = "xyes"
2247 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2248 snmp_config_status=$?
2250 if test $snmp_config_status -ne 0
2252 with_libnetsnmp="no ($with_snmp_config failed)"
2254 SAVE_CPPFLAGS="$CPPFLAGS"
2255 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2257 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2259 CPPFLAGS="$SAVE_CPPFLAGS"
2262 if test "x$with_libnetsnmp" = "xyes"
2264 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2265 snmp_config_status=$?
2267 if test $snmp_config_status -ne 0
2269 with_libnetsnmp="no ($with_snmp_config failed)"
2271 AC_CHECK_LIB(netsnmp, init_snmp,
2272 [with_libnetsnmp="yes"],
2273 [with_libnetsnmp="no (libnetsnmp not found)"],
2277 if test "x$with_libnetsnmp" = "xyes"
2279 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2280 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2281 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2282 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2284 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2287 # --with-liboconfig {{{
2288 with_own_liboconfig="no"
2289 liboconfig_LDFLAGS="$LDFLAGS"
2290 liboconfig_CPPFLAGS="$CPPFLAGS"
2291 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2293 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2295 if test -d "$withval/lib"
2297 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2299 if test -d "$withval/include"
2301 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2304 if test "x$withval" = "xno"
2306 AC_MSG_ERROR("liboconfig is required")
2310 with_liboconfig="yes"
2313 save_LDFLAGS="$LDFLAGS"
2314 save_CPPFLAGS="$CPPFLAGS"
2315 LDFLAGS="$liboconfig_LDFLAGS"
2316 CPPFLAGS="$liboconfig_CPPFLAGS"
2317 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2319 with_liboconfig="yes"
2320 with_own_liboconfig="no"
2323 with_liboconfig="yes"
2324 with_own_liboconfig="yes"
2325 LDFLAGS="$save_LDFLAGS"
2326 CPPFLAGS="$save_CPPFLAGS"
2329 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2330 if test "x$with_own_liboconfig" = "xyes"
2332 with_liboconfig="yes (shipped version)"
2336 # --with-liboping {{{
2337 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2339 if test "x$withval" = "xyes"
2342 else if test "x$withval" = "xno"
2347 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2348 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2351 [with_liboping="yes"])
2353 SAVE_CPPFLAGS="$CPPFLAGS"
2354 SAVE_LDFLAGS="$LDFLAGS"
2356 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2357 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2359 if test "x$with_liboping" = "xyes"
2361 if test "x$LIBOPING_CPPFLAGS" != "x"
2363 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2365 AC_CHECK_HEADERS(oping.h,
2366 [with_liboping="yes"],
2367 [with_liboping="no ('oping.h' not found)"])
2369 if test "x$with_liboping" = "xyes"
2371 if test "x$LIBOPING_LDFLAGS" != "x"
2373 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2375 AC_CHECK_LIB(oping, ping_construct,
2376 [with_liboping="yes"],
2377 [with_liboping="no (symbol 'ping_construct' not found)"])
2380 CPPFLAGS="$SAVE_CPPFLAGS"
2381 LDFLAGS="$SAVE_LDFLAGS"
2383 if test "x$with_liboping" = "xyes"
2385 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2386 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2387 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2388 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2390 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2394 with_oracle_cppflags=""
2396 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2398 if test "x$withval" = "xyes"
2400 if test "x$ORACLE_HOME" = "x"
2402 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2405 else if test "x$withval" = "xno"
2410 ORACLE_HOME="$withval"
2414 if test "x$ORACLE_HOME" = "x"
2416 with_oracle="no (ORACLE_HOME is not set)"
2421 if test "x$ORACLE_HOME" != "x"
2423 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2425 if test -e "$ORACLE_HOME/lib/ldflags"
2427 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2429 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2430 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2432 if test "x$with_oracle" = "xyes"
2434 SAVE_CPPFLAGS="$CPPFLAGS"
2435 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2437 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2439 CPPFLAGS="$SAVE_CPPFLAGS"
2441 if test "x$with_oracle" = "xyes"
2443 SAVE_CPPFLAGS="$CPPFLAGS"
2444 SAVE_LDFLAGS="$LDFLAGS"
2445 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2446 LDFLAGS="$LDFLAGS $with_oracle_libs"
2448 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2450 CPPFLAGS="$SAVE_CPPFLAGS"
2451 LDFLAGS="$SAVE_LDFLAGS"
2453 if test "x$with_oracle" = "xyes"
2455 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2456 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2457 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2458 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2462 # --with-libowcapi {{{
2463 with_libowcapi_cppflags=""
2464 with_libowcapi_libs="-lowcapi"
2465 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2467 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2469 with_libowcapi_cppflags="-I$withval/include"
2470 with_libowcapi_libs="-L$withval/lib -lowcapi"
2471 with_libowcapi="yes"
2473 with_libowcapi="$withval"
2477 with_libowcapi="yes"
2479 if test "x$with_libowcapi" = "xyes"
2481 SAVE_CPPFLAGS="$CPPFLAGS"
2482 CPPFLAGS="$with_libowcapi_cppflags"
2484 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2486 CPPFLAGS="$SAVE_CPPFLAGS"
2488 if test "x$with_libowcapi" = "xyes"
2490 SAVE_LDFLAGS="$LDFLAGS"
2491 SAVE_CPPFLAGS="$CPPFLAGS"
2492 LDFLAGS="$with_libowcapi_libs"
2493 CPPFLAGS="$with_libowcapi_cppflags"
2495 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2497 LDFLAGS="$SAVE_LDFLAGS"
2498 CPPFLAGS="$SAVE_CPPFLAGS"
2500 if test "x$with_libowcapi" = "xyes"
2502 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2503 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2504 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2505 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2509 # --with-libpcap {{{
2510 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2512 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2514 LDFLAGS="$LDFLAGS -L$withval/lib"
2515 CPPFLAGS="$CPPFLAGS -I$withval/include"
2518 with_libpcap="$withval"
2524 if test "x$with_libpcap" = "xyes"
2526 AC_CHECK_LIB(pcap, pcap_open_live,
2528 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2529 ], [with_libpcap="no (libpcap not found)"])
2531 if test "x$with_libpcap" = "xyes"
2533 AC_CHECK_HEADERS(pcap.h,
2535 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2536 ], [with_libpcap="no (pcap.h not found)"])
2538 if test "x$with_libpcap" = "xyes"
2544 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2545 [Wether or not to use the pcap library])
2546 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2549 # --with-libperl {{{
2550 perl_interpreter="perl"
2551 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2553 if test -x "$withval"
2555 perl_interpreter="$withval"
2557 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2559 LDFLAGS="$LDFLAGS -L$withval/lib"
2560 CPPFLAGS="$CPPFLAGS -I$withval/include"
2561 perl_interpreter="$withval/bin/perl"
2564 with_libperl="$withval"
2571 AC_MSG_CHECKING([for perl])
2572 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2573 if test -x "$perl_interpreter"
2575 AC_MSG_RESULT([yes ($perl_interpreter)])
2581 AC_SUBST(PERL, "$perl_interpreter")
2583 if test "x$with_libperl" = "xyes" \
2584 && test -n "$perl_interpreter"
2586 SAVE_CFLAGS="$CFLAGS"
2587 SAVE_LDFLAGS="$LDFLAGS"
2588 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2589 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2590 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2591 CFLAGS="$CFLAGS $PERL_CFLAGS"
2592 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2594 AC_CACHE_CHECK([for libperl],
2595 [c_cv_have_libperl],
2599 #define PERL_NO_GET_CONTEXT
2606 load_module (PERL_LOADMOD_NOIMPORT,
2607 newSVpv ("Collectd::Plugin::FooBar", 24),
2610 [c_cv_have_libperl="yes"],
2611 [c_cv_have_libperl="no"]
2615 if test "x$c_cv_have_libperl" = "xyes"
2617 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2618 AC_SUBST(PERL_CFLAGS)
2619 AC_SUBST(PERL_LDFLAGS)
2624 CFLAGS="$SAVE_CFLAGS"
2625 LDFLAGS="$SAVE_LDFLAGS"
2626 else if test -z "$perl_interpreter"; then
2627 with_libperl="no (no perl interpreter found)"
2628 c_cv_have_libperl="no"
2630 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2632 if test "x$with_libperl" = "xyes"
2634 SAVE_CFLAGS="$CFLAGS"
2635 SAVE_LDFLAGS="$LDFLAGS"
2636 CFLAGS="$CFLAGS $PERL_CFLAGS"
2637 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2639 AC_CACHE_CHECK([if perl supports ithreads],
2640 [c_cv_have_perl_ithreads],
2648 #if !defined(USE_ITHREADS)
2649 # error "Perl does not support ithreads!"
2650 #endif /* !defined(USE_ITHREADS) */
2653 [c_cv_have_perl_ithreads="yes"],
2654 [c_cv_have_perl_ithreads="no"]
2658 if test "x$c_cv_have_perl_ithreads" = "xyes"
2660 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2663 CFLAGS="$SAVE_CFLAGS"
2664 LDFLAGS="$SAVE_LDFLAGS"
2667 if test "x$with_libperl" = "xyes"
2669 SAVE_CFLAGS="$CFLAGS"
2670 SAVE_LDFLAGS="$LDFLAGS"
2671 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2672 # (see issues #41 and #42)
2673 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2674 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2676 AC_CACHE_CHECK([for broken Perl_load_module()],
2677 [c_cv_have_broken_perl_load_module],
2681 #define PERL_NO_GET_CONTEXT
2688 load_module (PERL_LOADMOD_NOIMPORT,
2689 newSVpv ("Collectd::Plugin::FooBar", 24),
2692 [c_cv_have_broken_perl_load_module="no"],
2693 [c_cv_have_broken_perl_load_module="yes"]
2697 CFLAGS="$SAVE_CFLAGS"
2698 LDFLAGS="$SAVE_LDFLAGS"
2700 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2701 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2703 if test "x$with_libperl" = "xyes"
2705 SAVE_CFLAGS="$CFLAGS"
2706 SAVE_LDFLAGS="$LDFLAGS"
2707 CFLAGS="$CFLAGS $PERL_CFLAGS"
2708 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2711 [struct mgvtbl.svt_local],
2712 [have_struct_mgvtbl_svt_local="yes"],
2713 [have_struct_mgvtbl_svt_local="no"],
2720 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2722 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2723 [Define if Perl's struct mgvtbl has member svt_local.])
2726 CFLAGS="$SAVE_CFLAGS"
2727 LDFLAGS="$SAVE_LDFLAGS"
2732 with_pg_config="pg_config"
2733 with_libpq_includedir=""
2734 with_libpq_libdir=""
2735 with_libpq_cppflags=""
2736 with_libpq_ldflags=""
2737 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2740 if test "x$withval" = "xno"
2743 else if test "x$withval" = "xyes"
2747 if test -f "$withval" && test -x "$withval";
2749 with_pg_config="$withval"
2750 else if test -x "$withval/bin/pg_config"
2752 with_pg_config="$withval/bin/pg_config"
2760 if test "x$with_libpq" = "xyes"
2762 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2765 if test $pg_config_status -eq 0
2767 if test -n "$with_libpq_includedir"; then
2768 for dir in $with_libpq_includedir; do
2769 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2773 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2776 SAVE_CPPFLAGS="$CPPFLAGS"
2777 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2779 AC_CHECK_HEADERS(libpq-fe.h, [],
2780 [with_libpq="no (libpq-fe.h not found)"], [])
2782 CPPFLAGS="$SAVE_CPPFLAGS"
2784 if test "x$with_libpq" = "xyes"
2786 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2789 if test $pg_config_status -eq 0
2791 if test -n "$with_libpq_libdir"; then
2792 for dir in $with_libpq_libdir; do
2793 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2797 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2800 SAVE_LDFLAGS="$LDFLAGS"
2801 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2803 AC_CHECK_LIB(pq, PQconnectdb,
2805 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2807 AC_CHECK_LIB(pq, PQserverVersion,
2809 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2811 LDFLAGS="$SAVE_LDFLAGS"
2813 if test "x$with_libpq" = "xyes"
2815 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2816 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2817 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2818 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2820 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2823 # --with-libpthread {{{
2824 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2825 [ if test "x$withval" != "xno" \
2826 && test "x$withval" != "xyes"
2828 LDFLAGS="$LDFLAGS -L$withval/lib"
2829 CPPFLAGS="$CPPFLAGS -I$withval/include"
2830 with_libpthread="yes"
2832 if test "x$withval" = "xno"
2834 with_libpthread="no (disabled)"
2837 ], [with_libpthread="yes"])
2838 if test "x$with_libpthread" = "xyes"
2840 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2843 if test "x$with_libpthread" = "xyes"
2845 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2847 if test "x$with_libpthread" = "xyes"
2853 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2854 [Wether or not to use pthread (POSIX threads) library])
2855 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2860 with_python_path="$PATH"
2861 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
2863 if test "x$withval" = "xyes" || test "x$withval" = "xno"
2865 with_python="$withval"
2866 else if test -x "$withval"
2868 with_python_prog="$withval"
2869 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
2871 else if test -d "$withval"
2873 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
2876 AC_MSG_WARN([Argument not recognized: $withval])
2878 ], [with_python="yes"])
2881 SAVE_CPPFLAGS="$CPPFLAGS"
2882 SAVE_LDFLAGS="$LDFLAGS"
2885 PATH="$with_python_path"
2887 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
2889 AC_MSG_CHECKING([for python])
2890 with_python_prog="`which python 2>/dev/null`"
2891 if test "x$with_python_prog" = "x"
2893 AC_MSG_RESULT([not found])
2894 with_python="no (interpreter not found)"
2896 AC_MSG_RESULT([$with_python_prog])
2900 if test "x$with_python" = "xyes"
2902 AC_MSG_CHECKING([for Python CPPFLAGS])
2903 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
2904 python_config_status=$?
2906 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
2908 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
2911 AC_MSG_RESULT([$python_include_path])
2915 if test "x$with_python" = "xyes"
2917 CPPFLAGS="-I$python_include_path $CPPFLAGS"
2918 AC_CHECK_HEADERS(Python.h,
2919 [with_python="yes"],
2920 [with_python="no ('Python.h' not found)"])
2923 if test "x$with_python" = "xyes"
2925 AC_MSG_CHECKING([for Python LDFLAGS])
2926 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`
2927 python_config_status=$?
2929 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
2931 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
2934 AC_MSG_RESULT([$python_library_path])
2938 if test "x$with_python" = "xyes"
2940 AC_MSG_CHECKING([for Python LIBS])
2941 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`
2942 python_config_status=$?
2944 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
2946 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
2949 AC_MSG_RESULT([$python_library_flags])
2953 if test "x$with_python" = "xyes"
2955 LDFLAGS="-L$python_library_path $LDFLAGS"
2956 LIBS="$python_library_flags $LIBS"
2958 AC_CHECK_FUNC(PyObject_CallFunction,
2959 [with_python="yes"],
2960 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
2964 CPPFLAGS="$SAVE_CPPFLAGS"
2965 LDFLAGS="$SAVE_LDFLAGS"
2968 if test "x$with_python" = "xyes"
2970 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
2971 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
2972 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
2973 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
2974 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
2975 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
2979 # --with-librouteros {{{
2980 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
2982 if test "x$withval" = "xyes"
2984 with_librouteros="yes"
2985 else if test "x$withval" = "xno"
2987 with_librouteros="no"
2989 with_librouteros="yes"
2990 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
2991 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
2994 [with_librouteros="yes"])
2996 SAVE_CPPFLAGS="$CPPFLAGS"
2997 SAVE_LDFLAGS="$LDFLAGS"
2999 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3000 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3002 if test "x$with_librouteros" = "xyes"
3004 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3006 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3008 AC_CHECK_HEADERS(routeros_api.h,
3009 [with_librouteros="yes"],
3010 [with_librouteros="no ('routeros_api.h' not found)"])
3012 if test "x$with_librouteros" = "xyes"
3014 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3016 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3018 AC_CHECK_LIB(routeros, ros_interface,
3019 [with_librouteros="yes"],
3020 [with_librouteros="no (symbol 'ros_interface' not found)"])
3023 CPPFLAGS="$SAVE_CPPFLAGS"
3024 LDFLAGS="$SAVE_LDFLAGS"
3026 if test "x$with_librouteros" = "xyes"
3028 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3029 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3030 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3031 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3033 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3037 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3040 librrd_threadsafe="yes"
3041 librrd_rrdc_update="no"
3042 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3043 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3045 librrd_cflags="-I$withval/include"
3046 librrd_ldflags="-L$withval/lib"
3049 with_librrd="$withval"
3051 ], [with_librrd="yes"])
3052 if test "x$with_librrd" = "xyes"
3054 SAVE_CPPFLAGS="$CPPFLAGS"
3055 SAVE_LDFLAGS="$LDFLAGS"
3057 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3058 LDFLAGS="$LDFLAGS $librrd_ldflags"
3060 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3062 CPPFLAGS="$SAVE_CPPFLAGS"
3063 LDFLAGS="$SAVE_LDFLAGS"
3065 if test "x$with_librrd" = "xyes"
3067 SAVE_CPPFLAGS="$CPPFLAGS"
3068 SAVE_LDFLAGS="$LDFLAGS"
3070 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3071 LDFLAGS="$LDFLAGS $librrd_ldflags"
3073 AC_CHECK_LIB(rrd_th, rrd_update_r,
3075 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3077 [librrd_threadsafe="no"
3078 AC_CHECK_LIB(rrd, rrd_update,
3080 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3082 [with_librrd="no (symbol 'rrd_update' not found)"],
3087 if test "x$librrd_threadsafe" = "xyes"
3089 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3091 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3094 CPPFLAGS="$SAVE_CPPFLAGS"
3095 LDFLAGS="$SAVE_LDFLAGS"
3097 if test "x$with_librrd" = "xyes"
3099 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3100 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3101 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3102 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3104 if test "x$librrd_threadsafe" = "xyes"
3106 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3110 # --with-libsensors {{{
3111 with_sensors_cflags=""
3112 with_sensors_ldflags=""
3113 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3115 if test "x$withval" = "xno"
3117 with_libsensors="no"
3119 with_libsensors="yes"
3120 if test "x$withval" != "xyes"
3122 with_sensors_cflags="-I$withval/include"
3123 with_sensors_ldflags="-L$withval/lib"
3124 with_libsensors="yes"
3129 if test "x$ac_system" = "xLinux"
3131 with_libsensors="yes"
3133 with_libsensors="no (Linux only library)"
3136 if test "x$with_libsensors" = "xyes"
3138 SAVE_CPPFLAGS="$CPPFLAGS"
3139 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3141 # AC_CHECK_HEADERS(sensors/sensors.h,
3143 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3145 # [with_libsensors="no (sensors/sensors.h not found)"])
3146 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3148 CPPFLAGS="$SAVE_CPPFLAGS"
3150 if test "x$with_libsensors" = "xyes"
3152 SAVE_CPPFLAGS="$CPPFLAGS"
3153 SAVE_LDFLAGS="$LDFLAGS"
3154 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3155 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3157 AC_CHECK_LIB(sensors, sensors_init,
3159 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3161 [with_libsensors="no (libsensors not found)"])
3163 CPPFLAGS="$SAVE_CPPFLAGS"
3164 LDFLAGS="$SAVE_LDFLAGS"
3166 if test "x$with_libsensors" = "xyes"
3168 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3169 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3170 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3171 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3173 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3176 # --with-libstatgrab {{{
3177 with_libstatgrab_cflags=""
3178 with_libstatgrab_ldflags=""
3179 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3181 if test "x$withval" != "xno" \
3182 && test "x$withval" != "xyes"
3184 with_libstatgrab_cflags="-I$withval/include"
3185 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3186 with_libstatgrab="yes"
3187 with_libstatgrab_pkg_config="no"
3189 with_libstatgrab="$withval"
3190 with_libstatgrab_pkg_config="yes"
3194 with_libstatgrab="yes"
3195 with_libstatgrab_pkg_config="yes"
3198 if test "x$with_libstatgrab" = "xyes" \
3199 && test "x$with_libstatgrab_pkg_config" = "xyes"
3201 if test "x$PKG_CONFIG" != "x"
3203 AC_MSG_CHECKING([pkg-config for libstatgrab])
3205 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3208 with_libstatgrab_pkg_config="no"
3209 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
3210 temp_result="not found"
3212 AC_MSG_RESULT([$temp_result])
3214 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3215 with_libstatgrab_pkg_config="no"
3216 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3220 if test "x$with_libstatgrab" = "xyes" \
3221 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3222 && test "x$with_libstatgrab_cflags" = "x"
3224 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3225 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3228 with_libstatgrab_cflags="$temp_result"
3230 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3231 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3233 AC_MSG_RESULT([$temp_result])
3236 if test "x$with_libstatgrab" = "xyes" \
3237 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3238 && test "x$with_libstatgrab_ldflags" = "x"
3240 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3241 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3244 with_libstatgrab_ldflags="$temp_result"
3246 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3247 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3249 AC_MSG_RESULT([$temp_result])
3252 if test "x$with_libstatgrab" = "xyes"
3254 SAVE_CPPFLAGS="$CPPFLAGS"
3255 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3257 AC_CHECK_HEADERS(statgrab.h,
3258 [with_libstatgrab="yes"],
3259 [with_libstatgrab="no (statgrab.h not found)"])
3261 CPPFLAGS="$SAVE_CPPFLAGS"
3264 if test "x$with_libstatgrab" = "xyes"
3266 SAVE_CFLAGS="$CFLAGS"
3267 SAVE_LDFLAGS="$LDFLAGS"
3269 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3270 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3272 AC_CHECK_LIB(statgrab, sg_init,
3273 [with_libstatgrab="yes"],
3274 [with_libstatgrab="no (symbol sg_init not found)"])
3276 CFLAGS="$SAVE_CFLAGS"
3277 LDFLAGS="$SAVE_LDFLAGS"
3280 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3281 if test "x$with_libstatgrab" = "xyes"
3283 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3284 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3285 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3286 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3287 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3291 # --with-libtokyotyrant {{{
3292 with_libtokyotyrant_cppflags=""
3293 with_libtokyotyrant_ldflags=""
3294 with_libtokyotyrant_libs=""
3295 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3297 if test "x$withval" = "xno"
3299 with_libtokyotyrant="no"
3300 else if test "x$withval" = "xyes"
3302 with_libtokyotyrant="yes"
3304 with_libtokyotyrant_cppflags="-I$withval/include"
3305 with_libtokyotyrant_ldflags="-L$withval/include"
3306 with_libtokyotyrant_libs="-ltokyotyrant"
3307 with_libtokyotyrant="yes"
3311 with_libtokyotyrant="yes"
3314 if test "x$with_libtokyotyrant" = "xyes"
3316 if $PKG_CONFIG --exists tokyotyrant
3318 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3319 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3320 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3324 SAVE_CPPFLAGS="$CPPFLAGS"
3325 SAVE_LDFLAGS="$LDFLAGS"
3326 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3327 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3329 if test "x$with_libtokyotyrant" = "xyes"
3331 AC_CHECK_HEADERS(tcrdb.h,
3333 AC_DEFINE(HAVE_TCRDB_H, 1,
3334 [Define to 1 if you have the <tcrdb.h> header file.])
3335 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3338 if test "x$with_libtokyotyrant" = "xyes"
3340 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3342 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3343 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3345 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3346 [$with_libtokyotyrant_libs])
3349 CPPFLAGS="$SAVE_CPPFLAGS"
3350 LDFLAGS="$SAVE_LDFLAGS"
3352 if test "x$with_libtokyotyrant" = "xyes"
3354 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3355 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3356 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3357 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3358 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3359 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3361 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3364 # --with-libupsclient {{{
3365 with_libupsclient_config=""
3366 with_libupsclient_cflags=""
3367 with_libupsclient_libs=""
3368 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
3370 if test "x$withval" = "xno"
3372 with_libupsclient="no"
3373 else if test "x$withval" = "xyes"
3375 with_libupsclient="use_pkgconfig"
3377 if test -x "$withval"
3379 with_libupsclient_config="$withval"
3380 with_libupsclient="use_libupsclient_config"
3381 else if test -x "$withval/bin/libupsclient-config"
3383 with_libupsclient_config="$withval/bin/libupsclient-config"
3384 with_libupsclient="use_libupsclient_config"
3386 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3387 with_libupsclient_cflags="-I$withval/include"
3388 with_libupsclient_libs="-L$withval/lib -lupsclient"
3389 with_libupsclient="yes"
3393 [with_libupsclient="use_pkgconfig"])
3395 # configure using libupsclient-config
3396 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3398 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3399 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3402 with_libupsclient="no ($with_libupsclient_config failed)"
3404 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3407 with_libupsclient="no ($with_libupsclient_config failed)"
3410 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3412 with_libupsclient="yes"
3415 # configure using pkg-config
3416 if test "x$with_libupsclient" = "xuse_pkgconfig"
3418 if test "x$PKG_CONFIG" = "x"
3420 with_libupsclient="no (Don't have pkg-config)"
3423 if test "x$with_libupsclient" = "xuse_pkgconfig"
3425 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3426 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3429 with_libupsclient="no (pkg-config doesn't know library)"
3432 if test "x$with_libupsclient" = "xuse_pkgconfig"
3434 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3437 with_libupsclient="no ($PKG_CONFIG failed)"
3439 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3442 with_libupsclient="no ($PKG_CONFIG failed)"
3445 if test "x$with_libupsclient" = "xuse_pkgconfig"
3447 with_libupsclient="yes"
3450 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3451 # the actual checks.
3452 if test "x$with_libupsclient" = "xyes"
3454 SAVE_CPPFLAGS="$CPPFLAGS"
3455 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3457 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3459 CPPFLAGS="$SAVE_CPPFLAGS"
3461 if test "x$with_libupsclient" = "xyes"
3463 SAVE_CPPFLAGS="$CPPFLAGS"
3464 SAVE_LDFLAGS="$LDFLAGS"
3466 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3467 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3469 AC_CHECK_LIB(upsclient, upscli_connect,
3470 [with_libupsclient="yes"],
3471 [with_libupsclient="no (symbol upscli_connect not found)"])
3473 CPPFLAGS="$SAVE_CPPFLAGS"
3474 LDFLAGS="$SAVE_LDFLAGS"
3476 if test "x$with_libupsclient" = "xyes"
3478 SAVE_CPPFLAGS="$CPPFLAGS"
3479 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3481 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3482 [#include <stdlib.h>
3484 #include <upsclient.h>])
3486 CPPFLAGS="$SAVE_CPPFLAGS"
3488 if test "x$with_libupsclient" = "xyes"
3490 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3491 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3492 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3493 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3497 # --with-libxmms {{{
3498 with_xmms_config="xmms-config"
3501 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3503 if test "x$withval" != "xno" \
3504 && test "x$withval" != "xyes"
3506 if test -f "$withval" && test -x "$withval";
3508 with_xmms_config="$withval"
3509 else if test -x "$withval/bin/xmms-config"
3511 with_xmms_config="$withval/bin/xmms-config"
3514 else if test "x$withval" = "xno"
3524 if test "x$with_libxmms" = "xyes"
3526 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3527 xmms_config_status=$?
3529 if test $xmms_config_status -ne 0
3534 if test "x$with_libxmms" = "xyes"
3536 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3537 xmms_config_status=$?
3539 if test $xmms_config_status -ne 0
3544 if test "x$with_libxmms" = "xyes"
3546 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3548 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3549 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3550 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3551 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3558 with_libxmms_numeric=0
3559 if test "x$with_libxmms" = "xyes"
3561 with_libxmms_numeric=1
3563 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3564 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3567 # --with-libyajl {{{
3568 with_libyajl_cppflags=""
3569 with_libyajl_ldflags=""
3570 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3572 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3574 with_libyajl_cppflags="-I$withval/include"
3575 with_libyajl_ldflags="-L$withval/lib"
3578 with_libyajl="$withval"
3584 if test "x$with_libyajl" = "xyes"
3586 SAVE_CPPFLAGS="$CPPFLAGS"
3587 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3589 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3591 CPPFLAGS="$SAVE_CPPFLAGS"
3593 if test "x$with_libyajl" = "xyes"
3595 SAVE_CPPFLAGS="$CPPFLAGS"
3596 SAVE_LDFLAGS="$LDFLAGS"
3597 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3598 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3600 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3602 CPPFLAGS="$SAVE_CPPFLAGS"
3603 LDFLAGS="$SAVE_LDFLAGS"
3605 if test "x$with_libyajl" = "xyes"
3607 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3608 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3609 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3610 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3611 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3612 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3613 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3615 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3618 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3619 with_libxml2="no (pkg-config isn't available)"
3620 with_libxml2_cflags=""
3621 with_libxml2_ldflags=""
3622 with_libvirt="no (pkg-config isn't available)"
3623 with_libvirt_cflags=""
3624 with_libvirt_ldflags=""
3625 if test "x$PKG_CONFIG" != "x"
3627 pkg-config --exists 'libxml-2.0' 2>/dev/null
3632 with_libxml2="no (pkg-config doesn't know library)"
3635 pkg-config --exists libvirt 2>/dev/null
3640 with_libvirt="no (pkg-config doesn't know library)"
3643 if test "x$with_libxml2" = "xyes"
3645 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
3650 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
3656 if test "x$with_libxml2" = "xyes"
3658 SAVE_CPPFLAGS="$CPPFLAGS"
3659 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3661 AC_CHECK_HEADERS(libxml/parser.h, [],
3662 [with_libxml2="no (libxml/parser.h not found)"])
3664 CPPFLAGS="$SAVE_CPPFLAGS"
3666 if test "x$with_libxml2" = "xyes"
3668 SAVE_CFLAGS="$CFLAGS"
3669 SAVE_LDFLAGS="$LDFLAGS"
3671 CFLAGS="$CFLAGS $with_libxml2_cflags"
3672 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3674 AC_CHECK_LIB(xml2, xmlXPathEval,
3675 [with_libxml2="yes"],
3676 [with_libxml2="no (symbol xmlXPathEval not found)"])
3678 CFLAGS="$SAVE_CFLAGS"
3679 LDFLAGS="$SAVE_LDFLAGS"
3681 dnl Add the right compiler flags and libraries.
3682 if test "x$with_libxml2" = "xyes"; then
3683 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3684 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3685 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3686 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3688 if test "x$with_libvirt" = "xyes"
3690 with_libvirt_cflags="`pkg-config --cflags libvirt`"
3695 with_libvirt_ldflags="`pkg-config --libs libvirt`"
3701 if test "x$with_libvirt" = "xyes"
3703 SAVE_CPPFLAGS="$CPPFLAGS"
3704 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3706 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3707 [with_libvirt="no (libvirt/libvirt.h not found)"])
3709 CPPFLAGS="$SAVE_CPPFLAGS"
3711 if test "x$with_libvirt" = "xyes"
3713 SAVE_CFLAGS="$CFLAGS"
3714 SAVE_LDFLAGS="$LDFLAGS"
3716 CFLAGS="$CFLAGS $with_libvirt_cflags"
3717 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3719 AC_CHECK_LIB(virt, virDomainBlockStats,
3720 [with_libvirt="yes"],
3721 [with_libvirt="no (symbol virDomainBlockStats not found)"])
3723 CFLAGS="$SAVE_CFLAGS"
3724 LDFLAGS="$SAVE_LDFLAGS"
3726 dnl Add the right compiler flags and libraries.
3727 if test "x$with_libvirt" = "xyes"; then
3728 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3729 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3730 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3731 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3735 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3736 with_libopenipmipthread="yes"
3737 with_libopenipmipthread_cflags=""
3738 with_libopenipmipthread_libs=""
3740 AC_MSG_CHECKING([for pkg-config])
3742 if test "x$PKG_CONFIG" = "x"
3744 with_libopenipmipthread="no"
3747 temp_result="$PKG_CONFIG"
3749 AC_MSG_RESULT([$temp_result])
3751 if test "x$with_libopenipmipthread" = "xyes"
3753 AC_MSG_CHECKING([for libOpenIPMIpthread])
3754 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3757 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3759 AC_MSG_RESULT([$with_libopenipmipthread])
3762 if test "x$with_libopenipmipthread" = "xyes"
3764 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3765 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3768 with_libopenipmipthread_cflags="$temp_result"
3770 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3771 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3773 AC_MSG_RESULT([$temp_result])
3776 if test "x$with_libopenipmipthread" = "xyes"
3778 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3779 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3782 with_libopenipmipthread_ldflags="$temp_result"
3784 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3785 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3787 AC_MSG_RESULT([$temp_result])
3790 if test "x$with_libopenipmipthread" = "xyes"
3792 SAVE_CPPFLAGS="$CPPFLAGS"
3793 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3795 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3796 [with_libopenipmipthread="yes"],
3797 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3798 [#include <OpenIPMI/ipmiif.h>
3799 #include <OpenIPMI/ipmi_err.h>
3800 #include <OpenIPMI/ipmi_posix.h>
3801 #include <OpenIPMI/ipmi_conn.h>
3804 CPPFLAGS="$SAVE_CPPFLAGS"
3807 if test "x$with_libopenipmipthread" = "xyes"
3809 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3810 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3811 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3812 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3816 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3817 [with_libnotify="yes"],
3818 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3820 # Check for enabled/disabled features
3823 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3824 # ------------------------------------------------------------
3826 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3831 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3836 m4_define([EnDis],[disabled])dnl
3837 m4_define([YesNo],[no])dnl
3843 m4_define([EnDis],[enabled])dnl
3844 m4_define([YesNo],[yes])dnl
3847 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3851 m4_if([$3], [feature], [],
3855 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3861 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3863 enable_$1='[YesNo]'dnl
3865 if test "x$enable_$1" = "xno"
3869 if test "x$enable_$1" = "xyes"
3873 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3878 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3879 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3881 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3883 # AC_PLUGIN(name, default, info)
3884 # ------------------------------------------------------------
3891 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3893 if test "x$enableval" = "xyes"
3896 else if test "x$enableval" = "xforce"
3901 enable_plugin="no (disabled on command line)"
3905 if test "x$enable_all_plugins" = "xauto"
3907 if test "x$2" = "xyes"
3914 enable_plugin="$enable_all_plugins"
3917 if test "x$enable_plugin" = "xyes"
3919 if test "x$2" = "xyes" || test "x$force" = "xyes"
3921 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3922 if test "x$2" != "xyes"
3924 dependency_warning="yes"
3926 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3927 dependency_error="yes"
3928 enable_plugin="no (dependency error)"
3931 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3932 enable_$1="$enable_plugin"
3934 )# AC_PLUGIN(name, default, info)
3936 m4_divert_once([HELP_ENABLE], [
3937 collectd features:])
3938 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3939 AC_COLLECTD([debug], [enable], [feature], [debugging])
3940 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
3941 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
3943 dependency_warning="no"
3944 dependency_error="no"
3949 plugin_conntrack="no"
3950 plugin_contextswitch="no"
3953 plugin_curl_json="no"
3954 plugin_curl_xml="no"
3958 plugin_interface="no"
3965 plugin_multimeter="no"
3969 plugin_processes="no"
3970 plugin_protocols="no"
3974 plugin_tcpconns="no"
3981 plugin_wireless="no"
3985 if test "x$ac_system" = "xLinux"
3987 plugin_battery="yes"
3988 plugin_conntrack="yes"
3989 plugin_contextswitch="yes"
3991 plugin_cpufreq="yes"
3993 plugin_entropy="yes"
3994 plugin_interface="yes"
3999 plugin_fscache="yes"
4000 plugin_processes="yes"
4001 plugin_protocols="yes"
4004 plugin_tcpconns="yes"
4005 plugin_thermal="yes"
4008 plugin_vserver="yes"
4009 plugin_wireless="yes"
4011 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
4017 if test "x$ac_system" = "xOpenBSD"
4019 plugin_tcpconns="yes"
4023 if test "x$with_libiokit" = "xyes"
4025 plugin_battery="yes"
4030 if test "x$with_perfstat" = "xyes"
4036 plugin_interface="yes"
4040 if test "x$with_procinfo" = "xyes"
4042 plugin_processes="yes"
4046 if test "x$with_kstat" = "xyes"
4049 plugin_zfs_arc="yes"
4052 if test "x$with_devinfo$with_kstat" = "xyesyes"
4056 plugin_interface="yes"
4061 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
4067 if test "x$with_libstatgrab" = "xyes"
4071 plugin_interface="yes"
4078 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4084 if test "x$with_libopenipmipthread" = "xyes"
4089 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4091 plugin_curl_json="yes"
4094 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4096 plugin_curl_xml="yes"
4099 if test "x$have_processor_info" = "xyes"
4103 if test "x$have_sysctl" = "xyes"
4110 if test "x$have_sysctlbyname" = "xyes"
4114 plugin_tcpconns="yes"
4117 # Df plugin: Check if we know how to determine mount points first.
4118 #if test "x$have_listmntent" = "xyes"; then
4121 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4125 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4129 #if test "x$have_getmntent" = "xseq"
4133 if test "x$c_cv_have_one_getmntent" = "xyes"
4138 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4139 if test "x$plugin_df" = "xyes"
4142 if test "x$have_statfs" = "xyes"
4146 if test "x$have_statvfs" = "xyes"
4152 if test "x$have_getifaddrs" = "xyes"
4154 plugin_interface="yes"
4157 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4159 plugin_libvirt="yes"
4162 if test "x$have_getloadavg" = "xyes"
4167 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4172 # Mac OS X memory interface
4173 if test "x$have_host_statistics" = "xyes"
4178 if test "x$have_termios_h" = "xyes"
4180 plugin_multimeter="yes"
4184 if test "x$have_thread_info" = "xyes"
4186 plugin_processes="yes"
4189 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4191 plugin_processes="yes"
4194 if test "x$with_kvm_getswapinfo" = "xyes"
4199 if test "x$have_swapctl" = "xyes"
4204 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4206 plugin_tcpconns="yes"
4209 if test "x$have_getutent" = "xyes"
4213 if test "x$have_getutxent" = "xyes"
4218 m4_divert_once([HELP_ENABLE], [
4221 AC_ARG_ENABLE([all-plugins],
4222 AC_HELP_STRING([--enable-all-plugins],
4223 [enable all plugins (auto by def)]),
4225 if test "x$enableval" = "xyes"
4227 enable_all_plugins="yes"
4228 else if test "x$enableval" = "xauto"
4230 enable_all_plugins="auto"
4232 enable_all_plugins="no"
4235 [enable_all_plugins="auto"])
4237 m4_divert_once([HELP_ENABLE], [])
4239 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4240 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4241 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4242 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4243 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4244 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4245 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4246 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4247 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4248 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4249 AC_PLUGIN([csv], [yes], [CSV output plugin])
4250 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4251 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4252 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4253 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4254 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4255 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4256 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4257 AC_PLUGIN([email], [yes], [EMail statistics])
4258 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4259 AC_PLUGIN([exec], [yes], [Execution of external programs])
4260 AC_PLUGIN([filecount], [yes], [Count files in directories])
4261 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4262 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4263 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4264 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4265 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4266 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4267 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4268 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4269 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4270 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4271 AC_PLUGIN([load], [$plugin_load], [System load])
4272 AC_PLUGIN([logfile], [yes], [File logging plugin])
4273 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4274 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4275 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4276 AC_PLUGIN([match_regex], [yes], [The regex match])
4277 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4278 AC_PLUGIN([match_value], [yes], [The value match])
4279 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4280 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4281 AC_PLUGIN([memcached], [yes], [memcached statistics])
4282 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4283 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4284 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4285 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4286 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4287 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4288 AC_PLUGIN([network], [yes], [Network communication plugin])
4289 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4290 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4291 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4292 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4293 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4294 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4295 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4296 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4297 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4298 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4299 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4300 # FIXME: Check for libevent, too.
4301 AC_PLUGIN([pinba], [$HAVE_PROTOC_C], [Pinba statistics])
4302 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4303 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4304 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4305 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4306 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4307 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4308 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4309 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4310 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4311 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4312 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4313 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4314 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4315 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4316 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4317 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4318 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4319 AC_PLUGIN([target_notification], [yes], [The notification target])
4320 AC_PLUGIN([target_replace], [yes], [The replace target])
4321 AC_PLUGIN([target_scale],[yes], [The scale target])
4322 AC_PLUGIN([target_set], [yes], [The set target])
4323 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4324 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4325 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4326 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4327 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4328 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4329 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4330 AC_PLUGIN([users], [$plugin_users], [User statistics])
4331 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4332 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4333 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4334 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4335 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4336 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4337 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4339 dnl Default configuration file
4340 # Load either syslog or logfile
4341 LOAD_PLUGIN_SYSLOG=""
4342 LOAD_PLUGIN_LOGFILE=""
4344 AC_MSG_CHECKING([which default log plugin to load])
4345 default_log_plugin="none"
4346 if test "x$enable_syslog" = "xyes"
4348 default_log_plugin="syslog"
4350 LOAD_PLUGIN_SYSLOG="##"
4353 if test "x$enable_logfile" = "xyes"
4355 if test "x$default_log_plugin" = "xnone"
4357 default_log_plugin="logfile"
4359 LOAD_PLUGIN_LOGFILE="#"
4362 LOAD_PLUGIN_LOGFILE="##"
4364 AC_MSG_RESULT([$default_log_plugin])
4366 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4367 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4369 DEFAULT_LOG_LEVEL="info"
4370 if test "x$enable_debug" = "xyes"
4372 DEFAULT_LOG_LEVEL="debug"
4374 AC_SUBST(DEFAULT_LOG_LEVEL)
4376 # Load only one of rrdtool, network, csv in the default config.
4377 LOAD_PLUGIN_RRDTOOL=""
4378 LOAD_PLUGIN_NETWORK=""
4381 AC_MSG_CHECKING([which default write plugin to load])
4382 default_write_plugin="none"
4383 if test "x$enable_rrdtool" = "xyes"
4385 default_write_plugin="rrdtool"
4387 LOAD_PLUGIN_RRDTOOL="##"
4390 if test "x$enable_network" = "xyes"
4392 if test "x$default_write_plugin" = "xnone"
4394 default_write_plugin="network"
4396 LOAD_PLUGIN_NETWORK="#"
4399 LOAD_PLUGIN_NETWORK="##"
4402 if test "x$enable_csv" = "xyes"
4404 if test "x$default_write_plugin" = "xnone"
4406 default_write_plugin="csv"
4411 LOAD_PLUGIN_CSV="##"
4413 AC_MSG_RESULT([$default_write_plugin])
4415 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4416 AC_SUBST(LOAD_PLUGIN_NETWORK)
4417 AC_SUBST(LOAD_PLUGIN_CSV)
4420 if test "x$ac_system" = "xLinux" \
4421 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
4423 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4427 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4429 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4431 PERL_BINDINGS_OPTIONS="$withval"
4432 with_perl_bindings="yes"
4434 PERL_BINDINGS_OPTIONS=""
4435 with_perl_bindings="$withval"
4439 PERL_BINDINGS_OPTIONS=""
4440 if test -n "$perl_interpreter"
4442 with_perl_bindings="yes"
4444 with_perl_bindings="no (no perl interpreter found)"
4447 if test "x$with_perl_bindings" = "xyes"
4449 PERL_BINDINGS="perl"
4453 AC_SUBST(PERL_BINDINGS)
4454 AC_SUBST(PERL_BINDINGS_OPTIONS)
4456 dnl libcollectdclient
4457 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4458 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4459 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4461 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4463 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4465 AC_SUBST(LCC_VERSION_MAJOR)
4466 AC_SUBST(LCC_VERSION_MINOR)
4467 AC_SUBST(LCC_VERSION_PATCH)
4468 AC_SUBST(LCC_VERSION_EXTRA)
4469 AC_SUBST(LCC_VERSION_STRING)
4471 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4473 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)
4475 if test "x$with_librrd" = "xyes" \
4476 && test "x$librrd_threadsafe" != "xyes"
4478 with_librrd="yes (warning: librrd is not thread-safe)"
4481 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
4483 with_libiptc="yes (shipped version)"
4486 if test "x$with_libperl" = "xyes"
4488 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4490 enable_perl="no (needs libperl)"
4493 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4495 enable_perl="no (libperl doesn't support ithreads)"
4498 if test "x$with_perl_bindings" = "xyes" \
4499 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4501 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4508 libcurl . . . . . . . $with_libcurl
4509 libdbi . . . . . . . $with_libdbi
4510 libesmtp . . . . . . $with_libesmtp
4511 libganglia . . . . . $with_libganglia
4512 libgcrypt . . . . . . $with_libgcrypt
4513 libiokit . . . . . . $with_libiokit
4514 libiptc . . . . . . . $with_libiptc
4515 libjvm . . . . . . . $with_java
4516 libkstat . . . . . . $with_kstat
4517 libkvm . . . . . . . $with_libkvm
4518 libmemcached . . . . $with_libmemcached
4519 libmodbus . . . . . . $with_libmodbus
4520 libmysql . . . . . . $with_libmysql
4521 libnetapp . . . . . . $with_libnetapp
4522 libnetlink . . . . . $with_libnetlink
4523 libnetsnmp . . . . . $with_libnetsnmp
4524 libnotify . . . . . . $with_libnotify
4525 liboconfig . . . . . $with_liboconfig
4526 libopenipmi . . . . . $with_libopenipmipthread
4527 liboping . . . . . . $with_liboping
4528 libpcap . . . . . . . $with_libpcap
4529 libperfstat . . . . . $with_perfstat
4530 libperl . . . . . . . $with_libperl
4531 libpq . . . . . . . . $with_libpq
4532 libpthread . . . . . $with_libpthread
4533 librouteros . . . . . $with_librouteros
4534 librrd . . . . . . . $with_librrd
4535 libsensors . . . . . $with_libsensors
4536 libstatgrab . . . . . $with_libstatgrab
4537 libtokyotyrant . . . $with_libtokyotyrant
4538 libupsclient . . . . $with_libupsclient
4539 libvirt . . . . . . . $with_libvirt
4540 libxml2 . . . . . . . $with_libxml2
4541 libxmms . . . . . . . $with_libxmms
4542 libyajl . . . . . . . $with_libyajl
4543 libevent . . . . . . $with_libevent
4544 protobuf-c . . . . . $HAVE_PROTOC_C
4545 oracle . . . . . . . $with_oracle
4546 python . . . . . . . $with_python
4549 daemon mode . . . . . $enable_daemon
4550 debug . . . . . . . . $enable_debug
4553 perl . . . . . . . . $with_perl_bindings
4556 apache . . . . . . . $enable_apache
4557 apcups . . . . . . . $enable_apcups
4558 apple_sensors . . . . $enable_apple_sensors
4559 ascent . . . . . . . $enable_ascent
4560 battery . . . . . . . $enable_battery
4561 bind . . . . . . . . $enable_bind
4562 conntrack . . . . . . $enable_conntrack
4563 contextswitch . . . . $enable_contextswitch
4564 cpu . . . . . . . . . $enable_cpu
4565 cpufreq . . . . . . . $enable_cpufreq
4566 csv . . . . . . . . . $enable_csv
4567 curl . . . . . . . . $enable_curl
4568 curl_json . . . . . . $enable_curl_json
4569 curl_xml . . . . . . $enable_curl_xml
4570 dbi . . . . . . . . . $enable_dbi
4571 df . . . . . . . . . $enable_df
4572 disk . . . . . . . . $enable_disk
4573 dns . . . . . . . . . $enable_dns
4574 email . . . . . . . . $enable_email
4575 entropy . . . . . . . $enable_entropy
4576 exec . . . . . . . . $enable_exec
4577 filecount . . . . . . $enable_filecount
4578 fscache . . . . . . . $enable_fscache
4579 gmond . . . . . . . . $enable_gmond
4580 hddtemp . . . . . . . $enable_hddtemp
4581 interface . . . . . . $enable_interface
4582 ipmi . . . . . . . . $enable_ipmi
4583 iptables . . . . . . $enable_iptables
4584 ipvs . . . . . . . . $enable_ipvs
4585 irq . . . . . . . . . $enable_irq
4586 java . . . . . . . . $enable_java
4587 libvirt . . . . . . . $enable_libvirt
4588 load . . . . . . . . $enable_load
4589 logfile . . . . . . . $enable_logfile
4590 madwifi . . . . . . . $enable_madwifi
4591 match_empty_counter . $enable_match_empty_counter
4592 match_hashed . . . . $enable_match_hashed
4593 match_regex . . . . . $enable_match_regex
4594 match_timediff . . . $enable_match_timediff
4595 match_value . . . . . $enable_match_value
4596 mbmon . . . . . . . . $enable_mbmon
4597 memcachec . . . . . . $enable_memcachec
4598 memcached . . . . . . $enable_memcached
4599 memory . . . . . . . $enable_memory
4600 modbus . . . . . . . $enable_modbus
4601 multimeter . . . . . $enable_multimeter
4602 mysql . . . . . . . . $enable_mysql
4603 netapp . . . . . . . $enable_netapp
4604 netlink . . . . . . . $enable_netlink
4605 network . . . . . . . $enable_network
4606 nfs . . . . . . . . . $enable_nfs
4607 nginx . . . . . . . . $enable_nginx
4608 notify_desktop . . . $enable_notify_desktop
4609 notify_email . . . . $enable_notify_email
4610 ntpd . . . . . . . . $enable_ntpd
4611 nut . . . . . . . . . $enable_nut
4612 olsrd . . . . . . . . $enable_olsrd
4613 onewire . . . . . . . $enable_onewire
4614 openvpn . . . . . . . $enable_openvpn
4615 oracle . . . . . . . $enable_oracle
4616 perl . . . . . . . . $enable_perl
4617 pinba . . . . . . . . $enable_pinba
4618 ping . . . . . . . . $enable_ping
4619 postgresql . . . . . $enable_postgresql
4620 powerdns . . . . . . $enable_powerdns
4621 processes . . . . . . $enable_processes
4622 protocols . . . . . . $enable_protocols
4623 python . . . . . . . $enable_python
4624 routeros . . . . . . $enable_routeros
4625 rrdcached . . . . . . $enable_rrdcached
4626 rrdtool . . . . . . . $enable_rrdtool
4627 sensors . . . . . . . $enable_sensors
4628 serial . . . . . . . $enable_serial
4629 snmp . . . . . . . . $enable_snmp
4630 swap . . . . . . . . $enable_swap
4631 syslog . . . . . . . $enable_syslog
4632 table . . . . . . . . $enable_table
4633 tail . . . . . . . . $enable_tail
4634 tape . . . . . . . . $enable_tape
4635 target_notification . $enable_target_notification
4636 target_replace . . . $enable_target_replace
4637 target_scale . . . . $enable_target_scale
4638 target_set . . . . . $enable_target_set
4639 tcpconns . . . . . . $enable_tcpconns
4640 teamspeak2 . . . . . $enable_teamspeak2
4641 ted . . . . . . . . . $enable_ted
4642 thermal . . . . . . . $enable_thermal
4643 tokyotyrant . . . . . $enable_tokyotyrant
4644 unixsock . . . . . . $enable_unixsock
4645 uptime . . . . . . . $enable_uptime
4646 users . . . . . . . . $enable_users
4647 uuid . . . . . . . . $enable_uuid
4648 vmem . . . . . . . . $enable_vmem
4649 vserver . . . . . . . $enable_vserver
4650 wireless . . . . . . $enable_wireless
4651 write_http . . . . . $enable_write_http
4652 xmms . . . . . . . . $enable_xmms
4653 zfs_arc . . . . . . . $enable_zfs_arc
4657 if test "x$dependency_error" = "xyes"; then
4658 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4661 if test "x$dependency_warning" = "xyes"; then
4662 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4665 # vim: set fdm=marker :