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])
51 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
53 AC_MSG_CHECKING([for kernel type ($host_os)])
56 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
60 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
70 AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
76 AC_MSG_RESULT([$ac_system])
78 if test "x$ac_system" = "xLinux"
80 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
81 if test -z "$KERNEL_DIR"
83 KERNEL_DIR="/lib/modules/`uname -r`/source"
86 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
87 AC_SUBST(KERNEL_CFLAGS)
90 if test "x$ac_system" = "xSolaris"
92 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
94 if test "x$ac_system" = "xAIX"
96 AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
99 # Where to install .pc files.
100 pkgconfigdir="${libdir}/pkgconfig"
101 AC_SUBST(pkgconfigdir)
103 # Check for standards compliance mode
104 AC_ARG_ENABLE(standards,
105 AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
106 [enable_standards="$enableval"],
107 [enable_standards="no"])
108 if test "x$enable_standards" = "xyes"
110 AC_DEFINE(_ISOC99_SOURCE, 1, [Define to enforce ISO C99 compliance.])
111 AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Define to enforce POSIX.1-2001 compliance.])
112 AC_DEFINE(_XOPEN_SOURCE, 600, [Define to enforce X/Open 6 (XSI) compliance.])
113 AC_DEFINE(_REENTRANT, 1, [Define to enable reentrancy interfaces.])
115 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
118 # Checks for header files.
125 AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h)
128 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
133 # include <sys/types.h>
136 AC_CHECK_HEADERS(netinet/in.h, [], [],
141 # include <sys/types.h>
143 #if HAVE_NETINET_IN_SYSTM_H
144 # include <netinet/in_systm.h>
147 AC_CHECK_HEADERS(netinet/ip.h, [], [],
152 # include <sys/types.h>
154 #if HAVE_NETINET_IN_SYSTM_H
155 # include <netinet/in_systm.h>
157 #if HAVE_NETINET_IN_H
158 # include <netinet/in.h>
161 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
166 # include <sys/types.h>
168 #if HAVE_NETINET_IN_SYSTM_H
169 # include <netinet/in_systm.h>
171 #if HAVE_NETINET_IN_H
172 # include <netinet/in.h>
174 #if HAVE_NETINET_IP_H
175 # include <netinet/ip.h>
178 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
183 # include <sys/types.h>
185 #if HAVE_NETINET_IN_SYSTM_H
186 # include <netinet/in_systm.h>
188 #if HAVE_NETINET_IN_H
189 # include <netinet/in.h>
191 #if HAVE_NETINET_IP_H
192 # include <netinet/ip.h>
195 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
200 # include <sys/types.h>
202 #if HAVE_NETINET_IN_SYSTM_H
203 # include <netinet/in_systm.h>
205 #if HAVE_NETINET_IN_H
206 # include <netinet/in.h>
209 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
214 # include <sys/types.h>
216 #if HAVE_NETINET_IN_SYSTM_H
217 # include <netinet/in_systm.h>
219 #if HAVE_NETINET_IN_H
220 # include <netinet/in.h>
222 #if HAVE_NETINET_IP6_H
223 # include <netinet/ip6.h>
226 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
231 # include <sys/types.h>
233 #if HAVE_NETINET_IN_SYSTM_H
234 # include <netinet/in_systm.h>
236 #if HAVE_NETINET_IN_H
237 # include <netinet/in.h>
239 #if HAVE_NETINET_IP_H
240 # include <netinet/ip.h>
243 AC_CHECK_HEADERS(netinet/udp.h, [], [],
248 # include <sys/types.h>
250 #if HAVE_NETINET_IN_SYSTM_H
251 # include <netinet/in_systm.h>
253 #if HAVE_NETINET_IN_H
254 # include <netinet/in.h>
256 #if HAVE_NETINET_IP_H
257 # include <netinet/ip.h>
262 AC_CHECK_HEADERS(sys/dkstat.h)
263 if test "x$ac_system" = "xDarwin"
265 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)
266 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
268 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
271 # include <sys/types.h>
274 # include <sys/param.h>
278 AC_MSG_CHECKING([for sysctl kern.cp_times])
279 if test -x /sbin/sysctl
281 /sbin/sysctl kern.cp_times 2>/dev/null
285 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
286 [Define if sysctl supports kern.cp_times])
295 AC_CHECK_HEADERS(linux/major.h libgen.h)
297 # For the battery plugin
298 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
300 #if HAVE_IOKIT_IOKITLIB_H
301 # include <IOKit/IOKitLib.h>
303 #if HAVE_IOKIT_IOTYPES_H
304 # include <IOKit/IOTypes.h>
308 # For the swap module
309 have_linux_wireless_h="no"
310 if test "x$ac_system" = "xLinux"
312 AC_CHECK_HEADERS(linux/wireless.h,
313 [have_linux_wireless_h="yes"],
314 [have_linux_wireless_h="no"],
317 #include <sys/ioctl.h>
318 #include <sys/socket.h>
322 # For the swap module
323 have_sys_swap_h="yes"
324 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
326 #undef _FILE_OFFSET_BITS
327 #undef _LARGEFILE64_SOURCE
329 # include <sys/types.h>
332 # include <sys/param.h>
336 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
339 if test "x$GCC" = "xyes"
341 hint_64="CFLAGS='-m64'"
343 hint_64="CFLAGS='-xarch=v9'"
345 AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
349 # For the processes plugin
351 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
353 # For interface plugin
354 AC_CHECK_HEADERS(ifaddrs.h)
355 AC_CHECK_HEADERS(net/if.h, [], [],
358 # include <sys/types.h>
360 #if HAVE_SYS_SOCKET_H
361 # include <sys/socket.h>
364 AC_CHECK_HEADERS(linux/if.h, [], [],
367 # include <sys/types.h>
369 #if HAVE_SYS_SOCKET_H
370 # include <sys/socket.h>
373 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
376 # include <sys/types.h>
378 #if HAVE_SYS_SOCKET_H
379 # include <sys/socket.h>
382 # include <linux/if.h>
387 have_net_ip_vs_h="no"
389 if test "x$ac_system" = "xLinux"
391 SAVE_CFLAGS="$CFLAGS"
392 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
394 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
395 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
397 CFLAGS="$SAVE_CFLAGS"
401 AC_CHECK_HEADERS(sys/ucred.h, [], [],
404 # include <sys/types.h>
407 # include <sys/param.h>
411 # For mount interface
412 AC_CHECK_HEADERS(sys/mount.h, [], [],
415 # include <sys/types.h>
418 # include <sys/param.h>
422 # For the email plugin
423 AC_CHECK_HEADERS(linux/un.h, [], [],
425 #if HAVE_SYS_SOCKET_H
426 # include <sys/socket.h>
430 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)
433 AC_CHECK_HEADERS(arpa/nameser.h)
434 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
436 #if HAVE_ARPA_NAMESER_H
437 # include <arpa/nameser.h>
441 AC_CHECK_HEADERS(net/if_arp.h, [], [],
442 [#if HAVE_SYS_SOCKET_H
443 # include <sys/socket.h>
446 AC_CHECK_HEADERS(net/ppp_defs.h)
447 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
448 [#if HAVE_NET_PPP_DEFS_H
449 # include <net/ppp_defs.h>
452 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
457 # include <sys/types.h>
459 #if HAVE_SYS_SOCKET_H
460 # include <sys/socket.h>
465 #if HAVE_NETINET_IN_H
466 # include <netinet/in.h>
470 # For the multimeter plugin
472 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
475 # Checks for typedefs, structures, and compiler characteristics.
484 # Checks for library functions.
486 AC_PROG_GCC_TRADITIONAL
487 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
491 SAVE_CFLAGS="$CFLAGS"
492 # Emulate behavior of src/Makefile.am
493 if test "x$GCC" = "xyes"
495 CFLAGS="$CFLAGS -Wall -Werror"
498 AC_CACHE_CHECK([for strtok_r],
499 [c_cv_have_strtok_r_default],
508 char buffer[] = "foo,bar,baz";
515 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
518 printf ("token = %s;\n", token);
521 [c_cv_have_strtok_r_default="yes"],
522 [c_cv_have_strtok_r_default="no"]
526 if test "x$c_cv_have_strtok_r_default" = "xno"
528 CFLAGS="$CFLAGS -D_REENTRANT=1"
530 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
531 [c_cv_have_strtok_r_reentrant],
540 char buffer[] = "foo,bar,baz";
547 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
550 printf ("token = %s;\n", token);
553 [c_cv_have_strtok_r_reentrant="yes"],
554 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
559 CFLAGS="$SAVE_CFLAGS"
560 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
562 CFLAGS="$CFLAGS -D_REENTRANT=1"
565 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
567 socket_needs_socket="no"
568 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
569 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
571 nanosleep_needs_rt="no"
572 nanosleep_needs_posix4="no"
573 AC_CHECK_FUNCS(nanosleep,
575 AC_CHECK_LIB(rt, nanosleep,
576 [nanosleep_needs_rt="yes"],
577 AC_CHECK_LIB(posix4, nanosleep,
578 [nanosleep_needs_posix4="yes"],
579 AC_MSG_ERROR(cannot find nanosleep))))
580 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
581 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$nanosleep_needs_posix4" = "xyes")
583 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
584 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
585 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
586 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
587 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
588 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
589 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
590 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
591 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
592 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
593 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
594 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
597 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
600 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
602 if test "x$withval" = "xno"; then
604 else if test "x$withval" = "xyes"; then
611 if test "x$nan_type" = "xnone"; then
612 AC_CACHE_CHECK([whether NAN is defined by default],
613 [c_cv_have_nan_default],
619 static float foo = NAN;
627 [c_cv_have_nan_default="yes"],
628 [c_cv_have_nan_default="no"]
631 if test "x$c_cv_have_nan_default" = "xyes"
636 if test "x$nan_type" = "xnone"; then
637 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
638 [c_cv_have_nan_isoc],
643 #define __USE_ISOC99 1
645 static float foo = NAN;
653 [c_cv_have_nan_isoc="yes"],
654 [c_cv_have_nan_isoc="no"]
657 if test "x$c_cv_have_nan_isoc" = "xyes"
662 if test "x$nan_type" = "xnone"; then
663 SAVE_LDFLAGS=$LDFLAGS
664 LDFLAGS="$LDFLAGS -lm"
665 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
666 [c_cv_have_nan_zero],
675 #define NAN (0.0 / 0.0)
677 # define isnan(f) ((f) != (f))
679 static float foo = NAN;
687 [c_cv_have_nan_zero="yes"],
688 [c_cv_have_nan_zero="no"]
691 LDFLAGS=$SAVE_LDFLAGS
692 if test "x$c_cv_have_nan_zero" = "xyes"
698 if test "x$nan_type" = "xdefault"; then
699 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
700 [Define if NAN is defined by default and can initialize static variables.])
701 else if test "x$nan_type" = "xisoc99"; then
702 AC_DEFINE(NAN_STATIC_ISOC, 1,
703 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
704 else if test "x$nan_type" = "xzero"; then
705 AC_DEFINE(NAN_ZERO_ZERO, 1,
706 [Define if NAN can be defined as (0.0 / 0.0)])
708 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
711 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
713 if test "x$withval" = "xnothing"; then
714 fp_layout_type="nothing"
715 else if test "x$withval" = "xendianflip"; then
716 fp_layout_type="endianflip"
717 else if test "x$withval" = "xintswap"; then
718 fp_layout_type="intswap"
720 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
723 [fp_layout_type="unknown"])
725 if test "x$fp_layout_type" = "xunknown"; then
726 AC_CACHE_CHECK([if doubles are stored in x86 representation],
727 [c_cv_fp_layout_need_nothing],
738 # include <inttypes.h>
741 # include <stdbool.h>
751 memcpy ((void *) &i0, (void *) &d, 8);
754 memcpy ((void *) c, (void *) &i1, 8);
756 if ((c[0] == 0x2f) && (c[1] == 0x25)
757 && (c[2] == 0xc0) && (c[3] == 0xc7)
758 && (c[4] == 0x43) && (c[5] == 0x2b)
759 && (c[6] == 0x1f) && (c[7] == 0x5b))
764 [c_cv_fp_layout_need_nothing="yes"],
765 [c_cv_fp_layout_need_nothing="no"]
768 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
769 fp_layout_type="nothing"
772 if test "x$fp_layout_type" = "xunknown"; then
773 AC_CACHE_CHECK([if endianflip converts to x86 representation],
774 [c_cv_fp_layout_need_endianflip],
785 # include <inttypes.h>
788 # include <stdbool.h>
790 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
791 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
792 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
793 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
794 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
795 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
796 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
797 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
806 memcpy ((void *) &i0, (void *) &d, 8);
808 i1 = endianflip (i0);
809 memcpy ((void *) c, (void *) &i1, 8);
811 if ((c[0] == 0x2f) && (c[1] == 0x25)
812 && (c[2] == 0xc0) && (c[3] == 0xc7)
813 && (c[4] == 0x43) && (c[5] == 0x2b)
814 && (c[6] == 0x1f) && (c[7] == 0x5b))
819 [c_cv_fp_layout_need_endianflip="yes"],
820 [c_cv_fp_layout_need_endianflip="no"]
823 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
824 fp_layout_type="endianflip"
827 if test "x$fp_layout_type" = "xunknown"; then
828 AC_CACHE_CHECK([if intswap converts to x86 representation],
829 [c_cv_fp_layout_need_intswap],
840 # include <inttypes.h>
843 # include <stdbool.h>
845 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
846 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
855 memcpy ((void *) &i0, (void *) &d, 8);
858 memcpy ((void *) c, (void *) &i1, 8);
860 if ((c[0] == 0x2f) && (c[1] == 0x25)
861 && (c[2] == 0xc0) && (c[3] == 0xc7)
862 && (c[4] == 0x43) && (c[5] == 0x2b)
863 && (c[6] == 0x1f) && (c[7] == 0x5b))
868 [c_cv_fp_layout_need_intswap="yes"],
869 [c_cv_fp_layout_need_intswap="no"]
872 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
873 fp_layout_type="intswap"
877 if test "x$fp_layout_type" = "xnothing"; then
878 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
879 [Define if doubles are stored in x86 representation.])
880 else if test "x$fp_layout_type" = "xendianflip"; then
881 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
882 [Define if endianflip is needed to convert to x86 representation.])
883 else if test "x$fp_layout_type" = "xintswap"; then
884 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
885 [Define if intswap is needed to convert to x86 representation.])
887 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
891 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
893 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
895 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
898 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
899 if test "x$have_getmntent" = "xno"; then
900 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
902 if test "x$have_getmntent" = "xno"; then
903 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
905 if test "x$have_getmntent" = "xno"; then
906 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
909 if test "x$have_getmntent" = "xc"; then
910 AC_CACHE_CHECK([whether getmntent takes one argument],
911 [c_cv_have_one_getmntent],
913 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
914 #include "$srcdir/src/utils_mount.h"]],
918 fh = setmntent ("/etc/mtab", "r");
922 [c_cv_have_one_getmntent="yes"],
923 [c_cv_have_one_getmntent="no"]
926 AC_CACHE_CHECK([whether getmntent takes two arguments],
927 [c_cv_have_two_getmntent],
929 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
930 #include "$srcdir/src/utils_mount.h"]],
935 fh = fopen ("/etc/mnttab", "r");
936 status = getmntent (fh, &mt);
939 [c_cv_have_two_getmntent="yes"],
940 [c_cv_have_two_getmntent="no"]
945 # Check for different versions of `getmntent' here..
947 if test "x$have_getmntent" = "xc"; then
948 if test "x$c_cv_have_one_getmntent" = "xyes"; then
949 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
950 [Define if the function getmntent exists and takes one argument.])
952 if test "x$c_cv_have_two_getmntent" = "xyes"; then
953 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
954 [Define if the function getmntent exists and takes two arguments.])
957 if test "x$have_getmntent" = "xsun"; then
958 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
959 [Define if the function getmntent exists. It's the version from libsun.])
961 if test "x$have_getmntent" = "xseq"; then
962 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
963 [Define if the function getmntent exists. It's the version from libseq.])
965 if test "x$have_getmntent" = "xgen"; then
966 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
967 [Define if the function getmntent exists. It's the version from libgen.])
971 AC_MSG_CHECKING([if have htonll defined])
976 #include <sys/types.h>
977 #include <netinet/in.h>
979 # include <inttypes.h>
986 AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
989 AC_MSG_RESULT([$have_htonll])
991 # Check for structures
992 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
993 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
996 #include <sys/types.h>
997 #include <sys/socket.h>
1000 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1001 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1004 #include <sys/types.h>
1005 #include <sys/socket.h>
1006 #include <linux/if.h>
1007 #include <linux/netdevice.h>
1010 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1013 #include <netinet/in.h>
1017 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1019 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1020 [Define if struct kinfo_proc exists in the FreeBSD variant.])
1021 have_struct_kinfo_proc_freebsd="yes"
1024 have_struct_kinfo_proc_freebsd="no"
1028 #include <sys/param.h>
1029 #include <sys/sysctl.h>
1030 #include <sys/user.h>
1033 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1035 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1036 [Define if struct kinfo_proc exists in the OpenBSD variant.])
1037 have_struct_kinfo_proc_openbsd="yes"
1040 have_struct_kinfo_proc_openbsd="no"
1043 #include <sys/param.h>
1044 #include <sys/sysctl.h>
1048 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1049 [#define _BSD_SOURCE
1051 # include <stdint.h>
1053 #if HAVE_SYS_TYPES_H
1054 # include <sys/types.h>
1056 #if HAVE_NETINET_IN_SYSTM_H
1057 # include <netinet/in_systm.h>
1059 #if HAVE_NETINET_IN_H
1060 # include <netinet/in.h>
1062 #if HAVE_NETINET_IP_H
1063 # include <netinet/ip.h>
1065 #if HAVE_NETINET_UDP_H
1066 # include <netinet/udp.h>
1069 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1070 [#define _BSD_SOURCE
1072 # include <stdint.h>
1074 #if HAVE_SYS_TYPES_H
1075 # include <sys/types.h>
1077 #if HAVE_NETINET_IN_SYSTM_H
1078 # include <netinet/in_systm.h>
1080 #if HAVE_NETINET_IN_H
1081 # include <netinet/in.h>
1083 #if HAVE_NETINET_IP_H
1084 # include <netinet/ip.h>
1086 #if HAVE_NETINET_UDP_H
1087 # include <netinet/udp.h>
1091 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1101 # Checks for libraries begin here
1103 with_libresolv="yes"
1104 AC_CHECK_LIB(resolv, res_search,
1106 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1108 [with_libresolv="no"])
1109 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1111 dnl Check for HAL (hardware abstraction library)
1113 AC_CHECK_LIB(hal,libhal_device_property_exists,
1114 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1116 if test "x$with_libhal" = "xyes"; then
1117 if test "x$PKG_CONFIG" != "x"; then
1118 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1119 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1120 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1121 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1125 m4_divert_once([HELP_WITH], [
1126 collectd additional packages:])
1128 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"])
1130 if test "x$ac_system" = "xAIX"
1135 with_perfstat="no (AIX only)"
1136 with_procinfo="no (AIX only)"
1139 if test "x$with_perfstat" = "xyes"
1141 AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1142 # AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1144 if test "x$with_perfstat" = "xyes"
1146 AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1148 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1150 # Processes plugin under AIX.
1151 if test "x$with_procinfo" = "xyes"
1153 AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1155 if test "x$with_procinfo" = "xyes"
1157 AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1160 if test "x$ac_system" = "xSolaris"
1165 with_kstat="no (Solaris only)"
1166 with_devinfo="no (Solaris only)"
1169 if test "x$with_kstat" = "xyes"
1171 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1173 if test "x$with_kstat" = "xyes"
1175 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1176 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1178 if test "x$with_kstat" = "xyes"
1180 AC_DEFINE(HAVE_LIBKSTAT, 1,
1181 [Define to 1 if you have the 'kstat' library (-lkstat)])
1183 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1184 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1187 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1194 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1197 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1198 if test "x$with_kvm_getprocs" = "xyes"
1200 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1201 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1204 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1206 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1207 if test "x$with_kvm_getswapinfo" = "xyes"
1209 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1210 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1213 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1215 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1216 if test "x$with_kvm_nlist" = "xyes"
1218 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1219 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1222 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1224 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1225 if test "x$with_kvm_openfiles" = "xyes"
1227 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1228 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1231 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1233 # --with-libcurl {{{
1234 with_curl_config="curl-config"
1237 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1239 if test "x$withval" = "xno"
1242 else if test "x$withval" = "xyes"
1246 if test -f "$withval" && test -x "$withval"
1248 with_curl_config="$withval"
1250 else if test -x "$withval/bin/curl-config"
1252 with_curl_config="$withval/bin/curl-config"
1261 if test "x$with_libcurl" = "xyes"
1263 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1264 curl_config_status=$?
1266 if test $curl_config_status -ne 0
1268 with_libcurl="no ($with_curl_config failed)"
1270 SAVE_CPPFLAGS="$CPPFLAGS"
1271 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1273 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1275 CPPFLAGS="$SAVE_CPPFLAGS"
1278 if test "x$with_libcurl" = "xyes"
1280 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1281 curl_config_status=$?
1283 if test $curl_config_status -ne 0
1285 with_libcurl="no ($with_curl_config failed)"
1287 AC_CHECK_LIB(curl, curl_easy_init,
1288 [with_libcurl="yes"],
1289 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1293 if test "x$with_libcurl" = "xyes"
1295 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1296 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1297 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1298 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1300 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1304 with_libdbi_cppflags=""
1305 with_libdbi_ldflags=""
1306 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1308 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1310 with_libdbi_cppflags="-I$withval/include"
1311 with_libdbi_ldflags="-L$withval/lib"
1314 with_libdbi="$withval"
1320 if test "x$with_libdbi" = "xyes"
1322 SAVE_CPPFLAGS="$CPPFLAGS"
1323 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1325 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1327 CPPFLAGS="$SAVE_CPPFLAGS"
1329 if test "x$with_libdbi" = "xyes"
1331 SAVE_CPPFLAGS="$CPPFLAGS"
1332 SAVE_LDFLAGS="$LDFLAGS"
1333 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1334 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1336 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1338 CPPFLAGS="$SAVE_CPPFLAGS"
1339 LDFLAGS="$SAVE_LDFLAGS"
1341 if test "x$with_libdbi" = "xyes"
1343 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1344 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1345 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1346 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1347 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1348 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1350 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1353 # --with-libesmtp {{{
1354 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1356 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1358 LDFLAGS="$LDFLAGS -L$withval/lib"
1359 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1362 with_libesmtp="$withval"
1368 if test "x$with_libesmtp" = "xyes"
1370 AC_CHECK_LIB(esmtp, smtp_create_session,
1372 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1373 ], [with_libesmtp="no (libesmtp not found)"])
1375 if test "x$with_libesmtp" = "xyes"
1377 AC_CHECK_HEADERS(libesmtp.h,
1379 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1380 ], [with_libesmtp="no (libesmtp.h not found)"])
1382 if test "x$with_libesmtp" = "xyes"
1388 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1389 [Wether or not to use the esmtp library])
1390 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1393 # --with-libganglia {{{
1394 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1396 if test -f "$withval" && test -x "$withval"
1398 with_libganglia_config="$withval"
1399 with_libganglia="yes"
1400 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1402 with_libganglia_config="$withval/bin/ganglia-config"
1403 with_libganglia="yes"
1404 else if test -d "$withval"
1406 GANGLIA_CPPFLAGS="-I$withval/include"
1407 GANGLIA_LDFLAGS="-L$withval/lib"
1408 with_libganglia="yes"
1410 with_libganglia_config="ganglia-config"
1411 with_libganglia="$withval"
1415 with_libganglia_config="ganglia-config"
1416 with_libganglia="yes"
1419 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1421 if test "x$GANGLIA_CPPFLAGS" = "x"
1423 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1426 if test "x$GANGLIA_LDFLAGS" = "x"
1428 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1431 if test "x$GANGLIA_LIBS" = "x"
1433 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1437 SAVE_CPPFLAGS="$CPPFLAGS"
1438 SAVE_LDFLAGS="$LDFLAGS"
1439 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1440 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1442 if test "x$with_libganglia" = "xyes"
1444 AC_CHECK_HEADERS(gm_protocol.h,
1446 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1447 [Define to 1 if you have the <gm_protocol.h> header file.])
1448 ], [with_libganglia="no (gm_protocol.h not found)"])
1451 if test "x$with_libganglia" = "xyes"
1453 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1455 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1456 [Define to 1 if you have the ganglia library (-lganglia).])
1457 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1460 CPPFLAGS="$SAVE_CPPFLAGS"
1461 LDFLAGS="$SAVE_LDFLAGS"
1463 AC_SUBST(GANGLIA_CPPFLAGS)
1464 AC_SUBST(GANGLIA_LDFLAGS)
1465 AC_SUBST(GANGLIA_LIBS)
1466 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1469 # --with-libgcrypt {{{
1470 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1471 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1472 GCRYPT_LIBS="$GCRYPT_LIBS"
1473 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1475 if test -f "$withval" && test -x "$withval"
1477 with_libgcrypt_config="$withval"
1478 with_libgcrypt="yes"
1479 else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1481 with_libgcrypt_config="$withval/bin/gcrypt-config"
1482 with_libgcrypt="yes"
1483 else if test -d "$withval"
1485 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1486 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1487 with_libgcrypt="yes"
1489 with_libgcrypt_config="gcrypt-config"
1490 with_libgcrypt="$withval"
1494 with_libgcrypt_config="libgcrypt-config"
1495 with_libgcrypt="yes"
1498 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1500 if test "x$GCRYPT_CPPFLAGS" = "x"
1502 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1505 if test "x$GCRYPT_LDFLAGS" = "x"
1507 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1508 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1511 if test "x$GCRYPT_LIBS" = "x"
1513 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1517 SAVE_CPPFLAGS="$CPPFLAGS"
1518 SAVE_LDFLAGS="$LDFLAGS"
1519 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1520 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1522 if test "x$with_libgcrypt" = "xyes"
1524 if test "x$GCRYPT_CPPFLAGS" != "x"
1526 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1528 AC_CHECK_HEADERS(gcrypt.h,
1529 [with_libgcrypt="yes"],
1530 [with_libgcrypt="no (gcrypt.h not found)"])
1533 if test "x$with_libgcrypt" = "xyes"
1535 if test "x$GCRYPT_LDFLAGS" != "x"
1537 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1539 AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1540 [with_libgcrypt="yes"],
1541 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1543 if test "$with_libgcrypt" != "no"; then
1544 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1548 CPPFLAGS="$SAVE_CPPFLAGS"
1549 LDFLAGS="$SAVE_LDFLAGS"
1551 if test "x$with_libgcrypt" = "xyes"
1553 AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1556 AC_SUBST(GCRYPT_CPPFLAGS)
1557 AC_SUBST(GCRYPT_LDFLAGS)
1558 AC_SUBST(GCRYPT_LIBS)
1559 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1562 # --with-libiptc {{{
1563 with_own_libiptc="no"
1564 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1566 if test "x$withval" = "xshipped"
1568 with_own_libiptc="yes"
1570 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1572 LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS -I$withval/include"
1573 LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS -L$withval/lib"
1576 with_libiptc="$withval"
1580 if test "x$ac_system" = "xLinux"
1584 with_libiptc="no (Linux only)"
1587 SAVE_CPPFLAGS="$CPPFLAGS"
1588 SAVE_LDFLAGS="$LDFLAGS"
1589 CPPFLAGS="$CPPFLAGS $LIBIPTC_CPPFLAGS"
1590 LDFLAGS="$LDFLAGS $LIBIPTC_LDFLAGS"
1591 # check whether the header file for libiptc is available.
1592 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1594 AC_CHECK_HEADERS(libiptc/libiptc.h,
1596 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1600 with_own_libiptc="yes"
1603 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1605 AC_CHECK_HEADERS(libiptc/libip6tc.h,
1607 AC_DEFINE(HAVE_LIBIPTC_LIBIP6TC_H, 1, [Define to 1 if you have the <libiptc/libip6tc.h> header file.])
1611 with_own_libiptc="yes"
1614 # If the header file is available, check for the required type declaractions.
1615 # They may be missing in old versions of libiptc. In that case, they will be
1616 # declared in the iptables plugin.
1617 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1619 AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [],
1622 # include "$srcdir/src/owniptc/libiptc.h"
1623 # include "$srcdir/src/owniptc/libip6tc.h"
1625 # include <libiptc/libiptc.h>
1626 # include <libiptc/libip6tc.h>
1630 # Check for the iptc_init symbol in the library.
1631 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xno"
1633 AC_CHECK_LIB(iptc, iptc_init,
1635 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1639 with_own_libiptc="yes"
1642 # The system wide version failed for some reason. Check if we have the required
1643 # headers to build the shipped version.
1644 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xyes"
1646 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
1648 with_libiptc="no (Linux iptables headers not found)"
1649 with_own_libiptc="no"
1652 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
1655 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1656 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1657 if test "x$with_libiptc" = "xyes"
1659 BUILD_WITH_LIBIPTC_CPPFLAGS="$LIBIPTC_CPPFLAGS"
1660 BUILD_WITH_LIBIPTC_LDFLAGS="$LIBIPTC_LDFLAGS"
1661 AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
1662 AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
1664 if test "x$with_own_libiptc" = "xyes"
1666 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1668 CPPFLAGS="$SAVE_CPPFLAGS"
1669 LDFLAGS="$SAVE_LDFLAGS"
1673 with_java_home="$JAVA_HOME"
1674 with_java_vmtype="client"
1679 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1681 if test "x$withval" = "xno"
1684 else if test "x$withval" = "xyes"
1688 with_java_home="$withval"
1693 if test "x$with_java" = "xyes"
1695 if test -d "$with_java_home"
1697 AC_MSG_CHECKING([for jni.h])
1698 TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1699 if test "x$TMPDIR" != "x"
1701 AC_MSG_RESULT([found in $TMPDIR])
1702 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1704 AC_MSG_RESULT([not found])
1707 AC_MSG_CHECKING([for jni_md.h])
1708 TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1709 if test "x$TMPDIR" != "x"
1711 AC_MSG_RESULT([found in $TMPDIR])
1712 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1714 AC_MSG_RESULT([not found])
1717 AC_MSG_CHECKING([for libjvm.so])
1718 TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1719 if test "x$TMPDIR" != "x"
1721 AC_MSG_RESULT([found in $TMPDIR])
1722 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1724 AC_MSG_RESULT([not found])
1727 if test "x$JAVAC" = "x"
1729 AC_MSG_CHECKING([for javac])
1730 TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
1731 if test "x$TMPDIR" != "x"
1734 AC_MSG_RESULT([$JAVAC])
1736 AC_MSG_RESULT([not found])
1739 if test "x$JAR" = "x"
1741 AC_MSG_CHECKING([for jar])
1742 TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
1743 if test "x$TMPDIR" != "x"
1746 AC_MSG_RESULT([$JAR])
1748 AC_MSG_RESULT([not found])
1751 else if test "x$with_java_home" != "x"
1753 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1757 if test "x$JAVA_CPPFLAGS" != "x"
1759 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1761 if test "x$JAVA_CFLAGS" != "x"
1763 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1765 if test "x$JAVA_LDFLAGS" != "x"
1767 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1769 if test "x$JAVAC" = "x"
1771 with_javac_path="$PATH"
1772 if test "x$with_java_home" != "x"
1774 with_javac_path="$with_java_home:with_javac_path"
1775 if test -d "$with_java_home/bin"
1777 with_javac_path="$with_java_home/bin:with_javac_path"
1781 AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1783 if test "x$JAVAC" = "x"
1785 with_java="no (javac not found)"
1787 if test "x$JAR" = "x"
1789 with_jar_path="$PATH"
1790 if test "x$with_java_home" != "x"
1792 with_jar_path="$with_java_home:$with_jar_path"
1793 if test -d "$with_java_home/bin"
1795 with_jar_path="$with_java_home/bin:$with_jar_path"
1799 AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
1801 if test "x$JAR" = "x"
1803 with_java="no (jar not found)"
1806 SAVE_CPPFLAGS="$CPPFLAGS"
1807 SAVE_CFLAGS="$CFLAGS"
1808 SAVE_LDFLAGS="$LDFLAGS"
1809 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1810 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1811 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1813 if test "x$with_java" = "xyes"
1815 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1817 if test "x$with_java" = "xyes"
1819 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1821 [with_java="no (libjvm not found)"],
1824 if test "x$with_java" = "xyes"
1826 JAVA_LIBS="$JAVA_LIBS -ljvm"
1827 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1830 CPPFLAGS="$SAVE_CPPFLAGS"
1831 CFLAGS="$SAVE_CFLAGS"
1832 LDFLAGS="$SAVE_LDFLAGS"
1834 AC_SUBST(JAVA_CPPFLAGS)
1835 AC_SUBST(JAVA_CFLAGS)
1836 AC_SUBST(JAVA_LDFLAGS)
1838 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1841 # --with-libmemcached {{{
1842 with_libmemcached_cppflags=""
1843 with_libmemcached_ldflags=""
1844 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1846 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1848 with_libmemcached_cppflags="-I$withval/include"
1849 with_libmemcached_ldflags="-L$withval/lib"
1850 with_libmemcached="yes"
1852 with_libmemcached="$withval"
1856 with_libmemcached="yes"
1858 if test "x$with_libmemcached" = "xyes"
1860 SAVE_CPPFLAGS="$CPPFLAGS"
1861 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1863 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1865 CPPFLAGS="$SAVE_CPPFLAGS"
1867 if test "x$with_libmemcached" = "xyes"
1869 SAVE_CPPFLAGS="$CPPFLAGS"
1870 SAVE_LDFLAGS="$LDFLAGS"
1871 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1872 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1874 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1876 CPPFLAGS="$SAVE_CPPFLAGS"
1877 LDFLAGS="$SAVE_LDFLAGS"
1879 if test "x$with_libmemcached" = "xyes"
1881 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1882 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1883 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1884 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1885 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1886 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1887 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1889 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1892 # --with-libmodbus {{{
1893 with_libmodbus_config=""
1894 with_libmodbus_cflags=""
1895 with_libmodbus_libs=""
1896 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
1898 if test "x$withval" = "xno"
1901 else if test "x$withval" = "xyes"
1903 with_libmodbus="use_pkgconfig"
1904 else if test -d "$with_libmodbus/lib"
1906 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
1907 with_libmodbus_cflags="-I$withval/include"
1908 with_libmodbus_libs="-L$withval/lib -lmodbus"
1909 with_libmodbus="yes"
1912 [with_libmodbus="use_pkgconfig"])
1914 # configure using pkg-config
1915 if test "x$with_libmodbus" = "xuse_pkgconfig"
1917 if test "x$PKG_CONFIG" = "x"
1919 with_libmodbus="no (Don't have pkg-config)"
1922 if test "x$with_libmodbus" = "xuse_pkgconfig"
1924 AC_MSG_NOTICE([Checking for modbus using $PKG_CONFIG])
1925 $PKG_CONFIG --exists 'modbus' 2>/dev/null
1928 with_libmodbus="no (pkg-config doesn't know library)"
1931 if test "x$with_libmodbus" = "xuse_pkgconfig"
1933 with_libmodbus_cflags="`$PKG_CONFIG --cflags 'modbus'`"
1936 with_libmodbus="no ($PKG_CONFIG failed)"
1938 with_libmodbus_libs="`$PKG_CONFIG --libs 'modbus'`"
1941 with_libmodbus="no ($PKG_CONFIG failed)"
1944 if test "x$with_libmodbus" = "xuse_pkgconfig"
1946 with_libmodbus="yes"
1949 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
1950 # the actual checks.
1951 if test "x$with_libmodbus" = "xyes"
1953 SAVE_CPPFLAGS="$CPPFLAGS"
1954 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1956 AC_CHECK_HEADERS(modbus/modbus.h, [], [with_libmodbus="no (modbus/modbus.h not found)"])
1958 CPPFLAGS="$SAVE_CPPFLAGS"
1960 if test "x$with_libmodbus" = "xyes"
1962 SAVE_CPPFLAGS="$CPPFLAGS"
1963 SAVE_LDFLAGS="$LDFLAGS"
1965 CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
1966 LDFLAGS="$LDFLAGS $with_libmodbus_libs"
1968 AC_CHECK_LIB(modbus, modbus_init_tcp,
1969 [with_libmodbus="yes"],
1970 [with_libmodbus="no (symbol modbus_init_tcp not found)"])
1972 CPPFLAGS="$SAVE_CPPFLAGS"
1973 LDFLAGS="$SAVE_LDFLAGS"
1975 if test "x$with_libmodbus" = "xyes"
1977 BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
1978 BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
1979 AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
1980 AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
1984 # --with-libmysql {{{
1985 with_mysql_config="mysql_config"
1986 with_mysql_cflags=""
1988 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1990 if test "x$withval" = "xno"
1993 else if test "x$withval" = "xyes"
1997 if test -f "$withval" && test -x "$withval";
1999 with_mysql_config="$withval"
2000 else if test -x "$withval/bin/mysql_config"
2002 with_mysql_config="$withval/bin/mysql_config"
2010 if test "x$with_libmysql" = "xyes"
2012 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
2013 mysql_config_status=$?
2015 if test $mysql_config_status -ne 0
2017 with_libmysql="no ($with_mysql_config failed)"
2019 SAVE_CPPFLAGS="$CPPFLAGS"
2020 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2023 have_mysql_mysql_h="no"
2024 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2026 if test "x$have_mysql_h" = "xno"
2028 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2031 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2033 with_libmysql="no (mysql.h not found)"
2036 CPPFLAGS="$SAVE_CPPFLAGS"
2039 if test "x$with_libmysql" = "xyes"
2041 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
2042 mysql_config_status=$?
2044 if test $mysql_config_status -ne 0
2046 with_libmysql="no ($with_mysql_config failed)"
2048 AC_CHECK_LIB(mysqlclient, mysql_init,
2049 [with_libmysql="yes"],
2050 [with_libmysql="no (symbol 'mysql_init' not found)"],
2053 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
2054 [with_libmysql="yes"],
2055 [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2059 if test "x$with_libmysql" = "xyes"
2061 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2062 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2063 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2064 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2066 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2069 # --with-libnetlink {{{
2070 with_libnetlink_cflags=""
2071 with_libnetlink_libs="-lnetlink"
2072 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
2074 echo "libnetlink: withval = $withval"
2075 if test "x$withval" = "xyes"
2077 with_libnetlink="yes"
2078 else if test "x$withval" = "xno"
2080 with_libnetlink="no"
2082 if test -d "$withval/include"
2084 with_libnetlink_cflags="-I$withval/include"
2085 with_libnetlink_libs="-L$withval/lib -lnetlink"
2086 with_libnetlink="yes"
2088 AC_MSG_ERROR("no such directory: $withval/include")
2093 if test "x$ac_system" = "xLinux"
2095 with_libnetlink="yes"
2097 with_libnetlink="no (Linux only library)"
2100 if test "x$with_libnetlink" = "xyes"
2102 SAVE_CFLAGS="$CFLAGS"
2103 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2105 with_libnetlink="no (libnetlink.h not found)"
2107 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2109 with_libnetlink="yes"
2113 #include <sys/types.h>
2114 #include <asm/types.h>
2115 #include <sys/socket.h>
2116 #include <linux/netlink.h>
2117 #include <linux/rtnetlink.h>])
2118 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2120 #include <sys/types.h>
2121 #include <asm/types.h>
2122 #include <sys/socket.h>])
2126 #include <sys/types.h>
2127 #include <asm/types.h>
2128 #include <sys/socket.h>
2129 #include <linux/netlink.h>
2130 #include <linux/rtnetlink.h>
2134 int retval = TCA_STATS2;
2137 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2142 #include <sys/types.h>
2143 #include <asm/types.h>
2144 #include <sys/socket.h>
2145 #include <linux/netlink.h>
2146 #include <linux/rtnetlink.h>
2150 int retval = TCA_STATS;
2153 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2156 CFLAGS="$SAVE_CFLAGS"
2158 if test "x$with_libnetlink" = "xyes"
2160 AC_CHECK_LIB(netlink, rtnl_open,
2161 [with_libnetlink="yes"],
2162 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2163 [$with_libnetlink_libs])
2165 if test "x$with_libnetlink" = "xyes"
2167 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2168 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2169 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2170 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2172 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2175 # --with-libnetapp {{{
2176 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2177 AC_ARG_VAR([LIBNETAPP_LDFLAGS], [Linker flags required to build with libnetapp])
2178 AC_ARG_VAR([LIBNETAPP_LIBS], [Other libraries required to link against libnetapp])
2179 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2180 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2181 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2182 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2184 if test -d "$withval"
2186 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2187 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2188 with_libnetapp="yes"
2190 with_libnetapp="$withval"
2194 with_libnetapp="yes"
2197 SAVE_CPPFLAGS="$CPPFLAGS"
2198 SAVE_LDFLAGS="$LDFLAGS"
2199 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2200 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2202 if test "x$with_libnetapp" = "xyes"
2204 if test "x$LIBNETAPP_CPPFLAGS" != "x"
2206 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2208 AC_CHECK_HEADERS(netapp_api.h,
2209 [with_libnetapp="yes"],
2210 [with_libnetapp="no (netapp_api.h not found)"])
2213 if test "x$with_libnetapp" = "xyes"
2215 if test "x$LIBNETAPP_LDFLAGS" != "x"
2217 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2220 if test "x$LIBNETAPP_LIBS" = "x"
2222 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2224 AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2226 AC_CHECK_LIB(netapp, na_server_invoke_elem,
2227 [with_libnetapp="yes"],
2228 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2230 LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2233 CPPFLAGS="$SAVE_CPPFLAGS"
2234 LDFLAGS="$SAVE_LDFLAGS"
2236 if test "x$with_libnetapp" = "xyes"
2238 AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2241 AC_SUBST(LIBNETAPP_CPPFLAGS)
2242 AC_SUBST(LIBNETAPP_LDFLAGS)
2243 AC_SUBST(LIBNETAPP_LIBS)
2244 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2247 # --with-libnetsnmp {{{
2248 with_snmp_config="net-snmp-config"
2251 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2253 if test "x$withval" = "xno"
2255 with_libnetsnmp="no"
2256 else if test "x$withval" = "xyes"
2258 with_libnetsnmp="yes"
2260 if test -x "$withval"
2262 with_snmp_config="$withval"
2263 with_libnetsnmp="yes"
2265 with_snmp_config="$withval/bin/net-snmp-config"
2266 with_libnetsnmp="yes"
2270 [with_libnetsnmp="yes"])
2271 if test "x$with_libnetsnmp" = "xyes"
2273 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2274 snmp_config_status=$?
2276 if test $snmp_config_status -ne 0
2278 with_libnetsnmp="no ($with_snmp_config failed)"
2280 SAVE_CPPFLAGS="$CPPFLAGS"
2281 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2283 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2285 CPPFLAGS="$SAVE_CPPFLAGS"
2288 if test "x$with_libnetsnmp" = "xyes"
2290 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2291 snmp_config_status=$?
2293 if test $snmp_config_status -ne 0
2295 with_libnetsnmp="no ($with_snmp_config failed)"
2297 AC_CHECK_LIB(netsnmp, init_snmp,
2298 [with_libnetsnmp="yes"],
2299 [with_libnetsnmp="no (libnetsnmp not found)"],
2303 if test "x$with_libnetsnmp" = "xyes"
2305 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2306 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2307 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2308 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2310 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2313 # --with-liboconfig {{{
2314 with_own_liboconfig="no"
2315 liboconfig_LDFLAGS="$LDFLAGS"
2316 liboconfig_CPPFLAGS="$CPPFLAGS"
2317 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2319 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2321 if test -d "$withval/lib"
2323 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2325 if test -d "$withval/include"
2327 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2330 if test "x$withval" = "xno"
2332 AC_MSG_ERROR("liboconfig is required")
2336 with_liboconfig="yes"
2339 save_LDFLAGS="$LDFLAGS"
2340 save_CPPFLAGS="$CPPFLAGS"
2341 LDFLAGS="$liboconfig_LDFLAGS"
2342 CPPFLAGS="$liboconfig_CPPFLAGS"
2343 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2345 with_liboconfig="yes"
2346 with_own_liboconfig="no"
2349 with_liboconfig="yes"
2350 with_own_liboconfig="yes"
2351 LDFLAGS="$save_LDFLAGS"
2352 CPPFLAGS="$save_CPPFLAGS"
2355 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2356 if test "x$with_own_liboconfig" = "xyes"
2358 with_liboconfig="yes (shipped version)"
2362 # --with-liboping {{{
2363 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2365 if test "x$withval" = "xyes"
2368 else if test "x$withval" = "xno"
2373 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2374 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2377 [with_liboping="yes"])
2379 SAVE_CPPFLAGS="$CPPFLAGS"
2380 SAVE_LDFLAGS="$LDFLAGS"
2382 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2383 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2385 if test "x$with_liboping" = "xyes"
2387 if test "x$LIBOPING_CPPFLAGS" != "x"
2389 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2391 AC_CHECK_HEADERS(oping.h,
2392 [with_liboping="yes"],
2393 [with_liboping="no ('oping.h' not found)"])
2395 if test "x$with_liboping" = "xyes"
2397 if test "x$LIBOPING_LDFLAGS" != "x"
2399 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2401 AC_CHECK_LIB(oping, ping_construct,
2402 [with_liboping="yes"],
2403 [with_liboping="no (symbol 'ping_construct' not found)"])
2406 CPPFLAGS="$SAVE_CPPFLAGS"
2407 LDFLAGS="$SAVE_LDFLAGS"
2409 if test "x$with_liboping" = "xyes"
2411 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2412 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2413 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2414 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2416 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2420 with_oracle_cppflags=""
2422 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2424 if test "x$withval" = "xyes"
2426 if test "x$ORACLE_HOME" = "x"
2428 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2431 else if test "x$withval" = "xno"
2436 ORACLE_HOME="$withval"
2440 if test "x$ORACLE_HOME" = "x"
2442 with_oracle="no (ORACLE_HOME is not set)"
2447 if test "x$ORACLE_HOME" != "x"
2449 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2451 if test -e "$ORACLE_HOME/lib/ldflags"
2453 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2455 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2456 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2458 if test "x$with_oracle" = "xyes"
2460 SAVE_CPPFLAGS="$CPPFLAGS"
2461 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2463 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2465 CPPFLAGS="$SAVE_CPPFLAGS"
2467 if test "x$with_oracle" = "xyes"
2469 SAVE_CPPFLAGS="$CPPFLAGS"
2470 SAVE_LDFLAGS="$LDFLAGS"
2471 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2472 LDFLAGS="$LDFLAGS $with_oracle_libs"
2474 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2476 CPPFLAGS="$SAVE_CPPFLAGS"
2477 LDFLAGS="$SAVE_LDFLAGS"
2479 if test "x$with_oracle" = "xyes"
2481 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2482 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2483 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2484 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2488 # --with-libowcapi {{{
2489 with_libowcapi_cppflags=""
2490 with_libowcapi_libs="-lowcapi"
2491 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2493 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2495 with_libowcapi_cppflags="-I$withval/include"
2496 with_libowcapi_libs="-L$withval/lib -lowcapi"
2497 with_libowcapi="yes"
2499 with_libowcapi="$withval"
2503 with_libowcapi="yes"
2505 if test "x$with_libowcapi" = "xyes"
2507 SAVE_CPPFLAGS="$CPPFLAGS"
2508 CPPFLAGS="$with_libowcapi_cppflags"
2510 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2512 CPPFLAGS="$SAVE_CPPFLAGS"
2514 if test "x$with_libowcapi" = "xyes"
2516 SAVE_LDFLAGS="$LDFLAGS"
2517 SAVE_CPPFLAGS="$CPPFLAGS"
2518 LDFLAGS="$with_libowcapi_libs"
2519 CPPFLAGS="$with_libowcapi_cppflags"
2521 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2523 LDFLAGS="$SAVE_LDFLAGS"
2524 CPPFLAGS="$SAVE_CPPFLAGS"
2526 if test "x$with_libowcapi" = "xyes"
2528 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2529 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2530 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2531 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2535 # --with-libpcap {{{
2536 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2538 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2540 LDFLAGS="$LDFLAGS -L$withval/lib"
2541 CPPFLAGS="$CPPFLAGS -I$withval/include"
2544 with_libpcap="$withval"
2550 if test "x$with_libpcap" = "xyes"
2552 AC_CHECK_LIB(pcap, pcap_open_live,
2554 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2555 ], [with_libpcap="no (libpcap not found)"])
2557 if test "x$with_libpcap" = "xyes"
2559 AC_CHECK_HEADERS(pcap.h,
2561 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2562 ], [with_libpcap="no (pcap.h not found)"])
2564 if test "x$with_libpcap" = "xyes"
2570 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2571 [Wether or not to use the pcap library])
2572 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2575 # --with-libperl {{{
2576 perl_interpreter="perl"
2577 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2579 if test -x "$withval"
2581 perl_interpreter="$withval"
2583 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2585 LDFLAGS="$LDFLAGS -L$withval/lib"
2586 CPPFLAGS="$CPPFLAGS -I$withval/include"
2587 perl_interpreter="$withval/bin/perl"
2590 with_libperl="$withval"
2597 AC_MSG_CHECKING([for perl])
2598 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2599 if test -x "$perl_interpreter"
2601 AC_MSG_RESULT([yes ($perl_interpreter)])
2607 AC_SUBST(PERL, "$perl_interpreter")
2609 if test "x$with_libperl" = "xyes" \
2610 && test -n "$perl_interpreter"
2612 SAVE_CFLAGS="$CFLAGS"
2613 SAVE_LDFLAGS="$LDFLAGS"
2614 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2615 PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2616 PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2617 CFLAGS="$CFLAGS $PERL_CFLAGS"
2618 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2620 AC_CACHE_CHECK([for libperl],
2621 [c_cv_have_libperl],
2625 #define PERL_NO_GET_CONTEXT
2632 load_module (PERL_LOADMOD_NOIMPORT,
2633 newSVpv ("Collectd::Plugin::FooBar", 24),
2636 [c_cv_have_libperl="yes"],
2637 [c_cv_have_libperl="no"]
2641 if test "x$c_cv_have_libperl" = "xyes"
2643 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2644 AC_SUBST(PERL_CFLAGS)
2645 AC_SUBST(PERL_LDFLAGS)
2650 CFLAGS="$SAVE_CFLAGS"
2651 LDFLAGS="$SAVE_LDFLAGS"
2652 else if test -z "$perl_interpreter"; then
2653 with_libperl="no (no perl interpreter found)"
2654 c_cv_have_libperl="no"
2656 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2658 if test "x$with_libperl" = "xyes"
2660 SAVE_CFLAGS="$CFLAGS"
2661 SAVE_LDFLAGS="$LDFLAGS"
2662 CFLAGS="$CFLAGS $PERL_CFLAGS"
2663 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2665 AC_CACHE_CHECK([if perl supports ithreads],
2666 [c_cv_have_perl_ithreads],
2674 #if !defined(USE_ITHREADS)
2675 # error "Perl does not support ithreads!"
2676 #endif /* !defined(USE_ITHREADS) */
2679 [c_cv_have_perl_ithreads="yes"],
2680 [c_cv_have_perl_ithreads="no"]
2684 if test "x$c_cv_have_perl_ithreads" = "xyes"
2686 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2689 CFLAGS="$SAVE_CFLAGS"
2690 LDFLAGS="$SAVE_LDFLAGS"
2693 if test "x$with_libperl" = "xyes"
2695 SAVE_CFLAGS="$CFLAGS"
2696 SAVE_LDFLAGS="$LDFLAGS"
2697 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2698 # (see issues #41 and #42)
2699 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2700 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2702 AC_CACHE_CHECK([for broken Perl_load_module()],
2703 [c_cv_have_broken_perl_load_module],
2707 #define PERL_NO_GET_CONTEXT
2714 load_module (PERL_LOADMOD_NOIMPORT,
2715 newSVpv ("Collectd::Plugin::FooBar", 24),
2718 [c_cv_have_broken_perl_load_module="no"],
2719 [c_cv_have_broken_perl_load_module="yes"]
2723 CFLAGS="$SAVE_CFLAGS"
2724 LDFLAGS="$SAVE_LDFLAGS"
2726 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2727 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2729 if test "x$with_libperl" = "xyes"
2731 SAVE_CFLAGS="$CFLAGS"
2732 SAVE_LDFLAGS="$LDFLAGS"
2733 CFLAGS="$CFLAGS $PERL_CFLAGS"
2734 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2737 [struct mgvtbl.svt_local],
2738 [have_struct_mgvtbl_svt_local="yes"],
2739 [have_struct_mgvtbl_svt_local="no"],
2746 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2748 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2749 [Define if Perl's struct mgvtbl has member svt_local.])
2752 CFLAGS="$SAVE_CFLAGS"
2753 LDFLAGS="$SAVE_LDFLAGS"
2758 with_pg_config="pg_config"
2759 with_libpq_includedir=""
2760 with_libpq_libdir=""
2761 with_libpq_cppflags=""
2762 with_libpq_ldflags=""
2763 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2766 if test "x$withval" = "xno"
2769 else if test "x$withval" = "xyes"
2773 if test -f "$withval" && test -x "$withval";
2775 with_pg_config="$withval"
2776 else if test -x "$withval/bin/pg_config"
2778 with_pg_config="$withval/bin/pg_config"
2786 if test "x$with_libpq" = "xyes"
2788 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2791 if test $pg_config_status -eq 0
2793 if test -n "$with_libpq_includedir"; then
2794 for dir in $with_libpq_includedir; do
2795 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2799 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2802 SAVE_CPPFLAGS="$CPPFLAGS"
2803 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2805 AC_CHECK_HEADERS(libpq-fe.h, [],
2806 [with_libpq="no (libpq-fe.h not found)"], [])
2808 CPPFLAGS="$SAVE_CPPFLAGS"
2810 if test "x$with_libpq" = "xyes"
2812 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2815 if test $pg_config_status -eq 0
2817 if test -n "$with_libpq_libdir"; then
2818 for dir in $with_libpq_libdir; do
2819 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2823 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2826 SAVE_LDFLAGS="$LDFLAGS"
2827 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2829 AC_CHECK_LIB(pq, PQconnectdb,
2831 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2833 AC_CHECK_LIB(pq, PQserverVersion,
2835 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2837 LDFLAGS="$SAVE_LDFLAGS"
2839 if test "x$with_libpq" = "xyes"
2841 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2842 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2843 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2844 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2846 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2849 # --with-libpthread {{{
2850 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2851 [ if test "x$withval" != "xno" \
2852 && test "x$withval" != "xyes"
2854 LDFLAGS="$LDFLAGS -L$withval/lib"
2855 CPPFLAGS="$CPPFLAGS -I$withval/include"
2856 with_libpthread="yes"
2858 if test "x$withval" = "xno"
2860 with_libpthread="no (disabled)"
2863 ], [with_libpthread="yes"])
2864 if test "x$with_libpthread" = "xyes"
2866 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2869 if test "x$with_libpthread" = "xyes"
2871 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2873 if test "x$with_libpthread" = "xyes"
2879 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2880 [Wether or not to use pthread (POSIX threads) library])
2881 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2886 with_python_path="$PATH"
2887 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
2889 if test "x$withval" = "xyes" || test "x$withval" = "xno"
2891 with_python="$withval"
2892 else if test -x "$withval"
2894 with_python_prog="$withval"
2895 with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
2897 else if test -d "$withval"
2899 with_python_path="$withval$PATH_SEPARATOR$with_python_path"
2902 AC_MSG_WARN([Argument not recognized: $withval])
2904 ], [with_python="yes"])
2907 SAVE_CPPFLAGS="$CPPFLAGS"
2908 SAVE_LDFLAGS="$LDFLAGS"
2911 PATH="$with_python_path"
2913 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
2915 AC_MSG_CHECKING([for python])
2916 with_python_prog="`which python 2>/dev/null`"
2917 if test "x$with_python_prog" = "x"
2919 AC_MSG_RESULT([not found])
2920 with_python="no (interpreter not found)"
2922 AC_MSG_RESULT([$with_python_prog])
2926 if test "x$with_python" = "xyes"
2928 AC_MSG_CHECKING([for Python CPPFLAGS])
2929 python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
2930 python_config_status=$?
2932 if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
2934 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
2937 AC_MSG_RESULT([$python_include_path])
2941 if test "x$with_python" = "xyes"
2943 CPPFLAGS="-I$python_include_path $CPPFLAGS"
2944 AC_CHECK_HEADERS(Python.h,
2945 [with_python="yes"],
2946 [with_python="no ('Python.h' not found)"])
2949 if test "x$with_python" = "xyes"
2951 AC_MSG_CHECKING([for Python LDFLAGS])
2952 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`
2953 python_config_status=$?
2955 if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
2957 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
2960 AC_MSG_RESULT([$python_library_path])
2964 if test "x$with_python" = "xyes"
2966 AC_MSG_CHECKING([for Python LIBS])
2967 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`
2968 python_config_status=$?
2970 if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
2972 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
2975 AC_MSG_RESULT([$python_library_flags])
2979 if test "x$with_python" = "xyes"
2981 LDFLAGS="-L$python_library_path $LDFLAGS"
2982 LIBS="$python_library_flags $LIBS"
2984 AC_CHECK_FUNC(PyObject_CallFunction,
2985 [with_python="yes"],
2986 [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
2990 CPPFLAGS="$SAVE_CPPFLAGS"
2991 LDFLAGS="$SAVE_LDFLAGS"
2994 if test "x$with_python" = "xyes"
2996 BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
2997 BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
2998 BUILD_WITH_PYTHON_LIBS="$python_library_flags"
2999 AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3000 AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3001 AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3005 # --with-librouteros {{{
3006 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3008 if test "x$withval" = "xyes"
3010 with_librouteros="yes"
3011 else if test "x$withval" = "xno"
3013 with_librouteros="no"
3015 with_librouteros="yes"
3016 LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3017 LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3020 [with_librouteros="yes"])
3022 SAVE_CPPFLAGS="$CPPFLAGS"
3023 SAVE_LDFLAGS="$LDFLAGS"
3025 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3026 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3028 if test "x$with_librouteros" = "xyes"
3030 if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3032 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3034 AC_CHECK_HEADERS(routeros_api.h,
3035 [with_librouteros="yes"],
3036 [with_librouteros="no ('routeros_api.h' not found)"])
3038 if test "x$with_librouteros" = "xyes"
3040 if test "x$LIBROUTEROS_LDFLAGS" != "x"
3042 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3044 AC_CHECK_LIB(routeros, ros_interface,
3045 [with_librouteros="yes"],
3046 [with_librouteros="no (symbol 'ros_interface' not found)"])
3049 CPPFLAGS="$SAVE_CPPFLAGS"
3050 LDFLAGS="$SAVE_LDFLAGS"
3052 if test "x$with_librouteros" = "xyes"
3054 BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3055 BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3056 AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3057 AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3059 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3063 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3066 librrd_threadsafe="yes"
3067 librrd_rrdc_update="no"
3068 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3069 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
3071 librrd_cflags="-I$withval/include"
3072 librrd_ldflags="-L$withval/lib"
3075 with_librrd="$withval"
3077 ], [with_librrd="yes"])
3078 if test "x$with_librrd" = "xyes"
3080 SAVE_CPPFLAGS="$CPPFLAGS"
3081 SAVE_LDFLAGS="$LDFLAGS"
3083 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3084 LDFLAGS="$LDFLAGS $librrd_ldflags"
3086 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3088 CPPFLAGS="$SAVE_CPPFLAGS"
3089 LDFLAGS="$SAVE_LDFLAGS"
3091 if test "x$with_librrd" = "xyes"
3093 SAVE_CPPFLAGS="$CPPFLAGS"
3094 SAVE_LDFLAGS="$LDFLAGS"
3096 CPPFLAGS="$CPPFLAGS $librrd_cflags"
3097 LDFLAGS="$LDFLAGS $librrd_ldflags"
3099 AC_CHECK_LIB(rrd_th, rrd_update_r,
3101 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3103 [librrd_threadsafe="no"
3104 AC_CHECK_LIB(rrd, rrd_update,
3106 librrd_ldflags="$librrd_ldflags -lrrd -lm"
3108 [with_librrd="no (symbol 'rrd_update' not found)"],
3113 if test "x$librrd_threadsafe" = "xyes"
3115 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3117 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3120 CPPFLAGS="$SAVE_CPPFLAGS"
3121 LDFLAGS="$SAVE_LDFLAGS"
3123 if test "x$with_librrd" = "xyes"
3125 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3126 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3127 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3128 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3130 if test "x$librrd_threadsafe" = "xyes"
3132 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3136 # --with-libsensors {{{
3137 with_sensors_cflags=""
3138 with_sensors_ldflags=""
3139 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3141 if test "x$withval" = "xno"
3143 with_libsensors="no"
3145 with_libsensors="yes"
3146 if test "x$withval" != "xyes"
3148 with_sensors_cflags="-I$withval/include"
3149 with_sensors_ldflags="-L$withval/lib"
3150 with_libsensors="yes"
3155 if test "x$ac_system" = "xLinux"
3157 with_libsensors="yes"
3159 with_libsensors="no (Linux only library)"
3162 if test "x$with_libsensors" = "xyes"
3164 SAVE_CPPFLAGS="$CPPFLAGS"
3165 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3167 # AC_CHECK_HEADERS(sensors/sensors.h,
3169 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3171 # [with_libsensors="no (sensors/sensors.h not found)"])
3172 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3174 CPPFLAGS="$SAVE_CPPFLAGS"
3176 if test "x$with_libsensors" = "xyes"
3178 SAVE_CPPFLAGS="$CPPFLAGS"
3179 SAVE_LDFLAGS="$LDFLAGS"
3180 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3181 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3183 AC_CHECK_LIB(sensors, sensors_init,
3185 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3187 [with_libsensors="no (libsensors not found)"])
3189 CPPFLAGS="$SAVE_CPPFLAGS"
3190 LDFLAGS="$SAVE_LDFLAGS"
3192 if test "x$with_libsensors" = "xyes"
3194 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3195 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3196 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3197 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3199 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3202 # --with-libstatgrab {{{
3203 with_libstatgrab_cflags=""
3204 with_libstatgrab_ldflags=""
3205 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3207 if test "x$withval" != "xno" \
3208 && test "x$withval" != "xyes"
3210 with_libstatgrab_cflags="-I$withval/include"
3211 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3212 with_libstatgrab="yes"
3213 with_libstatgrab_pkg_config="no"
3215 with_libstatgrab="$withval"
3216 with_libstatgrab_pkg_config="yes"
3220 with_libstatgrab="yes"
3221 with_libstatgrab_pkg_config="yes"
3224 if test "x$with_libstatgrab" = "xyes" \
3225 && test "x$with_libstatgrab_pkg_config" = "xyes"
3227 if test "x$PKG_CONFIG" != "x"
3229 AC_MSG_CHECKING([pkg-config for libstatgrab])
3231 $PKG_CONFIG --exists libstatgrab 2>/dev/null
3234 with_libstatgrab_pkg_config="no"
3235 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
3236 temp_result="not found"
3238 AC_MSG_RESULT([$temp_result])
3240 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
3241 with_libstatgrab_pkg_config="no"
3242 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
3246 if test "x$with_libstatgrab" = "xyes" \
3247 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3248 && test "x$with_libstatgrab_cflags" = "x"
3250 AC_MSG_CHECKING([for libstatgrab CFLAGS])
3251 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
3254 with_libstatgrab_cflags="$temp_result"
3256 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
3257 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
3259 AC_MSG_RESULT([$temp_result])
3262 if test "x$with_libstatgrab" = "xyes" \
3263 && test "x$with_libstatgrab_pkg_config" = "xyes" \
3264 && test "x$with_libstatgrab_ldflags" = "x"
3266 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
3267 temp_result="`$PKG_CONFIG --libs libstatgrab`"
3270 with_libstatgrab_ldflags="$temp_result"
3272 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
3273 temp_result="$PKG_CONFIG --libs libstatgrab failed"
3275 AC_MSG_RESULT([$temp_result])
3278 if test "x$with_libstatgrab" = "xyes"
3280 SAVE_CPPFLAGS="$CPPFLAGS"
3281 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
3283 AC_CHECK_HEADERS(statgrab.h,
3284 [with_libstatgrab="yes"],
3285 [with_libstatgrab="no (statgrab.h not found)"])
3287 CPPFLAGS="$SAVE_CPPFLAGS"
3290 if test "x$with_libstatgrab" = "xyes"
3292 SAVE_CFLAGS="$CFLAGS"
3293 SAVE_LDFLAGS="$LDFLAGS"
3295 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
3296 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
3298 AC_CHECK_LIB(statgrab, sg_init,
3299 [with_libstatgrab="yes"],
3300 [with_libstatgrab="no (symbol sg_init not found)"])
3302 CFLAGS="$SAVE_CFLAGS"
3303 LDFLAGS="$SAVE_LDFLAGS"
3306 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
3307 if test "x$with_libstatgrab" = "xyes"
3309 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
3310 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
3311 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
3312 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
3313 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
3317 # --with-libtokyotyrant {{{
3318 with_libtokyotyrant_cppflags=""
3319 with_libtokyotyrant_ldflags=""
3320 with_libtokyotyrant_libs=""
3321 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
3323 if test "x$withval" = "xno"
3325 with_libtokyotyrant="no"
3326 else if test "x$withval" = "xyes"
3328 with_libtokyotyrant="yes"
3330 with_libtokyotyrant_cppflags="-I$withval/include"
3331 with_libtokyotyrant_ldflags="-L$withval/include"
3332 with_libtokyotyrant_libs="-ltokyotyrant"
3333 with_libtokyotyrant="yes"
3337 with_libtokyotyrant="yes"
3340 if test "x$with_libtokyotyrant" = "xyes"
3342 if $PKG_CONFIG --exists tokyotyrant
3344 with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
3345 with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
3346 with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
3350 SAVE_CPPFLAGS="$CPPFLAGS"
3351 SAVE_LDFLAGS="$LDFLAGS"
3352 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
3353 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
3355 if test "x$with_libtokyotyrant" = "xyes"
3357 AC_CHECK_HEADERS(tcrdb.h,
3359 AC_DEFINE(HAVE_TCRDB_H, 1,
3360 [Define to 1 if you have the <tcrdb.h> header file.])
3361 ], [with_libtokyotyrant="no (tcrdb.h not found)"])
3364 if test "x$with_libtokyotyrant" = "xyes"
3366 AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
3368 AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
3369 [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
3371 [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
3372 [$with_libtokyotyrant_libs])
3375 CPPFLAGS="$SAVE_CPPFLAGS"
3376 LDFLAGS="$SAVE_LDFLAGS"
3378 if test "x$with_libtokyotyrant" = "xyes"
3380 BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
3381 BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
3382 BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
3383 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
3384 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
3385 AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
3387 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
3390 # --with-libupsclient {{{
3391 with_libupsclient_config=""
3392 with_libupsclient_cflags=""
3393 with_libupsclient_libs=""
3394 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
3396 if test "x$withval" = "xno"
3398 with_libupsclient="no"
3399 else if test "x$withval" = "xyes"
3401 with_libupsclient="use_pkgconfig"
3403 if test -x "$withval"
3405 with_libupsclient_config="$withval"
3406 with_libupsclient="use_libupsclient_config"
3407 else if test -x "$withval/bin/libupsclient-config"
3409 with_libupsclient_config="$withval/bin/libupsclient-config"
3410 with_libupsclient="use_libupsclient_config"
3412 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
3413 with_libupsclient_cflags="-I$withval/include"
3414 with_libupsclient_libs="-L$withval/lib -lupsclient"
3415 with_libupsclient="yes"
3419 [with_libupsclient="use_pkgconfig"])
3421 # configure using libupsclient-config
3422 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3424 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
3425 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
3428 with_libupsclient="no ($with_libupsclient_config failed)"
3430 with_libupsclient_libs="`$with_libupsclient_config --libs`"
3433 with_libupsclient="no ($with_libupsclient_config failed)"
3436 if test "x$with_libupsclient" = "xuse_libupsclient_config"
3438 with_libupsclient="yes"
3441 # configure using pkg-config
3442 if test "x$with_libupsclient" = "xuse_pkgconfig"
3444 if test "x$PKG_CONFIG" = "x"
3446 with_libupsclient="no (Don't have pkg-config)"
3449 if test "x$with_libupsclient" = "xuse_pkgconfig"
3451 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
3452 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
3455 with_libupsclient="no (pkg-config doesn't know library)"
3458 if test "x$with_libupsclient" = "xuse_pkgconfig"
3460 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
3463 with_libupsclient="no ($PKG_CONFIG failed)"
3465 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
3468 with_libupsclient="no ($PKG_CONFIG failed)"
3471 if test "x$with_libupsclient" = "xuse_pkgconfig"
3473 with_libupsclient="yes"
3476 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
3477 # the actual checks.
3478 if test "x$with_libupsclient" = "xyes"
3480 SAVE_CPPFLAGS="$CPPFLAGS"
3481 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3483 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
3485 CPPFLAGS="$SAVE_CPPFLAGS"
3487 if test "x$with_libupsclient" = "xyes"
3489 SAVE_CPPFLAGS="$CPPFLAGS"
3490 SAVE_LDFLAGS="$LDFLAGS"
3492 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3493 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
3495 AC_CHECK_LIB(upsclient, upscli_connect,
3496 [with_libupsclient="yes"],
3497 [with_libupsclient="no (symbol upscli_connect not found)"])
3499 CPPFLAGS="$SAVE_CPPFLAGS"
3500 LDFLAGS="$SAVE_LDFLAGS"
3502 if test "x$with_libupsclient" = "xyes"
3504 SAVE_CPPFLAGS="$CPPFLAGS"
3505 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
3507 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
3508 [#include <stdlib.h>
3510 #include <upsclient.h>])
3512 CPPFLAGS="$SAVE_CPPFLAGS"
3514 if test "x$with_libupsclient" = "xyes"
3516 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
3517 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
3518 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3519 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3523 # --with-libxmms {{{
3524 with_xmms_config="xmms-config"
3527 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3529 if test "x$withval" != "xno" \
3530 && test "x$withval" != "xyes"
3532 if test -f "$withval" && test -x "$withval";
3534 with_xmms_config="$withval"
3535 else if test -x "$withval/bin/xmms-config"
3537 with_xmms_config="$withval/bin/xmms-config"
3540 else if test "x$withval" = "xno"
3550 if test "x$with_libxmms" = "xyes"
3552 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3553 xmms_config_status=$?
3555 if test $xmms_config_status -ne 0
3560 if test "x$with_libxmms" = "xyes"
3562 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3563 xmms_config_status=$?
3565 if test $xmms_config_status -ne 0
3570 if test "x$with_libxmms" = "xyes"
3572 AC_CHECK_LIB(xmms, xmms_remote_get_info,
3574 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3575 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3576 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3577 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3584 with_libxmms_numeric=0
3585 if test "x$with_libxmms" = "xyes"
3587 with_libxmms_numeric=1
3589 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3590 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3593 # --with-libyajl {{{
3594 with_libyajl_cppflags=""
3595 with_libyajl_ldflags=""
3596 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3598 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3600 with_libyajl_cppflags="-I$withval/include"
3601 with_libyajl_ldflags="-L$withval/lib"
3604 with_libyajl="$withval"
3610 if test "x$with_libyajl" = "xyes"
3612 SAVE_CPPFLAGS="$CPPFLAGS"
3613 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3615 AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3617 CPPFLAGS="$SAVE_CPPFLAGS"
3619 if test "x$with_libyajl" = "xyes"
3621 SAVE_CPPFLAGS="$CPPFLAGS"
3622 SAVE_LDFLAGS="$LDFLAGS"
3623 CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3624 LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3626 AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3628 CPPFLAGS="$SAVE_CPPFLAGS"
3629 LDFLAGS="$SAVE_LDFLAGS"
3631 if test "x$with_libyajl" = "xyes"
3633 BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3634 BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3635 BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3636 AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3637 AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3638 AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3639 AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3641 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3644 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3645 with_libxml2="no (pkg-config isn't available)"
3646 with_libxml2_cflags=""
3647 with_libxml2_ldflags=""
3648 with_libvirt="no (pkg-config isn't available)"
3649 with_libvirt_cflags=""
3650 with_libvirt_ldflags=""
3651 if test "x$PKG_CONFIG" != "x"
3653 pkg-config --exists 'libxml-2.0' 2>/dev/null
3658 with_libxml2="no (pkg-config doesn't know library)"
3661 pkg-config --exists libvirt 2>/dev/null
3666 with_libvirt="no (pkg-config doesn't know library)"
3669 if test "x$with_libxml2" = "xyes"
3671 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
3676 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
3682 if test "x$with_libxml2" = "xyes"
3684 SAVE_CPPFLAGS="$CPPFLAGS"
3685 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3687 AC_CHECK_HEADERS(libxml/parser.h, [],
3688 [with_libxml2="no (libxml/parser.h not found)"])
3690 CPPFLAGS="$SAVE_CPPFLAGS"
3692 if test "x$with_libxml2" = "xyes"
3694 SAVE_CFLAGS="$CFLAGS"
3695 SAVE_LDFLAGS="$LDFLAGS"
3697 CFLAGS="$CFLAGS $with_libxml2_cflags"
3698 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3700 AC_CHECK_LIB(xml2, xmlXPathEval,
3701 [with_libxml2="yes"],
3702 [with_libxml2="no (symbol xmlXPathEval not found)"])
3704 CFLAGS="$SAVE_CFLAGS"
3705 LDFLAGS="$SAVE_LDFLAGS"
3707 dnl Add the right compiler flags and libraries.
3708 if test "x$with_libxml2" = "xyes"; then
3709 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3710 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3711 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3712 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3714 if test "x$with_libvirt" = "xyes"
3716 with_libvirt_cflags="`pkg-config --cflags libvirt`"
3721 with_libvirt_ldflags="`pkg-config --libs libvirt`"
3727 if test "x$with_libvirt" = "xyes"
3729 SAVE_CPPFLAGS="$CPPFLAGS"
3730 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3732 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3733 [with_libvirt="no (libvirt/libvirt.h not found)"])
3735 CPPFLAGS="$SAVE_CPPFLAGS"
3737 if test "x$with_libvirt" = "xyes"
3739 SAVE_CFLAGS="$CFLAGS"
3740 SAVE_LDFLAGS="$LDFLAGS"
3742 CFLAGS="$CFLAGS $with_libvirt_cflags"
3743 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3745 AC_CHECK_LIB(virt, virDomainBlockStats,
3746 [with_libvirt="yes"],
3747 [with_libvirt="no (symbol virDomainBlockStats not found)"])
3749 CFLAGS="$SAVE_CFLAGS"
3750 LDFLAGS="$SAVE_LDFLAGS"
3752 dnl Add the right compiler flags and libraries.
3753 if test "x$with_libvirt" = "xyes"; then
3754 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3755 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3756 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3757 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3761 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3762 with_libopenipmipthread="yes"
3763 with_libopenipmipthread_cflags=""
3764 with_libopenipmipthread_libs=""
3766 AC_MSG_CHECKING([for pkg-config])
3768 if test "x$PKG_CONFIG" = "x"
3770 with_libopenipmipthread="no"
3773 temp_result="$PKG_CONFIG"
3775 AC_MSG_RESULT([$temp_result])
3777 if test "x$with_libopenipmipthread" = "xyes"
3779 AC_MSG_CHECKING([for libOpenIPMIpthread])
3780 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3783 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3785 AC_MSG_RESULT([$with_libopenipmipthread])
3788 if test "x$with_libopenipmipthread" = "xyes"
3790 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3791 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3794 with_libopenipmipthread_cflags="$temp_result"
3796 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3797 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3799 AC_MSG_RESULT([$temp_result])
3802 if test "x$with_libopenipmipthread" = "xyes"
3804 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3805 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3808 with_libopenipmipthread_ldflags="$temp_result"
3810 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3811 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3813 AC_MSG_RESULT([$temp_result])
3816 if test "x$with_libopenipmipthread" = "xyes"
3818 SAVE_CPPFLAGS="$CPPFLAGS"
3819 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3821 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3822 [with_libopenipmipthread="yes"],
3823 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3824 [#include <OpenIPMI/ipmiif.h>
3825 #include <OpenIPMI/ipmi_err.h>
3826 #include <OpenIPMI/ipmi_posix.h>
3827 #include <OpenIPMI/ipmi_conn.h>
3830 CPPFLAGS="$SAVE_CPPFLAGS"
3833 if test "x$with_libopenipmipthread" = "xyes"
3835 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3836 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3837 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3838 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3842 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3843 [with_libnotify="yes"],
3844 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3846 # Check for enabled/disabled features
3849 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3850 # ------------------------------------------------------------
3852 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3857 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3862 m4_define([EnDis],[disabled])dnl
3863 m4_define([YesNo],[no])dnl
3869 m4_define([EnDis],[enabled])dnl
3870 m4_define([YesNo],[yes])dnl
3873 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3877 m4_if([$3], [feature], [],
3881 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3887 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3889 enable_$1='[YesNo]'dnl
3891 if test "x$enable_$1" = "xno"
3895 if test "x$enable_$1" = "xyes"
3899 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3904 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3905 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3907 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3909 # AC_PLUGIN(name, default, info)
3910 # ------------------------------------------------------------
3917 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3919 if test "x$enableval" = "xyes"
3922 else if test "x$enableval" = "xforce"
3927 enable_plugin="no (disabled on command line)"
3931 if test "x$enable_all_plugins" = "xauto"
3933 if test "x$2" = "xyes"
3940 enable_plugin="$enable_all_plugins"
3943 if test "x$enable_plugin" = "xyes"
3945 if test "x$2" = "xyes" || test "x$force" = "xyes"
3947 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3948 if test "x$2" != "xyes"
3950 dependency_warning="yes"
3952 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3953 dependency_error="yes"
3954 enable_plugin="no (dependency error)"
3957 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3958 enable_$1="$enable_plugin"
3960 )# AC_PLUGIN(name, default, info)
3962 m4_divert_once([HELP_ENABLE], [
3963 collectd features:])
3964 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3965 AC_COLLECTD([debug], [enable], [feature], [debugging])
3966 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
3967 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
3969 dependency_warning="no"
3970 dependency_error="no"
3975 plugin_conntrack="no"
3976 plugin_contextswitch="no"
3979 plugin_curl_json="no"
3980 plugin_curl_xml="no"
3984 plugin_interface="no"
3991 plugin_multimeter="no"
3995 plugin_processes="no"
3996 plugin_protocols="no"
4000 plugin_tcpconns="no"
4007 plugin_wireless="no"
4011 if test "x$ac_system" = "xLinux"
4013 plugin_battery="yes"
4014 plugin_conntrack="yes"
4015 plugin_contextswitch="yes"
4017 plugin_cpufreq="yes"
4019 plugin_entropy="yes"
4020 plugin_interface="yes"
4025 plugin_fscache="yes"
4026 plugin_processes="yes"
4027 plugin_protocols="yes"
4030 plugin_tcpconns="yes"
4031 plugin_thermal="yes"
4034 plugin_vserver="yes"
4035 plugin_wireless="yes"
4037 if test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4043 if test "x$ac_system" = "xOpenBSD"
4045 plugin_tcpconns="yes"
4049 if test "x$with_libiokit" = "xyes"
4051 plugin_battery="yes"
4056 if test "x$with_perfstat" = "xyes"
4062 plugin_interface="yes"
4066 if test "x$with_procinfo" = "xyes"
4068 plugin_processes="yes"
4072 if test "x$with_kstat" = "xyes"
4075 plugin_zfs_arc="yes"
4078 if test "x$with_devinfo$with_kstat" = "xyesyes"
4082 plugin_interface="yes"
4087 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
4093 if test "x$with_libstatgrab" = "xyes"
4097 plugin_interface="yes"
4104 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4110 if test "x$with_libopenipmipthread" = "xyes"
4115 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
4117 plugin_curl_json="yes"
4120 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
4122 plugin_curl_xml="yes"
4125 if test "x$have_processor_info" = "xyes"
4129 if test "x$have_sysctl" = "xyes"
4136 if test "x$have_sysctlbyname" = "xyes"
4140 plugin_tcpconns="yes"
4143 # Df plugin: Check if we know how to determine mount points first.
4144 #if test "x$have_listmntent" = "xyes"; then
4147 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
4151 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
4155 #if test "x$have_getmntent" = "xseq"
4159 if test "x$c_cv_have_one_getmntent" = "xyes"
4164 # Df plugin: Check if we have either `statfs' or `statvfs' second.
4165 if test "x$plugin_df" = "xyes"
4168 if test "x$have_statfs" = "xyes"
4172 if test "x$have_statvfs" = "xyes"
4178 if test "x$have_getifaddrs" = "xyes"
4180 plugin_interface="yes"
4183 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
4185 plugin_libvirt="yes"
4188 if test "x$have_getloadavg" = "xyes"
4193 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
4198 # Mac OS X memory interface
4199 if test "x$have_host_statistics" = "xyes"
4204 if test "x$have_termios_h" = "xyes"
4206 plugin_multimeter="yes"
4210 if test "x$have_thread_info" = "xyes"
4212 plugin_processes="yes"
4215 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
4217 plugin_processes="yes"
4220 if test "x$with_kvm_getswapinfo" = "xyes"
4225 if test "x$have_swapctl" = "xyes"
4230 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
4232 plugin_tcpconns="yes"
4235 if test "x$have_getutent" = "xyes"
4239 if test "x$have_getutxent" = "xyes"
4244 m4_divert_once([HELP_ENABLE], [
4247 AC_ARG_ENABLE([all-plugins],
4248 AC_HELP_STRING([--enable-all-plugins],
4249 [enable all plugins (auto by def)]),
4251 if test "x$enableval" = "xyes"
4253 enable_all_plugins="yes"
4254 else if test "x$enableval" = "xauto"
4256 enable_all_plugins="auto"
4258 enable_all_plugins="no"
4261 [enable_all_plugins="auto"])
4263 m4_divert_once([HELP_ENABLE], [])
4265 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
4266 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
4267 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
4268 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
4269 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
4270 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
4271 AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics])
4272 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
4273 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
4274 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
4275 AC_PLUGIN([csv], [yes], [CSV output plugin])
4276 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
4277 AC_PLUGIN([curl_json], [$plugin_curl_json], [CouchDB statistics])
4278 AC_PLUGIN([curl_xml], [$plugin_curl_xml], [CURL generic xml statistics])
4279 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
4280 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
4281 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
4282 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
4283 AC_PLUGIN([email], [yes], [EMail statistics])
4284 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
4285 AC_PLUGIN([exec], [yes], [Execution of external programs])
4286 AC_PLUGIN([filecount], [yes], [Count files in directories])
4287 AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
4288 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
4289 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
4290 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
4291 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
4292 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
4293 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
4294 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
4295 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
4296 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
4297 AC_PLUGIN([load], [$plugin_load], [System load])
4298 AC_PLUGIN([logfile], [yes], [File logging plugin])
4299 AC_PLUGIN([madwifi], [$have_linux_wireless_h], [Madwifi wireless statistics])
4300 AC_PLUGIN([match_empty_counter], [yes], [The empty counter match])
4301 AC_PLUGIN([match_hashed], [yes], [The hashed match])
4302 AC_PLUGIN([match_regex], [yes], [The regex match])
4303 AC_PLUGIN([match_timediff], [yes], [The timediff match])
4304 AC_PLUGIN([match_value], [yes], [The value match])
4305 AC_PLUGIN([mbmon], [yes], [Query mbmond])
4306 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
4307 AC_PLUGIN([memcached], [yes], [memcached statistics])
4308 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
4309 AC_PLUGIN([modbus], [$with_libmodbus], [Modbus plugin])
4310 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
4311 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
4312 AC_PLUGIN([netapp], [$with_libnetapp], [NetApp plugin])
4313 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
4314 AC_PLUGIN([network], [yes], [Network communication plugin])
4315 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
4316 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
4317 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
4318 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
4319 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
4320 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
4321 AC_PLUGIN([olsrd], [yes], [olsrd statistics])
4322 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
4323 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
4324 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
4325 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
4326 # FIXME: Check for libevent, too.
4327 AC_PLUGIN([pinba], [$have_protoc_c], [Pinba statistics])
4328 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
4329 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
4330 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
4331 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
4332 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
4333 AC_PLUGIN([python], [$with_python], [Embed a Python interpreter])
4334 AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin])
4335 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
4336 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
4337 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
4338 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
4339 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
4340 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
4341 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
4342 AC_PLUGIN([table], [yes], [Parsing of tabular data])
4343 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
4344 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
4345 AC_PLUGIN([target_notification], [yes], [The notification target])
4346 AC_PLUGIN([target_replace], [yes], [The replace target])
4347 AC_PLUGIN([target_scale],[yes], [The scale target])
4348 AC_PLUGIN([target_set], [yes], [The set target])
4349 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
4350 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
4351 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
4352 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
4353 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant], [TokyoTyrant database statistics])
4354 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
4355 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
4356 AC_PLUGIN([users], [$plugin_users], [User statistics])
4357 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
4358 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
4359 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
4360 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
4361 AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
4362 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
4363 AC_PLUGIN([zfs_arc], [$plugin_zfs_arc], [ZFS ARC statistics])
4365 dnl Default configuration file
4366 # Load either syslog or logfile
4367 LOAD_PLUGIN_SYSLOG=""
4368 LOAD_PLUGIN_LOGFILE=""
4370 AC_MSG_CHECKING([which default log plugin to load])
4371 default_log_plugin="none"
4372 if test "x$enable_syslog" = "xyes"
4374 default_log_plugin="syslog"
4376 LOAD_PLUGIN_SYSLOG="##"
4379 if test "x$enable_logfile" = "xyes"
4381 if test "x$default_log_plugin" = "xnone"
4383 default_log_plugin="logfile"
4385 LOAD_PLUGIN_LOGFILE="#"
4388 LOAD_PLUGIN_LOGFILE="##"
4390 AC_MSG_RESULT([$default_log_plugin])
4392 AC_SUBST(LOAD_PLUGIN_SYSLOG)
4393 AC_SUBST(LOAD_PLUGIN_LOGFILE)
4395 DEFAULT_LOG_LEVEL="info"
4396 if test "x$enable_debug" = "xyes"
4398 DEFAULT_LOG_LEVEL="debug"
4400 AC_SUBST(DEFAULT_LOG_LEVEL)
4402 # Load only one of rrdtool, network, csv in the default config.
4403 LOAD_PLUGIN_RRDTOOL=""
4404 LOAD_PLUGIN_NETWORK=""
4407 AC_MSG_CHECKING([which default write plugin to load])
4408 default_write_plugin="none"
4409 if test "x$enable_rrdtool" = "xyes"
4411 default_write_plugin="rrdtool"
4413 LOAD_PLUGIN_RRDTOOL="##"
4416 if test "x$enable_network" = "xyes"
4418 if test "x$default_write_plugin" = "xnone"
4420 default_write_plugin="network"
4422 LOAD_PLUGIN_NETWORK="#"
4425 LOAD_PLUGIN_NETWORK="##"
4428 if test "x$enable_csv" = "xyes"
4430 if test "x$default_write_plugin" = "xnone"
4432 default_write_plugin="csv"
4437 LOAD_PLUGIN_CSV="##"
4439 AC_MSG_RESULT([$default_write_plugin])
4441 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
4442 AC_SUBST(LOAD_PLUGIN_NETWORK)
4443 AC_SUBST(LOAD_PLUGIN_CSV)
4446 if test "x$ac_system" = "xLinux" \
4447 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
4449 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
4453 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
4455 if test "x$withval" != "xno" && test "x$withval" != "xyes"
4457 PERL_BINDINGS_OPTIONS="$withval"
4458 with_perl_bindings="yes"
4460 PERL_BINDINGS_OPTIONS=""
4461 with_perl_bindings="$withval"
4465 PERL_BINDINGS_OPTIONS=""
4466 if test -n "$perl_interpreter"
4468 with_perl_bindings="yes"
4470 with_perl_bindings="no (no perl interpreter found)"
4473 if test "x$with_perl_bindings" = "xyes"
4475 PERL_BINDINGS="perl"
4479 AC_SUBST(PERL_BINDINGS)
4480 AC_SUBST(PERL_BINDINGS_OPTIONS)
4482 dnl libcollectdclient
4483 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
4484 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
4485 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
4487 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
4489 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
4491 AC_SUBST(LCC_VERSION_MAJOR)
4492 AC_SUBST(LCC_VERSION_MINOR)
4493 AC_SUBST(LCC_VERSION_PATCH)
4494 AC_SUBST(LCC_VERSION_EXTRA)
4495 AC_SUBST(LCC_VERSION_STRING)
4497 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
4499 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)
4501 if test "x$with_librrd" = "xyes" \
4502 && test "x$librrd_threadsafe" != "xyes"
4504 with_librrd="yes (warning: librrd is not thread-safe)"
4507 if test "x$with_libiptc" = "xyes" && test "x$with_own_libiptc" = "xyes"
4509 with_libiptc="yes (shipped version)"
4512 if test "x$with_libperl" = "xyes"
4514 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
4516 enable_perl="no (needs libperl)"
4519 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
4521 enable_perl="no (libperl doesn't support ithreads)"
4524 if test "x$with_perl_bindings" = "xyes" \
4525 && test "x$PERL_BINDINGS_OPTIONS" != "x"
4527 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
4534 libcurl . . . . . . . $with_libcurl
4535 libdbi . . . . . . . $with_libdbi
4536 libesmtp . . . . . . $with_libesmtp
4537 libganglia . . . . . $with_libganglia
4538 libgcrypt . . . . . . $with_libgcrypt
4539 libiokit . . . . . . $with_libiokit
4540 libiptc . . . . . . . $with_libiptc
4541 libjvm . . . . . . . $with_java
4542 libkstat . . . . . . $with_kstat
4543 libkvm . . . . . . . $with_libkvm
4544 libmemcached . . . . $with_libmemcached
4545 libmodbus . . . . . . $with_libmodbus
4546 libmysql . . . . . . $with_libmysql
4547 libnetapp . . . . . . $with_libnetapp
4548 libnetlink . . . . . $with_libnetlink
4549 libnetsnmp . . . . . $with_libnetsnmp
4550 libnotify . . . . . . $with_libnotify
4551 liboconfig . . . . . $with_liboconfig
4552 libopenipmi . . . . . $with_libopenipmipthread
4553 liboping . . . . . . $with_liboping
4554 libpcap . . . . . . . $with_libpcap
4555 libperfstat . . . . . $with_perfstat
4556 libperl . . . . . . . $with_libperl
4557 libpq . . . . . . . . $with_libpq
4558 libpthread . . . . . $with_libpthread
4559 librouteros . . . . . $with_librouteros
4560 librrd . . . . . . . $with_librrd
4561 libsensors . . . . . $with_libsensors
4562 libstatgrab . . . . . $with_libstatgrab
4563 libtokyotyrant . . . $with_libtokyotyrant
4564 libupsclient . . . . $with_libupsclient
4565 libvirt . . . . . . . $with_libvirt
4566 libxml2 . . . . . . . $with_libxml2
4567 libxmms . . . . . . . $with_libxmms
4568 libyajl . . . . . . . $with_libyajl
4569 libevent . . . . . . $with_libevent
4570 protobuf-c . . . . . $have_protoc_c
4571 oracle . . . . . . . $with_oracle
4572 python . . . . . . . $with_python
4575 daemon mode . . . . . $enable_daemon
4576 debug . . . . . . . . $enable_debug
4579 perl . . . . . . . . $with_perl_bindings
4582 apache . . . . . . . $enable_apache
4583 apcups . . . . . . . $enable_apcups
4584 apple_sensors . . . . $enable_apple_sensors
4585 ascent . . . . . . . $enable_ascent
4586 battery . . . . . . . $enable_battery
4587 bind . . . . . . . . $enable_bind
4588 conntrack . . . . . . $enable_conntrack
4589 contextswitch . . . . $enable_contextswitch
4590 cpu . . . . . . . . . $enable_cpu
4591 cpufreq . . . . . . . $enable_cpufreq
4592 csv . . . . . . . . . $enable_csv
4593 curl . . . . . . . . $enable_curl
4594 curl_json . . . . . . $enable_curl_json
4595 curl_xml . . . . . . $enable_curl_xml
4596 dbi . . . . . . . . . $enable_dbi
4597 df . . . . . . . . . $enable_df
4598 disk . . . . . . . . $enable_disk
4599 dns . . . . . . . . . $enable_dns
4600 email . . . . . . . . $enable_email
4601 entropy . . . . . . . $enable_entropy
4602 exec . . . . . . . . $enable_exec
4603 filecount . . . . . . $enable_filecount
4604 fscache . . . . . . . $enable_fscache
4605 gmond . . . . . . . . $enable_gmond
4606 hddtemp . . . . . . . $enable_hddtemp
4607 interface . . . . . . $enable_interface
4608 ipmi . . . . . . . . $enable_ipmi
4609 iptables . . . . . . $enable_iptables
4610 ipvs . . . . . . . . $enable_ipvs
4611 irq . . . . . . . . . $enable_irq
4612 java . . . . . . . . $enable_java
4613 libvirt . . . . . . . $enable_libvirt
4614 load . . . . . . . . $enable_load
4615 logfile . . . . . . . $enable_logfile
4616 madwifi . . . . . . . $enable_madwifi
4617 match_empty_counter . $enable_match_empty_counter
4618 match_hashed . . . . $enable_match_hashed
4619 match_regex . . . . . $enable_match_regex
4620 match_timediff . . . $enable_match_timediff
4621 match_value . . . . . $enable_match_value
4622 mbmon . . . . . . . . $enable_mbmon
4623 memcachec . . . . . . $enable_memcachec
4624 memcached . . . . . . $enable_memcached
4625 memory . . . . . . . $enable_memory
4626 modbus . . . . . . . $enable_modbus
4627 multimeter . . . . . $enable_multimeter
4628 mysql . . . . . . . . $enable_mysql
4629 netapp . . . . . . . $enable_netapp
4630 netlink . . . . . . . $enable_netlink
4631 network . . . . . . . $enable_network
4632 nfs . . . . . . . . . $enable_nfs
4633 nginx . . . . . . . . $enable_nginx
4634 notify_desktop . . . $enable_notify_desktop
4635 notify_email . . . . $enable_notify_email
4636 ntpd . . . . . . . . $enable_ntpd
4637 nut . . . . . . . . . $enable_nut
4638 olsrd . . . . . . . . $enable_olsrd
4639 onewire . . . . . . . $enable_onewire
4640 openvpn . . . . . . . $enable_openvpn
4641 oracle . . . . . . . $enable_oracle
4642 perl . . . . . . . . $enable_perl
4643 pinba . . . . . . . . $enable_pinba
4644 ping . . . . . . . . $enable_ping
4645 postgresql . . . . . $enable_postgresql
4646 powerdns . . . . . . $enable_powerdns
4647 processes . . . . . . $enable_processes
4648 protocols . . . . . . $enable_protocols
4649 python . . . . . . . $enable_python
4650 routeros . . . . . . $enable_routeros
4651 rrdcached . . . . . . $enable_rrdcached
4652 rrdtool . . . . . . . $enable_rrdtool
4653 sensors . . . . . . . $enable_sensors
4654 serial . . . . . . . $enable_serial
4655 snmp . . . . . . . . $enable_snmp
4656 swap . . . . . . . . $enable_swap
4657 syslog . . . . . . . $enable_syslog
4658 table . . . . . . . . $enable_table
4659 tail . . . . . . . . $enable_tail
4660 tape . . . . . . . . $enable_tape
4661 target_notification . $enable_target_notification
4662 target_replace . . . $enable_target_replace
4663 target_scale . . . . $enable_target_scale
4664 target_set . . . . . $enable_target_set
4665 tcpconns . . . . . . $enable_tcpconns
4666 teamspeak2 . . . . . $enable_teamspeak2
4667 ted . . . . . . . . . $enable_ted
4668 thermal . . . . . . . $enable_thermal
4669 tokyotyrant . . . . . $enable_tokyotyrant
4670 unixsock . . . . . . $enable_unixsock
4671 uptime . . . . . . . $enable_uptime
4672 users . . . . . . . . $enable_users
4673 uuid . . . . . . . . $enable_uuid
4674 vmem . . . . . . . . $enable_vmem
4675 vserver . . . . . . . $enable_vserver
4676 wireless . . . . . . $enable_wireless
4677 write_http . . . . . $enable_write_http
4678 xmms . . . . . . . . $enable_xmms
4679 zfs_arc . . . . . . . $enable_zfs_arc
4683 if test "x$dependency_error" = "xyes"; then
4684 AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4687 if test "x$dependency_warning" = "xyes"; then
4688 AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4691 # vim: set fdm=marker :