1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
8 AC_PREFIX_DEFAULT("/opt/collectd")
13 # Checks for programs.
21 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
25 AC_LIBLTDL_CONVENIENCE
33 AC_CONFIG_SUBDIRS(libltdl)
35 AC_MSG_CHECKING([for kernel type ($host_os)])
38 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
42 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
54 AC_MSG_RESULT([$ac_system])
56 if test "x$ac_system" = "xLinux"
58 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
59 if test -z "$KERNEL_DIR"
61 KERNEL_DIR="/lib/modules/`uname -r`/source"
64 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
65 AC_SUBST(KERNEL_CFLAGS)
68 if test "x$ac_system" = "xSolaris"
70 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
73 # Where to install .pc files.
74 pkgconfigdir="${libdir}/pkgconfig"
75 AC_SUBST(pkgconfigdir)
78 # Checks for header files.
84 AC_CHECK_HEADERS(stdio.h stdint.h stdbool.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)
87 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
92 # include <sys/types.h>
95 AC_CHECK_HEADERS(netinet/in.h, [], [],
100 # include <sys/types.h>
102 #if HAVE_NETINET_IN_SYSTM_H
103 # include <netinet/in_systm.h>
106 AC_CHECK_HEADERS(netinet/ip.h, [], [],
111 # include <sys/types.h>
113 #if HAVE_NETINET_IN_SYSTM_H
114 # include <netinet/in_systm.h>
116 #if HAVE_NETINET_IN_H
117 # include <netinet/in.h>
120 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
125 # include <sys/types.h>
127 #if HAVE_NETINET_IN_SYSTM_H
128 # include <netinet/in_systm.h>
130 #if HAVE_NETINET_IN_H
131 # include <netinet/in.h>
133 #if HAVE_NETINET_IP_H
134 # include <netinet/ip.h>
137 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
142 # include <sys/types.h>
144 #if HAVE_NETINET_IN_SYSTM_H
145 # include <netinet/in_systm.h>
147 #if HAVE_NETINET_IN_H
148 # include <netinet/in.h>
150 #if HAVE_NETINET_IP_H
151 # include <netinet/ip.h>
154 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
159 # include <sys/types.h>
161 #if HAVE_NETINET_IN_SYSTM_H
162 # include <netinet/in_systm.h>
164 #if HAVE_NETINET_IN_H
165 # include <netinet/in.h>
168 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
173 # include <sys/types.h>
175 #if HAVE_NETINET_IN_SYSTM_H
176 # include <netinet/in_systm.h>
178 #if HAVE_NETINET_IN_H
179 # include <netinet/in.h>
181 #if HAVE_NETINET_IP6_H
182 # include <netinet/ip6.h>
185 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
190 # include <sys/types.h>
192 #if HAVE_NETINET_IN_SYSTM_H
193 # include <netinet/in_systm.h>
195 #if HAVE_NETINET_IN_H
196 # include <netinet/in.h>
198 #if HAVE_NETINET_IP_H
199 # include <netinet/ip.h>
202 AC_CHECK_HEADERS(netinet/udp.h, [], [],
207 # include <sys/types.h>
209 #if HAVE_NETINET_IN_SYSTM_H
210 # include <netinet/in_systm.h>
212 #if HAVE_NETINET_IN_H
213 # include <netinet/in.h>
215 #if HAVE_NETINET_IP_H
216 # include <netinet/ip.h>
221 AC_CHECK_HEADERS(sys/dkstat.h)
222 if test "x$ac_system" = "xDarwin"
224 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)
225 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
227 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
230 # include <sys/types.h>
233 # include <sys/param.h>
238 AC_CHECK_HEADERS(linux/major.h libgen.h)
240 # For the battery plugin
241 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
243 #if HAVE_IOKIT_IOKITLIB_H
244 # include <IOKit/IOKitLib.h>
246 #if HAVE_IOKIT_IOTYPES_H
247 # include <IOKit/IOTypes.h>
251 # For the swap module
252 have_sys_swap_h="yes"
253 AC_CHECK_HEADERS(sys/swap.h, [], [have_sys_swap_h="no"],
256 # include <sys/types.h>
259 # include <sys/param.h>
263 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
265 AC_MSG_NOTICE([Solaris detected and sys/swap.h not found: Try building a 64bit binary.])
269 # For the processes plugin
271 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
273 # For interface plugin
274 AC_CHECK_HEADERS(ifaddrs.h)
275 AC_CHECK_HEADERS(net/if.h, [], [],
278 # include <sys/types.h>
280 #if HAVE_SYS_SOCKET_H
281 # include <sys/socket.h>
284 AC_CHECK_HEADERS(linux/if.h, [], [],
287 # include <sys/types.h>
289 #if HAVE_SYS_SOCKET_H
290 # include <sys/socket.h>
293 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
296 # include <sys/types.h>
298 #if HAVE_SYS_SOCKET_H
299 # include <sys/socket.h>
302 # include <linux/if.h>
307 have_net_ip_vs_h="no"
309 if test "x$ac_system" = "xLinux"
312 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
314 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
315 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
321 AC_CHECK_HEADERS(sys/ucred.h, [], [],
324 # include <sys/types.h>
327 # include <sys/param.h>
331 # For mount interface
332 AC_CHECK_HEADERS(sys/mount.h, [], [],
335 # include <sys/types.h>
338 # include <sys/param.h>
342 # For the email plugin
343 AC_CHECK_HEADERS(linux/un.h, [], [],
345 #if HAVE_SYS_SOCKET_H
346 # include <sys/socket.h>
350 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h sys/quota.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)
353 AC_CHECK_HEADERS(arpa/nameser.h)
354 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
356 #if HAVE_ARPA_NAMESER_H
357 # include <arpa/nameser.h>
361 AC_CHECK_HEADERS(net/if_arp.h, [], [],
362 [#if HAVE_SYS_SOCKET_H
363 # include <sys/socket.h>
366 AC_CHECK_HEADERS(net/ppp_defs.h)
367 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
368 [#if HAVE_NET_PPP_DEFS_H
369 # include <net/ppp_defs.h>
372 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
377 # include <sys/types.h>
379 #if HAVE_SYS_SOCKET_H
380 # include <sys/socket.h>
385 #if HAVE_NETINET_IN_H
386 # include <netinet/in.h>
390 # For the multimeter plugin
392 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
395 # Checks for typedefs, structures, and compiler characteristics.
404 # Checks for library functions.
406 AC_PROG_GCC_TRADITIONAL
407 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf)
411 AC_CACHE_CHECK([for strtok_r],
412 [c_cv_have_strtok_r_default],
421 char buffer[] = "foo,bar,baz";
428 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
431 printf ("token = %s;\n", token);
434 [c_cv_have_strtok_r_default="yes"],
435 [c_cv_have_strtok_r_default="no"]
439 if test "x$c_cv_have_strtok_r_default" = "xno"
441 SAVE_CFLAGS="$CFLAGS"
442 CFLAGS="$CFLAGS -D_REENTRANT=1"
444 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
445 [c_cv_have_strtok_r_reentrant],
454 char buffer[] = "foo,bar,baz";
461 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
464 printf ("token = %s;\n", token);
467 [c_cv_have_strtok_r_reentrant="yes"],
468 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
473 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
475 socket_needs_socket="no"
476 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
477 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
479 nanosleep_needs_rt="no"
480 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
481 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
483 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
484 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
485 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
486 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
487 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
488 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
489 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
490 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
491 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
492 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
493 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
494 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
497 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
500 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
502 if test "x$withval" = "xno"; then
504 else if test "x$withval" = "xyes"; then
511 if test "x$nan_type" = "xnone"; then
512 AC_CACHE_CHECK([whether NAN is defined by default],
513 [c_cv_have_nan_default],
519 static float foo = NAN;
527 [c_cv_have_nan_default="yes"],
528 [c_cv_have_nan_default="no"]
531 if test "x$c_cv_have_nan_default" = "xyes"
536 if test "x$nan_type" = "xnone"; then
537 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
538 [c_cv_have_nan_isoc],
543 #define __USE_ISOC99 1
545 static float foo = NAN;
553 [c_cv_have_nan_isoc="yes"],
554 [c_cv_have_nan_isoc="no"]
557 if test "x$c_cv_have_nan_isoc" = "xyes"
562 if test "x$nan_type" = "xnone"; then
563 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
564 [c_cv_have_nan_zero],
573 #define NAN (0.0 / 0.0)
575 # define isnan(f) ((f) != (f))
577 static float foo = NAN;
585 [c_cv_have_nan_zero="yes"],
586 [c_cv_have_nan_zero="no"]
589 if test "x$c_cv_have_nan_zero" = "xyes"
595 if test "x$nan_type" = "xdefault"; then
596 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
597 [Define if NAN is defined by default and can initialize static variables.])
598 else if test "x$nan_type" = "xisoc99"; then
599 AC_DEFINE(NAN_STATIC_ISOC, 1,
600 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
601 else if test "x$nan_type" = "xzero"; then
602 AC_DEFINE(NAN_ZERO_ZERO, 1,
603 [Define if NAN can be defined as (0.0 / 0.0)])
605 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
608 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
610 if test "x$withval" = "xnothing"; then
611 fp_layout_type="nothing"
612 else if test "x$withval" = "xendianflip"; then
613 fp_layout_type="endianflip"
614 else if test "x$withval" = "xintswap"; then
615 fp_layout_type="intswap"
617 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
620 [fp_layout_type="unknown"])
622 if test "x$fp_layout_type" = "xunknown"; then
623 AC_CACHE_CHECK([if doubles are stored in x86 representation],
624 [c_cv_fp_layout_need_nothing],
635 # include <stdbool.h>
645 memcpy ((void *) &i0, (void *) &d, 8);
648 memcpy ((void *) c, (void *) &i1, 8);
650 if ((c[0] == 0x2f) && (c[1] == 0x25)
651 && (c[2] == 0xc0) && (c[3] == 0xc7)
652 && (c[4] == 0x43) && (c[5] == 0x2b)
653 && (c[6] == 0x1f) && (c[7] == 0x5b))
658 [c_cv_fp_layout_need_nothing="yes"],
659 [c_cv_fp_layout_need_nothing="no"]
662 if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
663 fp_layout_type="nothing"
666 if test "x$fp_layout_type" = "xunknown"; then
667 AC_CACHE_CHECK([if endianflip converts to x86 representation],
668 [c_cv_fp_layout_need_endianflip],
679 # include <stdbool.h>
681 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
682 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
683 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
684 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
685 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
686 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
687 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
688 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
697 memcpy ((void *) &i0, (void *) &d, 8);
699 i1 = endianflip (i0);
700 memcpy ((void *) c, (void *) &i1, 8);
702 if ((c[0] == 0x2f) && (c[1] == 0x25)
703 && (c[2] == 0xc0) && (c[3] == 0xc7)
704 && (c[4] == 0x43) && (c[5] == 0x2b)
705 && (c[6] == 0x1f) && (c[7] == 0x5b))
710 [c_cv_fp_layout_need_endianflip="yes"],
711 [c_cv_fp_layout_need_endianflip="no"]
714 if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
715 fp_layout_type="endianflip"
718 if test "x$fp_layout_type" = "xunknown"; then
719 AC_CACHE_CHECK([if intswap converts to x86 representation],
720 [c_cv_fp_layout_need_intswap],
731 # include <stdbool.h>
733 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
734 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
743 memcpy ((void *) &i0, (void *) &d, 8);
746 memcpy ((void *) c, (void *) &i1, 8);
748 if ((c[0] == 0x2f) && (c[1] == 0x25)
749 && (c[2] == 0xc0) && (c[3] == 0xc7)
750 && (c[4] == 0x43) && (c[5] == 0x2b)
751 && (c[6] == 0x1f) && (c[7] == 0x5b))
756 [c_cv_fp_layout_need_intswap="yes"],
757 [c_cv_fp_layout_need_intswap="no"]
760 if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
761 fp_layout_type="intswap"
765 if test "x$fp_layout_type" = "xnothing"; then
766 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
767 [Define if doubles are stored in x86 representation.])
768 else if test "x$fp_layout_type" = "xendianflip"; then
769 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
770 [Define if endianflip is needed to convert to x86 representation.])
771 else if test "x$fp_layout_type" = "xintswap"; then
772 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
773 [Define if intswap is needed to convert to x86 representation.])
775 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
779 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
781 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
783 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
786 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
787 if test "x$have_getmntent" = "xno"; then
788 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
790 if test "x$have_getmntent" = "xno"; then
791 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
793 if test "x$have_getmntent" = "xno"; then
794 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
797 if test "x$have_getmntent" = "xc"; then
798 AC_CACHE_CHECK([whether getmntent takes one argument],
799 [c_cv_have_one_getmntent],
801 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
803 #include "$srcdir/src/utils_mount.h"]],
807 fh = setmntent ("/etc/mtab", "r");
811 [c_cv_have_one_getmntent="yes"],
812 [c_cv_have_one_getmntent="no"]
815 AC_CACHE_CHECK([whether getmntent takes two arguments],
816 [c_cv_have_two_getmntent],
818 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
819 #include <sys/mnttab.h>
820 #include "$srcdir/src/utils_mount.h"]],
825 fh = fopen ("/etc/mnttab", "r");
826 status = getmntent (fh, &mt);
829 [c_cv_have_two_getmntent="yes"],
830 [c_cv_have_two_getmntent="no"]
835 # Check for different versions of `getmntent' here..
837 if test "x$have_getmntent" = "xc"; then
838 if test "x$c_cv_have_one_getmntent" = "xyes"; then
839 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
840 [Define if the function getmntent exists and takes one argument.])
842 if test "x$c_cv_have_two_getmntent" = "xyes"; then
843 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
844 [Define if the function getmntent exists and takes two arguments.])
847 if test "x$have_getmntent" = "xsun"; then
848 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
849 [Define if the function getmntent exists. It's the version from libsun.])
851 if test "x$have_getmntent" = "xseq"; then
852 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
853 [Define if the function getmntent exists. It's the version from libseq.])
855 if test "x$have_getmntent" = "xgen"; then
856 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
857 [Define if the function getmntent exists. It's the version from libgen.])
860 # Check for structures
861 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
862 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
865 #include <sys/types.h>
866 #include <sys/socket.h>
869 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
870 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
873 #include <sys/types.h>
874 #include <sys/socket.h>
875 #include <linux/if.h>
876 #include <linux/netdevice.h>
879 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
884 # include <sys/types.h>
886 #if HAVE_NETINET_IN_SYSTM_H
887 # include <netinet/in_systm.h>
889 #if HAVE_NETINET_IN_H
890 # include <netinet/in.h>
892 #if HAVE_NETINET_IP_H
893 # include <netinet/ip.h>
895 #if HAVE_NETINET_UDP_H
896 # include <netinet/udp.h>
899 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
904 # include <sys/types.h>
906 #if HAVE_NETINET_IN_SYSTM_H
907 # include <netinet/in_systm.h>
909 #if HAVE_NETINET_IN_H
910 # include <netinet/in.h>
912 #if HAVE_NETINET_IP_H
913 # include <netinet/ip.h>
915 #if HAVE_NETINET_UDP_H
916 # include <netinet/udp.h>
920 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
930 # Checks for libraries begin here
933 AC_CHECK_LIB(resolv, res_search,
935 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
937 [with_libresolv="no"])
938 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
940 dnl Check for HAL (hardware abstraction library)
942 AC_CHECK_LIB(hal,libhal_device_property_exists,
943 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
945 if test "x$with_libhal" = "xyes"; then
946 if test "x$PKG_CONFIG" != "x"; then
947 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
948 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
949 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
950 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
954 m4_divert_once([HELP_WITH], [
955 collectd additional packages:])
957 if test "x$ac_system" = "xSolaris"
962 with_kstat="no (Solaris only)"
963 with_devinfo="no (Solaris only)"
966 if test "x$with_kstat" = "xyes"
968 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
970 if test "x$with_kstat" = "xyes"
972 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
973 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
975 if test "x$with_kstat" = "xyes"
977 AC_DEFINE(HAVE_LIBKSTAT, 1,
978 [Define to 1 if you have the 'kstat' library (-lkstat)])
980 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
981 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
984 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
991 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
994 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
995 if test "x$with_kvm_getprocs" = "xyes"
997 AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
998 [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1001 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1003 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1004 if test "x$with_kvm_getswapinfo" = "xyes"
1006 AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1007 [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1010 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1012 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1013 if test "x$with_kvm_nlist" = "xyes"
1015 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1016 [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1019 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1021 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1022 if test "x$with_kvm_openfiles" = "xyes"
1024 AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1025 [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1028 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1030 # --with-libcurl {{{
1031 with_curl_config="curl-config"
1034 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1036 if test "x$withval" = "xno"
1039 else if test "x$withval" = "xyes"
1043 if test -f "$withval" && test -x "$withval"
1045 with_curl_config="$withval"
1047 else if test -x "$withval/bin/curl-config"
1049 with_curl_config="$withval/bin/curl-config"
1058 if test "x$with_libcurl" = "xyes"
1060 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1061 curl_config_status=$?
1063 if test $curl_config_status -ne 0
1065 with_libcurl="no ($with_curl_config failed)"
1067 SAVE_CPPFLAGS="$CPPFLAGS"
1068 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1070 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1072 CPPFLAGS="$SAVE_CPPFLAGS"
1075 if test "x$with_libcurl" = "xyes"
1077 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1078 curl_config_status=$?
1080 if test $curl_config_status -ne 0
1082 with_libcurl="no ($with_curl_config failed)"
1084 AC_CHECK_LIB(curl, curl_easy_init,
1085 [with_libcurl="yes"],
1086 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1090 if test "x$with_libcurl" = "xyes"
1092 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1093 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1094 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1095 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1097 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1101 with_libdbi_cppflags=""
1102 with_libdbi_ldflags=""
1103 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1105 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1107 with_libdbi_cppflags="-I$withval/include"
1108 with_libdbi_ldflags="-L$withval/lib"
1111 with_libdbi="$withval"
1117 if test "x$with_libdbi" = "xyes"
1119 SAVE_CPPFLAGS="$CPPFLAGS"
1120 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1122 AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1124 CPPFLAGS="$SAVE_CPPFLAGS"
1126 if test "x$with_libdbi" = "xyes"
1128 SAVE_CPPFLAGS="$CPPFLAGS"
1129 SAVE_LDFLAGS="$LDFLAGS"
1130 CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1131 LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1133 AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1135 CPPFLAGS="$SAVE_CPPFLAGS"
1136 LDFLAGS="$SAVE_LDFLAGS"
1138 if test "x$with_libdbi" = "xyes"
1140 BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1141 BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1142 BUILD_WITH_LIBDBI_LIBS="-ldbi"
1143 AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1144 AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1145 AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1147 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1150 # --with-libesmtp {{{
1151 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1153 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1155 LDFLAGS="$LDFLAGS -L$withval/lib"
1156 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1159 with_libesmtp="$withval"
1165 if test "x$with_libesmtp" = "xyes"
1167 AC_CHECK_LIB(esmtp, smtp_create_session,
1169 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1170 ], [with_libesmtp="no (libesmtp not found)"])
1172 if test "x$with_libesmtp" = "xyes"
1174 AC_CHECK_HEADERS(libesmtp.h,
1176 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1177 ], [with_libesmtp="no (libesmtp.h not found)"])
1179 if test "x$with_libesmtp" = "xyes"
1185 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1186 [Wether or not to use the esmtp library])
1187 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1190 # --with-libganglia {{{
1191 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1193 if test -f "$withval" && test -x "$withval"
1195 with_libganglia_config="$withval"
1196 with_libganglia="yes"
1197 else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1199 with_libganglia_config="$withval/bin/ganglia-config"
1200 with_libganglia="yes"
1201 else if test -d "$withval"
1203 GANGLIA_CPPFLAGS="-I$withval/include"
1204 GANGLIA_LDFLAGS="-L$withval/lib"
1205 with_libganglia="yes"
1207 with_libganglia_config="ganglia-config"
1208 with_libganglia="$withval"
1212 with_libganglia_config="ganglia-config"
1213 with_libganglia="yes"
1216 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1218 if test "x$GANGLIA_CPPFLAGS" = "x"
1220 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1223 if test "x$GANGLIA_LDFLAGS" = "x"
1225 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1228 if test "x$GANGLIA_LIBS" = "x"
1230 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1234 SAVE_CPPFLAGS="$CPPFLAGS"
1235 SAVE_LDFLAGS="$LDFLAGS"
1236 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1237 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1239 if test "x$with_libganglia" = "xyes"
1241 AC_CHECK_HEADERS(gm_protocol.h,
1243 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1244 [Define to 1 if you have the <gm_protocol.h> header file.])
1245 ], [with_libganglia="no (gm_protocol.h not found)"])
1248 if test "x$with_libganglia" = "xyes"
1250 AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1252 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1253 [Define to 1 if you have the ganglia library (-lganglia).])
1254 ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1257 CPPFLAGS="$SAVE_CPPFLAGS"
1258 LDFLAGS="$SAVE_LDFLAGS"
1260 AC_SUBST(GANGLIA_CPPFLAGS)
1261 AC_SUBST(GANGLIA_LDFLAGS)
1262 AC_SUBST(GANGLIA_LIBS)
1263 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1266 # --with-libiptc {{{
1267 with_own_libiptc="no"
1268 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1270 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1272 LDFLAGS="$LDFLAGS -L$withval/lib"
1273 CPPFLAGS="$CPPFLAGS -I$withval/include"
1276 with_libiptc="$withval"
1280 if test "x$ac_system" = "xLinux"
1284 with_libiptc="no (Linux only)"
1287 if test "x$with_libiptc" = "xyes"
1289 AC_CHECK_LIB(iptc, iptc_init,
1291 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1295 with_own_libiptc="yes"
1298 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1300 AC_CHECK_HEADERS(libiptc/libiptc.h,
1302 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1306 with_own_libiptc="yes"
1309 if test "x$with_libiptc" = "xyes"
1312 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1314 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1316 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1317 with_own_libiptc="no"
1320 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1325 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1326 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1327 if test "x$with_own_libiptc" = "xyes"
1329 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1334 with_java_home="$JAVA_HOME"
1335 with_java_vmtype="client"
1338 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1340 if test "x$withval" = "xno"
1343 else if test "x$withval" = "xyes"
1347 with_java_home="$withval"
1352 if test "x$with_java" = "xyes"
1354 if test -d "$with_java_home"
1356 if test -d "$with_java_home/include"
1358 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$with_java_home/include"
1360 JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$with_java_home"
1363 if test -d "$with_java_home/lib"
1365 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$with_java_home/lib"
1367 JAVA_LDFLAGS="$JAVA_LDFLAGS -L$with_java_home"
1369 else if test "x$with_java_home" != "x"
1371 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1375 if test "x$JAVA_CPPFLAGS" != "x"
1377 AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1379 if test "x$JAVA_CFLAGS" != "x"
1381 AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1383 if test "x$JAVA_LDFLAGS" != "x"
1385 AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1388 SAVE_CPPFLAGS="$CPPFLAGS"
1389 SAVE_CFLAGS="$CFLAGS"
1390 SAVE_LDFLAGS="$LDFLAGS"
1391 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1392 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1393 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1395 if test "x$with_java" = "xyes"
1397 AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1399 if test "x$with_java" = "xyes"
1401 AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1403 [with_java="no (libjvm not found)"],
1406 if test "x$with_java" = "xyes"
1408 JAVA_LIBS="$JAVA_LIBS -ljvm"
1409 AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1412 CPPFLAGS="$SAVE_CPPFLAGS"
1413 CFLAGS="$SAVE_CFLAGS"
1414 LDFLAGS="$SAVE_LDFLAGS"
1416 AC_SUBST(JAVA_CPPFLAGS)
1417 AC_SUBST(JAVA_CFLAGS)
1418 AC_SUBST(JAVA_LDFLAGS)
1420 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1423 # --with-libmemcached {{{
1424 with_libmemcached_cppflags=""
1425 with_libmemcached_ldflags=""
1426 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1428 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1430 with_libmemcached_cppflags="-I$withval/include"
1431 with_libmemcached_ldflags="-L$withval/lib"
1432 with_libmemcached="yes"
1434 with_libmemcached="$withval"
1438 with_libmemcached="yes"
1440 if test "x$with_libmemcached" = "xyes"
1442 SAVE_CPPFLAGS="$CPPFLAGS"
1443 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1445 AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1447 CPPFLAGS="$SAVE_CPPFLAGS"
1449 if test "x$with_libmemcached" = "xyes"
1451 SAVE_CPPFLAGS="$CPPFLAGS"
1452 SAVE_LDFLAGS="$LDFLAGS"
1453 CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1454 LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1456 AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1458 CPPFLAGS="$SAVE_CPPFLAGS"
1459 LDFLAGS="$SAVE_LDFLAGS"
1461 if test "x$with_libmemcached" = "xyes"
1463 BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1464 BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1465 BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1466 AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1467 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1468 AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1469 AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1471 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1474 # --with-libmysql {{{
1475 with_mysql_config="mysql_config"
1476 with_mysql_cflags=""
1478 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1480 if test "x$withval" = "xno"
1483 else if test "x$withval" = "xyes"
1487 if test -f "$withval" && test -x "$withval";
1489 with_mysql_config="$withval"
1490 else if test -x "$withval/bin/mysql_config"
1492 with_mysql_config="$withval/bin/mysql_config"
1500 if test "x$with_libmysql" = "xyes"
1502 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1503 mysql_config_status=$?
1505 if test $mysql_config_status -ne 0
1507 with_libmysql="no ($with_mysql_config failed)"
1509 SAVE_CPPFLAGS="$CPPFLAGS"
1510 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1513 have_mysql_mysql_h="no"
1514 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1516 if test "x$have_mysql_h" = "xno"
1518 AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1521 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1523 with_libmysql="no (mysql.h not found)"
1526 CPPFLAGS="$SAVE_CPPFLAGS"
1529 if test "x$with_libmysql" = "xyes"
1531 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1532 mysql_config_status=$?
1534 if test $mysql_config_status -ne 0
1536 with_libmysql="no ($with_mysql_config failed)"
1538 AC_CHECK_LIB(mysqlclient, mysql_init,
1539 [with_libmysql="yes"],
1540 [with_libmysql="no (symbol 'mysql_init' not found)"],
1544 if test "x$with_libmysql" = "xyes"
1546 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1547 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1548 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1549 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1551 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1554 # --with-libnetlink {{{
1555 with_libnetlink_cflags=""
1556 with_libnetlink_libs="-lnetlink"
1557 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1559 echo "libnetlink: withval = $withval"
1560 if test "x$withval" = "xyes"
1562 with_libnetlink="yes"
1563 else if test "x$withval" = "xno"
1565 with_libnetlink="no"
1567 if test -d "$withval/include"
1569 with_libnetlink_cflags="-I$withval/include"
1570 with_libnetlink_libs="-L$withval/lib -lnetlink"
1571 with_libnetlink="yes"
1573 AC_MSG_ERROR("no such directory: $withval/include")
1578 if test "x$ac_system" = "xLinux"
1580 with_libnetlink="yes"
1582 with_libnetlink="no (Linux only library)"
1585 if test "x$with_libnetlink" = "xyes"
1588 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1590 with_libnetlink="no (libnetlink.h not found)"
1592 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1594 with_libnetlink="yes"
1598 #include <sys/types.h>
1599 #include <asm/types.h>
1600 #include <sys/socket.h>
1601 #include <linux/netlink.h>
1602 #include <linux/rtnetlink.h>])
1603 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1605 #include <sys/types.h>
1606 #include <asm/types.h>
1607 #include <sys/socket.h>])
1611 #include <sys/types.h>
1612 #include <asm/types.h>
1613 #include <sys/socket.h>
1614 #include <linux/netlink.h>
1615 #include <linux/rtnetlink.h>
1619 int retval = TCA_STATS2;
1622 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1627 #include <sys/types.h>
1628 #include <asm/types.h>
1629 #include <sys/socket.h>
1630 #include <linux/netlink.h>
1631 #include <linux/rtnetlink.h>
1635 int retval = TCA_STATS;
1638 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1641 CFLAGS="$SAVE_CFLAGS"
1643 if test "x$with_libnetlink" = "xyes"
1645 AC_CHECK_LIB(netlink, rtnl_open,
1646 [with_libnetlink="yes"],
1647 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1648 [$with_libnetlink_libs])
1650 if test "x$with_libnetlink" = "xyes"
1652 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1653 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1654 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1655 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1657 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1660 # --with-libnetsnmp {{{
1661 with_snmp_config="net-snmp-config"
1664 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1666 if test "x$withval" = "xno"
1668 with_libnetsnmp="no"
1669 else if test "x$withval" = "xyes"
1671 with_libnetsnmp="yes"
1673 if test -x "$withval"
1675 with_snmp_config="$withval"
1676 with_libnetsnmp="yes"
1678 with_snmp_config="$withval/bin/net-snmp-config"
1679 with_libnetsnmp="yes"
1683 [with_libnetsnmp="yes"])
1684 if test "x$with_libnetsnmp" = "xyes"
1686 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1687 snmp_config_status=$?
1689 if test $snmp_config_status -ne 0
1691 with_libnetsnmp="no ($with_snmp_config failed)"
1693 SAVE_CPPFLAGS="$CPPFLAGS"
1694 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1696 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1698 CPPFLAGS="$SAVE_CPPFLAGS"
1701 if test "x$with_libnetsnmp" = "xyes"
1703 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1704 snmp_config_status=$?
1706 if test $snmp_config_status -ne 0
1708 with_libnetsnmp="no ($with_snmp_config failed)"
1710 AC_CHECK_LIB(netsnmp, init_snmp,
1711 [with_libnetsnmp="yes"],
1712 [with_libnetsnmp="no (libnetsnmp not found)"],
1716 if test "x$with_libnetsnmp" = "xyes"
1718 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1719 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1720 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1721 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1723 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1726 # --with-liboconfig {{{
1727 with_own_liboconfig="no"
1728 liboconfig_LDFLAGS="$LDFLAGS"
1729 liboconfig_CPPFLAGS="$CPPFLAGS"
1730 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1732 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1734 if test -d "$withval/lib"
1736 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1738 if test -d "$withval/include"
1740 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1743 if test "x$withval" = "xno"
1745 AC_MSG_ERROR("liboconfig is required")
1749 with_liboconfig="yes"
1752 save_LDFLAGS="$LDFLAGS"
1753 save_CPPFLAGS="$CPPFLAGS"
1754 LDFLAGS="$liboconfig_LDFLAGS"
1755 CPPFLAGS="$liboconfig_CPPFLAGS"
1756 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1758 with_liboconfig="yes"
1759 with_own_liboconfig="no"
1762 with_liboconfig="yes"
1763 with_own_liboconfig="yes"
1764 LDFLAGS="$save_LDFLAGS"
1765 CPPFLAGS="$save_CPPFLAGS"
1768 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1769 if test "x$with_own_liboconfig" = "xyes"
1771 with_liboconfig="yes (shipped version)"
1775 # --with-liboping {{{
1776 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1778 if test "x$withval" = "xyes"
1781 else if test "x$withval" = "xno"
1786 LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
1787 LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
1790 [with_liboping="yes"])
1792 SAVE_CPPFLAGS="$CPPFLAGS"
1793 SAVE_LDFLAGS="$LDFLAGS"
1795 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
1796 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
1798 if test "x$with_liboping" = "xyes"
1800 if test "x$LIBOPING_CPPFLAGS" != "x"
1802 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
1804 AC_CHECK_HEADERS(oping.h,
1805 [with_liboping="yes"],
1806 [with_liboping="no ('oping.h' not found)"])
1808 if test "x$with_liboping" = "xyes"
1810 if test "x$LIBOPING_LDFLAGS" != "x"
1812 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
1814 AC_CHECK_LIB(oping, ping_construct,
1815 [with_liboping="yes"],
1816 [with_liboping="no (symbol 'ping_construct' not found)"])
1819 CPPFLAGS="$SAVE_CPPFLAGS"
1820 LDFLAGS="$SAVE_LDFLAGS"
1822 if test "x$with_liboping" = "xyes"
1824 BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
1825 BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
1826 AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
1827 AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
1829 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1833 with_oracle_cppflags=""
1835 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
1837 if test "x$withval" = "xyes"
1839 if test "x$ORACLE_HOME" = "x"
1841 AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
1844 else if test "x$withval" = "xno"
1849 ORACLE_HOME="$withval"
1853 if test "x$ORACLE_HOME" = "x"
1855 with_oracle="no (ORACLE_HOME is not set)"
1860 if test "x$ORACLE_HOME" != "x"
1862 with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
1864 if test -e "$ORACLE_HOME/lib/ldflags"
1866 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
1868 #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
1869 with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
1871 if test "x$with_oracle" = "xyes"
1873 SAVE_CPPFLAGS="$CPPFLAGS"
1874 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
1876 AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
1878 CPPFLAGS="$SAVE_CPPFLAGS"
1880 if test "x$with_oracle" = "xyes"
1882 SAVE_CPPFLAGS="$CPPFLAGS"
1883 SAVE_LDFLAGS="$LDFLAGS"
1884 CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
1885 LDFLAGS="$LDFLAGS $with_oracle_libs"
1887 AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
1889 CPPFLAGS="$SAVE_CPPFLAGS"
1890 LDFLAGS="$SAVE_LDFLAGS"
1892 if test "x$with_oracle" = "xyes"
1894 BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
1895 BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
1896 AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
1897 AC_SUBST(BUILD_WITH_ORACLE_LIBS)
1901 # --with-libowcapi {{{
1902 with_libowcapi_cppflags=""
1903 with_libowcapi_libs="-lowcapi"
1904 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
1906 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1908 with_libowcapi_cppflags="-I$withval/include"
1909 with_libowcapi_libs="-L$withval/lib -lowcapi"
1910 with_libowcapi="yes"
1912 with_libowcapi="$withval"
1916 with_libowcapi="yes"
1918 if test "x$with_libowcapi" = "xyes"
1920 SAVE_CPPFLAGS="$CPPFLAGS"
1921 CPPFLAGS="$with_libowcapi_cppflags"
1923 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
1925 CPPFLAGS="$SAVE_CPPFLAGS"
1927 if test "x$with_libowcapi" = "xyes"
1929 SAVE_LDFLAGS="$LDFLAGS"
1930 SAVE_CPPFLAGS="$CPPFLAGS"
1931 LDFLAGS="$with_libowcapi_libs"
1932 CPPFLAGS="$with_libowcapi_cppflags"
1934 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
1936 LDFLAGS="$SAVE_LDFLAGS"
1937 CPPFLAGS="$SAVE_CPPFLAGS"
1939 if test "x$with_libowcapi" = "xyes"
1941 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
1942 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
1943 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
1944 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
1948 # --with-libpcap {{{
1949 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1951 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1953 LDFLAGS="$LDFLAGS -L$withval/lib"
1954 CPPFLAGS="$CPPFLAGS -I$withval/include"
1957 with_libpcap="$withval"
1963 if test "x$with_libpcap" = "xyes"
1965 AC_CHECK_LIB(pcap, pcap_open_live,
1967 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1968 ], [with_libpcap="no (libpcap not found)"])
1970 if test "x$with_libpcap" = "xyes"
1972 AC_CHECK_HEADERS(pcap.h,
1974 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1975 ], [with_libpcap="no (pcap.h not found)"])
1977 if test "x$with_libpcap" = "xyes"
1983 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1984 [Wether or not to use the pcap library])
1985 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1988 # --with-libperl {{{
1989 perl_interpreter="perl"
1990 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1992 if test -x "$withval"
1994 perl_interpreter="$withval"
1996 else if test "x$withval" != "xno" && test "x$withval" != "xyes"
1998 LDFLAGS="$LDFLAGS -L$withval/lib"
1999 CPPFLAGS="$CPPFLAGS -I$withval/include"
2000 perl_interpreter="$withval/bin/perl"
2003 with_libperl="$withval"
2010 AC_MSG_CHECKING([for perl])
2011 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2012 if test -x "$perl_interpreter"
2014 AC_MSG_RESULT([yes ($perl_interpreter)])
2020 AC_SUBST(PERL, "$perl_interpreter")
2022 if test "x$with_libperl" = "xyes" \
2023 && test -n "$perl_interpreter"
2026 SAVE_LDFLAGS=$LDFLAGS
2027 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
2028 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
2029 CFLAGS="$CFLAGS $PERL_CFLAGS"
2030 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2032 AC_CACHE_CHECK([for libperl],
2033 [c_cv_have_libperl],
2037 #define PERL_NO_GET_CONTEXT
2044 load_module (PERL_LOADMOD_NOIMPORT,
2045 newSVpv ("Collectd::Plugin::FooBar", 24),
2048 [c_cv_have_libperl="yes"],
2049 [c_cv_have_libperl="no"]
2053 if test "x$c_cv_have_libperl" = "xyes"
2055 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2056 AC_SUBST(PERL_CFLAGS)
2057 AC_SUBST(PERL_LDFLAGS)
2063 LDFLAGS=$SAVE_LDFLAGS
2064 else if test -z "$perl_interpreter"; then
2065 with_libperl="no (no perl interpreter found)"
2066 c_cv_have_libperl="no"
2068 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2070 if test "x$with_libperl" = "xyes"
2073 SAVE_LDFLAGS=$LDFLAGS
2074 CFLAGS="$CFLAGS $PERL_CFLAGS"
2075 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2077 AC_CACHE_CHECK([if perl supports ithreads],
2078 [c_cv_have_perl_ithreads],
2086 #if !defined(USE_ITHREADS)
2087 # error "Perl does not support ithreads!"
2088 #endif /* !defined(USE_ITHREADS) */
2091 [c_cv_have_perl_ithreads="yes"],
2092 [c_cv_have_perl_ithreads="no"]
2096 if test "x$c_cv_have_perl_ithreads" = "xyes"
2098 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2102 LDFLAGS=$SAVE_LDFLAGS
2105 c_cv_have_broken_perl_load_module="no"
2106 if test "x$with_libperl" = "xyes"
2109 SAVE_LDFLAGS=$LDFLAGS
2110 # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2111 # (see issues #41 and #42)
2112 CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2113 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2115 AC_CACHE_CHECK([for broken Perl_load_module()],
2116 [c_cv_have_broken_perl_load_module],
2120 #define PERL_NO_GET_CONTEXT
2127 load_module (PERL_LOADMOD_NOIMPORT,
2128 newSVpv ("Collectd::Plugin::FooBar", 24),
2131 [c_cv_have_broken_perl_load_module="no"],
2132 [c_cv_have_broken_perl_load_module="yes"]
2137 LDFLAGS=$SAVE_LDFLAGS
2139 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2140 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2142 if test "x$with_libperl" = "xyes"
2145 SAVE_LDFLAGS=$LDFLAGS
2146 CFLAGS="$CFLAGS $PERL_CFLAGS"
2147 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2150 [struct mgvtbl.svt_local],
2151 [have_struct_mgvtbl_svt_local="yes"],
2152 [have_struct_mgvtbl_svt_local="no"],
2159 if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2161 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2162 [Define if Perl's struct mgvtbl has member svt_local.])
2166 LDFLAGS=$SAVE_LDFLAGS
2171 with_pg_config="pg_config"
2172 with_libpq_includedir=""
2173 with_libpq_libdir=""
2174 with_libpq_cppflags=""
2175 with_libpq_ldflags=""
2176 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2179 if test "x$withval" = "xno"
2182 else if test "x$withval" = "xyes"
2186 if test -f "$withval" && test -x "$withval";
2188 with_pg_config="$withval"
2189 else if test -x "$withval/bin/pg_config"
2191 with_pg_config="$withval/bin/pg_config"
2199 if test "x$with_libpq" = "xyes"
2201 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2204 if test $pg_config_status -eq 0
2206 if test -n "$with_libpq_includedir"; then
2207 for dir in $with_libpq_includedir; do
2208 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2212 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2215 SAVE_CPPFLAGS="$CPPFLAGS"
2216 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2218 AC_CHECK_HEADERS(libpq-fe.h, [],
2219 [with_libpq="no (libpq-fe.h not found)"], [])
2221 CPPFLAGS="$SAVE_CPPFLAGS"
2223 if test "x$with_libpq" = "xyes"
2225 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2228 if test $pg_config_status -eq 0
2230 if test -n "$with_libpq_libdir"; then
2231 for dir in $with_libpq_libdir; do
2232 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2236 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2239 SAVE_LDFLAGS="$LDFLAGS"
2240 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2242 AC_CHECK_LIB(pq, PQconnectdb,
2244 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2246 LDFLAGS="$SAVE_LDFLAGS"
2248 if test "x$with_libpq" = "xyes"
2250 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2251 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2252 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2253 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2255 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2258 # --with-libpthread {{{
2259 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2260 [ if test "x$withval" != "xno" \
2261 && test "x$withval" != "xyes"
2263 LDFLAGS="$LDFLAGS -L$withval/lib"
2264 CPPFLAGS="$CPPFLAGS -I$withval/include"
2265 with_libpthread="yes"
2267 if test "x$withval" = "xno"
2269 with_libpthread="no (disabled)"
2272 ], [with_libpthread="yes"])
2273 if test "x$with_libpthread" = "xyes"
2275 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2278 if test "x$with_libpthread" = "xyes"
2280 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2282 if test "x$with_libpthread" = "xyes"
2288 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2289 [Wether or not to use pthread (POSIX threads) library])
2290 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2294 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
2297 librrd_threadsafe="yes"
2298 librrd_rrdc_update="no"
2299 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
2300 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
2302 librrd_cflags="-I$withval/include"
2303 librrd_ldflags="-L$withval/lib"
2306 with_librrd="$withval"
2308 ], [with_librrd="yes"])
2309 if test "x$with_librrd" = "xyes"
2311 SAVE_CPPFLAGS="$CPPFLAGS"
2312 SAVE_LDFLAGS="$LDFLAGS"
2314 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2315 LDFLAGS="$LDFLAGS $librrd_ldflags"
2317 AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
2319 CPPFLAGS="$SAVE_CPPFLAGS"
2320 LDFLAGS="$SAVE_LDFLAGS"
2322 if test "x$with_librrd" = "xyes"
2324 SAVE_CPPFLAGS="$CPPFLAGS"
2325 SAVE_LDFLAGS="$LDFLAGS"
2327 CPPFLAGS="$CPPFLAGS $librrd_cflags"
2328 LDFLAGS="$LDFLAGS $librrd_ldflags"
2330 AC_CHECK_LIB(rrd_th, rrd_update_r,
2332 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
2334 [librrd_threadsafe="no"
2335 AC_CHECK_LIB(rrd, rrd_update,
2337 librrd_ldflags="$librrd_ldflags -lrrd -lm"
2339 [with_librrd="no (symbol 'rrd_update' not found)"],
2344 if test "x$librrd_threadsafe" = "xyes"
2346 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2348 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2351 CPPFLAGS="$SAVE_CPPFLAGS"
2352 LDFLAGS="$SAVE_LDFLAGS"
2354 if test "x$with_librrd" = "xyes"
2356 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
2357 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
2358 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
2359 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
2361 if test "x$librrd_threadsafe" = "xyes"
2363 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
2367 # --with-libsensors {{{
2368 with_sensors_cflags=""
2369 with_sensors_ldflags=""
2370 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
2372 if test "x$withval" = "xno"
2374 with_libsensors="no"
2376 with_libsensors="yes"
2377 if test "x$withval" != "xyes"
2379 with_sensors_cflags="-I$withval/include"
2380 with_sensors_ldflags="-L$withval/lib"
2381 with_libsensors="yes"
2386 if test "x$ac_system" = "xLinux"
2388 with_libsensors="yes"
2390 with_libsensors="no (Linux only library)"
2393 if test "x$with_libsensors" = "xyes"
2395 SAVE_CPPFLAGS="$CPPFLAGS"
2396 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2398 # AC_CHECK_HEADERS(sensors/sensors.h,
2400 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
2402 # [with_libsensors="no (sensors/sensors.h not found)"])
2403 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
2405 CPPFLAGS="$SAVE_CPPFLAGS"
2407 if test "x$with_libsensors" = "xyes"
2409 SAVE_CPPFLAGS="$CPPFLAGS"
2410 SAVE_LDFLAGS="$LDFLAGS"
2411 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2412 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
2414 AC_CHECK_LIB(sensors, sensors_init,
2416 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
2418 [with_libsensors="no (libsensors not found)"])
2420 CPPFLAGS="$SAVE_CPPFLAGS"
2421 LDFLAGS="$SAVE_LDFLAGS"
2423 if test "x$with_libsensors" = "xyes"
2425 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
2426 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
2427 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
2428 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
2430 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
2433 # --with-libstatgrab {{{
2434 with_libstatgrab_cflags=""
2435 with_libstatgrab_ldflags=""
2436 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
2438 if test "x$withval" != "xno" \
2439 && test "x$withval" != "xyes"
2441 with_libstatgrab_cflags="-I$withval/include"
2442 with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
2443 with_libstatgrab="yes"
2444 with_libstatgrab_pkg_config="no"
2446 with_libstatgrab="$withval"
2447 with_libstatgrab_pkg_config="yes"
2451 with_libstatgrab="yes"
2452 with_libstatgrab_pkg_config="yes"
2455 if test "x$with_libstatgrab" = "xyes" \
2456 && test "x$with_libstatgrab_pkg_config" = "xyes"
2458 if test "x$PKG_CONFIG" != "x"
2460 AC_MSG_CHECKING([pkg-config for libstatgrab])
2462 $PKG_CONFIG --exists libstatgrab 2>/dev/null
2465 with_libstatgrab_pkg_config="no"
2466 with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
2467 temp_result="not found"
2469 AC_MSG_RESULT([$temp_result])
2471 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
2472 with_libstatgrab_pkg_config="no"
2473 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
2477 if test "x$with_libstatgrab" = "xyes" \
2478 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2479 && test "x$with_libstatgrab_cflags" = "x"
2481 AC_MSG_CHECKING([for libstatgrab CFLAGS])
2482 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
2485 with_libstatgrab_cflags="$temp_result"
2487 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
2488 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
2490 AC_MSG_RESULT([$temp_result])
2493 if test "x$with_libstatgrab" = "xyes" \
2494 && test "x$with_libstatgrab_pkg_config" = "xyes" \
2495 && test "x$with_libstatgrab_ldflags" = "x"
2497 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
2498 temp_result="`$PKG_CONFIG --libs libstatgrab`"
2501 with_libstatgrab_ldflags="$temp_result"
2503 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
2504 temp_result="$PKG_CONFIG --libs libstatgrab failed"
2506 AC_MSG_RESULT([$temp_result])
2509 if test "x$with_libstatgrab" = "xyes"
2511 SAVE_CPPFLAGS="$CPPFLAGS"
2512 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
2514 AC_CHECK_HEADERS(statgrab.h,
2515 [with_libstatgrab="yes"],
2516 [with_libstatgrab="no (statgrab.h not found)"])
2518 CPPFLAGS="$SAVE_CPPFLAGS"
2521 if test "x$with_libstatgrab" = "xyes"
2523 SAVE_CFLAGS="$CFLAGS"
2524 SAVE_LDFLAGS="$LDFLAGS"
2526 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
2527 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
2529 AC_CHECK_LIB(statgrab, sg_init,
2530 [with_libstatgrab="yes"],
2531 [with_libstatgrab="no (symbol sg_init not found)"])
2533 CFLAGS="$SAVE_CFLAGS"
2534 LDFLAGS="$SAVE_LDFLAGS"
2537 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
2538 if test "x$with_libstatgrab" = "xyes"
2540 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
2541 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
2542 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
2543 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
2544 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
2548 # --with-libupsclient {{{
2549 with_libupsclient_config=""
2550 with_libupsclient_cflags=""
2551 with_libupsclient_libs=""
2552 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2554 if test "x$withval" = "xno"
2556 with_libupsclient="no"
2557 else if test "x$withval" = "xyes"
2559 with_libupsclient="use_pkgconfig"
2561 if test -x "$withval"
2563 with_libupsclient_config="$withval"
2564 with_libupsclient="use_libupsclient_config"
2565 else if test -x "$withval/bin/libupsclient-config"
2567 with_libupsclient_config="$withval/bin/net-snmp-config"
2568 with_libupsclient="use_libupsclient_config"
2570 AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
2571 with_libupsclient_cflags="-I$withval/include"
2572 with_libupsclient_libs="-L$withval/lib -lupsclient"
2573 with_libupsclient="yes"
2577 [with_libupsclient="use_pkgconfig"])
2579 # configure using libupsclient-config
2580 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2582 AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
2583 with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
2586 with_libupsclient="no ($with_libupsclient_config failed)"
2588 with_libupsclient_libs="`$with_libupsclient_config --libs`"
2591 with_libupsclient="no ($with_libupsclient_config failed)"
2594 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2596 with_libupsclient="yes"
2599 # configure using pkg-config
2600 if test "x$with_libupsclient" = "xuse_pkgconfig"
2602 if test "x$PKG_CONFIG" = "x"
2604 with_libupsclient="no (Don't have pkg-config)"
2607 if test "x$with_libupsclient" = "xuse_pkgconfig"
2609 AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
2610 $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
2613 with_libupsclient="no (pkg-config doesn't know library)"
2616 if test "x$with_libupsclient" = "xuse_pkgconfig"
2618 with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
2621 with_libupsclient="no ($PKG_CONFIG failed)"
2623 with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
2626 with_libupsclient="no ($PKG_CONFIG failed)"
2629 if test "x$with_libupsclient" = "xuse_pkgconfig"
2631 with_libupsclient="yes"
2634 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
2635 # the actual checks.
2636 if test "x$with_libupsclient" = "xyes"
2638 SAVE_CPPFLAGS="$CPPFLAGS"
2639 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2641 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
2643 CPPFLAGS="$SAVE_CPPFLAGS"
2645 if test "x$with_libupsclient" = "xyes"
2647 SAVE_CPPFLAGS="$CPPFLAGS"
2648 SAVE_LDFLAGS="$LDFLAGS"
2650 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2651 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
2653 AC_CHECK_LIB(upsclient, upscli_connect,
2654 [with_libupsclient="yes"],
2655 [with_libupsclient="no (symbol upscli_connect not found)"])
2657 CPPFLAGS="$SAVE_CPPFLAGS"
2658 LDFLAGS="$SAVE_LDFLAGS"
2660 if test "x$with_libupsclient" = "xyes"
2662 SAVE_CPPFLAGS="$CPPFLAGS"
2663 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2665 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
2666 [#include <stdlib.h>
2668 #include <upsclient.h>])
2670 CPPFLAGS="$SAVE_CPPFLAGS"
2672 if test "x$with_libupsclient" = "xyes"
2674 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
2675 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
2676 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
2677 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
2681 # --with-libxmms {{{
2682 with_xmms_config="xmms-config"
2685 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
2687 if test "x$withval" != "xno" \
2688 && test "x$withval" != "xyes"
2690 if test -f "$withval" && test -x "$withval";
2692 with_xmms_config="$withval"
2693 else if test -x "$withval/bin/xmms-config"
2695 with_xmms_config="$withval/bin/xmms-config"
2698 else if test "x$withval" = "xno"
2708 if test "x$with_libxmms" = "xyes"
2710 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
2711 xmms_config_status=$?
2713 if test $xmms_config_status -ne 0
2718 if test "x$with_libxmms" = "xyes"
2720 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
2721 xmms_config_status=$?
2723 if test $xmms_config_status -ne 0
2728 if test "x$with_libxmms" = "xyes"
2730 AC_CHECK_LIB(xmms, xmms_remote_get_info,
2732 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
2733 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
2734 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
2735 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
2742 with_libxmms_numeric=0
2743 if test "x$with_libxmms" = "xyes"
2745 with_libxmms_numeric=1
2747 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
2748 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
2751 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
2752 with_libxml2="no (pkg-config isn't available)"
2753 with_libxml2_cflags=""
2754 with_libxml2_ldflags=""
2755 with_libvirt="no (pkg-config isn't available)"
2756 with_libvirt_cflags=""
2757 with_libvirt_ldflags=""
2758 if test "x$PKG_CONFIG" != "x"
2760 pkg-config --exists 'libxml-2.0' 2>/dev/null
2765 with_libxml2="no (pkg-config doesn't know library)"
2768 pkg-config --exists libvirt 2>/dev/null
2773 with_libvirt="no (pkg-config doesn't know library)"
2776 if test "x$with_libxml2" = "xyes"
2778 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2783 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2789 if test "x$with_libxml2" = "xyes"
2791 SAVE_CPPFLAGS="$CPPFLAGS"
2792 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2794 AC_CHECK_HEADERS(libxml/parser.h, [],
2795 [with_libxml2="no (libxml/parser.h not found)"])
2797 CPPFLAGS="$SAVE_CPPFLAGS"
2799 if test "x$with_libxml2" = "xyes"
2801 SAVE_CFLAGS="$CFLAGS"
2802 SAVE_LDFLAGS="$LDFLAGS"
2804 CFLAGS="$CFLAGS $with_libxml2_cflags"
2805 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2807 AC_CHECK_LIB(xml2, xmlXPathEval,
2808 [with_libxml2="yes"],
2809 [with_libxml2="no (symbol xmlXPathEval not found)"])
2811 CFLAGS="$SAVE_CFLAGS"
2812 LDFLAGS="$SAVE_LDFLAGS"
2814 dnl Add the right compiler flags and libraries.
2815 if test "x$with_libxml2" = "xyes"; then
2816 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2817 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2818 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2819 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2821 if test "x$with_libvirt" = "xyes"
2823 with_libvirt_cflags="`pkg-config --cflags libvirt`"
2828 with_libvirt_ldflags="`pkg-config --libs libvirt`"
2834 if test "x$with_libvirt" = "xyes"
2836 SAVE_CPPFLAGS="$CPPFLAGS"
2837 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2839 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2840 [with_libvirt="no (libvirt/libvirt.h not found)"])
2842 CPPFLAGS="$SAVE_CPPFLAGS"
2844 if test "x$with_libvirt" = "xyes"
2846 SAVE_CFLAGS="$CFLAGS"
2847 SAVE_LDFLAGS="$LDFLAGS"
2849 CFLAGS="$CFLAGS $with_libvirt_cflags"
2850 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2852 AC_CHECK_LIB(virt, virDomainBlockStats,
2853 [with_libvirt="yes"],
2854 [with_libvirt="no (symbol virDomainBlockStats not found)"])
2856 CFLAGS="$SAVE_CFLAGS"
2857 LDFLAGS="$SAVE_LDFLAGS"
2859 dnl Add the right compiler flags and libraries.
2860 if test "x$with_libvirt" = "xyes"; then
2861 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2862 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2863 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2864 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2868 # $PKG_CONFIG --exists OpenIPMIpthread {{{
2869 with_libopenipmipthread="yes"
2870 with_libopenipmipthread_cflags=""
2871 with_libopenipmipthread_libs=""
2873 AC_MSG_CHECKING([for pkg-config])
2875 if test "x$PKG_CONFIG" = "x"
2877 with_libopenipmipthread="no"
2880 temp_result="$PKG_CONFIG"
2882 AC_MSG_RESULT([$temp_result])
2884 if test "x$with_libopenipmipthread" = "xyes"
2886 AC_MSG_CHECKING([for libOpenIPMIpthread])
2887 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2890 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2892 AC_MSG_RESULT([$with_libopenipmipthread])
2895 if test "x$with_libopenipmipthread" = "xyes"
2897 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2898 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2901 with_libopenipmipthread_cflags="$temp_result"
2903 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2904 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2906 AC_MSG_RESULT([$temp_result])
2909 if test "x$with_libopenipmipthread" = "xyes"
2911 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2912 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2915 with_libopenipmipthread_ldflags="$temp_result"
2917 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2918 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2920 AC_MSG_RESULT([$temp_result])
2923 if test "x$with_libopenipmipthread" = "xyes"
2925 SAVE_CPPFLAGS="$CPPFLAGS"
2926 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2928 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2929 [with_libopenipmipthread="yes"],
2930 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2931 [#include <OpenIPMI/ipmiif.h>
2932 #include <OpenIPMI/ipmi_err.h>
2933 #include <OpenIPMI/ipmi_posix.h>
2934 #include <OpenIPMI/ipmi_conn.h>
2937 CPPFLAGS="$SAVE_CPPFLAGS"
2940 if test "x$with_libopenipmipthread" = "xyes"
2942 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2943 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2944 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2945 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2949 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
2950 [with_libnotify="yes"],
2951 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
2953 # Check for enabled/disabled features
2956 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2957 # ------------------------------------------------------------
2959 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2964 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2969 m4_define([EnDis],[disabled])dnl
2970 m4_define([YesNo],[no])dnl
2976 m4_define([EnDis],[enabled])dnl
2977 m4_define([YesNo],[yes])dnl
2980 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2984 m4_if([$3], [feature], [],
2988 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2994 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2996 enable_$1='[YesNo]'dnl
2998 if test "x$enable_$1" = "xno"
3002 if test "x$enable_$1" = "xyes"
3006 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3011 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3012 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3014 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3016 # AC_PLUGIN(name, default, info)
3017 # ------------------------------------------------------------
3023 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3025 if test "x$enableval" = "xyes"
3033 if test "x$2" = "xyes"
3040 if test "x$enable_plugin" = "xyes"
3042 if test "x$2" = "xyes"
3044 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3045 else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3046 dependency_error="yes"
3047 enable_plugin="no (dependency error)"
3050 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3051 enable_$1="$enable_plugin"
3053 )# AC_PLUGIN(name, default, info)
3055 m4_divert_once([HELP_ENABLE], [
3056 collectd features:])
3057 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3058 AC_COLLECTD([debug], [enable], [feature], [debugging])
3059 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
3060 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
3062 dependency_error="no"
3071 plugin_interface="no"
3078 plugin_multimeter="no"
3081 plugin_processes="no"
3082 plugin_protocols="no"
3086 plugin_tcpconns="no"
3093 plugin_wireless="no"
3096 if test "x$ac_system" = "xLinux"
3098 plugin_battery="yes"
3100 plugin_cpufreq="yes"
3102 plugin_entropy="yes"
3103 plugin_interface="yes"
3108 plugin_processes="yes"
3109 plugin_protocols="yes"
3112 plugin_tcpconns="yes"
3113 plugin_thermal="yes"
3116 plugin_vserver="yes"
3117 plugin_wireless="yes"
3119 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
3125 if test "x$ac_system" = "xOpenBSD"
3127 plugin_tcpconns="yes"
3131 if test "x$with_libiokit" = "xyes"
3133 plugin_battery="yes"
3138 if test "x$with_kstat" = "xyes"
3143 if test "x$with_devinfo$with_kstat" = "xyesyes"
3147 plugin_interface="yes"
3152 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
3158 if test "x$with_libstatgrab" = "xyes"
3162 plugin_interface="yes"
3169 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
3175 if test "x$with_libopenipmipthread" = "xyes"
3180 if test "x$have_processor_info" = "xyes"
3184 if test "x$have_sysctl" = "xyes"
3190 if test "x$have_sysctlbyname" = "xyes"
3194 plugin_tcpconns="yes"
3197 if test "x$have_statfs" = "xyes"
3201 if test "x$have_statvfs" = "xyes"
3206 if test "x$have_getifaddrs" = "xyes"
3208 plugin_interface="yes"
3211 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
3213 plugin_libvirt="yes"
3216 if test "x$have_getloadavg" = "xyes"
3221 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
3226 # Mac OS X memory interface
3227 if test "x$have_host_statistics" = "xyes"
3232 if test "x$have_termios_h" = "xyes"
3234 plugin_multimeter="yes"
3238 if test "x$have_thread_info" = "xyes"
3240 plugin_processes="yes"
3243 if test "x$with_kvm_getprocs" = "xyes"
3245 plugin_processes="yes"
3248 if test "x$with_kvm_getswapinfo" = "xyes"
3253 if test "x$have_swapctl" = "xyes"
3258 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
3260 plugin_tcpconns="yes"
3263 if test "x$have_getutent" = "xyes"
3267 if test "x$have_getutxent" = "xyes"
3272 m4_divert_once([HELP_ENABLE], [
3275 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
3276 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
3277 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
3278 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
3279 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
3280 AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics])
3281 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
3282 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
3283 AC_PLUGIN([csv], [yes], [CSV output plugin])
3284 AC_PLUGIN([curl], [$with_libcurl], [CURL generic web statistics])
3285 AC_PLUGIN([dbi], [$with_libdbi], [General database statistics])
3286 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
3287 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
3288 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
3289 AC_PLUGIN([email], [yes], [EMail statistics])
3290 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
3291 AC_PLUGIN([exec], [yes], [Execution of external programs])
3292 AC_PLUGIN([filecount], [yes], [Count files in directories])
3293 AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
3294 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
3295 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
3296 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
3297 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
3298 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
3299 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
3300 AC_PLUGIN([java], [$with_java], [Embed the Java Virtual Machine])
3301 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
3302 AC_PLUGIN([load], [$plugin_load], [System load])
3303 AC_PLUGIN([logfile], [yes], [File logging plugin])
3304 AC_PLUGIN([match_regex], [yes], [The regex match])
3305 AC_PLUGIN([match_timediff], [yes], [The timediff match])
3306 AC_PLUGIN([match_value], [yes], [The value match])
3307 AC_PLUGIN([mbmon], [yes], [Query mbmond])
3308 AC_PLUGIN([memcachec], [$with_libmemcached], [memcachec statistics])
3309 AC_PLUGIN([memcached], [yes], [memcached statistics])
3310 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
3311 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
3312 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
3313 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
3314 AC_PLUGIN([network], [yes], [Network communication plugin])
3315 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
3316 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
3317 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
3318 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
3319 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
3320 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
3321 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
3322 AC_PLUGIN([openvpn], [yes], [OpenVPN client statistics])
3323 AC_PLUGIN([oracle], [$with_oracle], [Oracle plugin])
3324 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
3325 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
3326 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
3327 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
3328 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
3329 AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics])
3330 AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin])
3331 AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin])
3332 AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics])
3333 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
3334 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
3335 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
3336 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
3337 AC_PLUGIN([table], [yes], [Parsing of tabular data])
3338 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
3339 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
3340 AC_PLUGIN([target_notification], [yes], [The notification target])
3341 AC_PLUGIN([target_replace], [yes], [The replace target])
3342 AC_PLUGIN([target_set], [yes], [The set target])
3343 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
3344 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
3345 AC_PLUGIN([ted], [$plugin_ted], [Read The Energy Detective values])
3346 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
3347 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
3348 AC_PLUGIN([uptime], [$plugin_uptime], [Uptime statistics])
3349 AC_PLUGIN([users], [$plugin_users], [User statistics])
3350 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
3351 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
3352 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
3353 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
3354 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
3356 dnl Default configuration file
3357 # Load either syslog or logfile
3358 LOAD_PLUGIN_SYSLOG=""
3359 LOAD_PLUGIN_LOGFILE=""
3361 AC_MSG_CHECKING([which default log plugin to load])
3362 default_log_plugin="none"
3363 if test "x$enable_syslog" = "xyes"
3365 default_log_plugin="syslog"
3367 LOAD_PLUGIN_SYSLOG="##"
3370 if test "x$enable_logfile" = "xyes"
3372 if test "x$default_log_plugin" = "xnone"
3374 default_log_plugin="logfile"
3376 LOAD_PLUGIN_LOGFILE="#"
3379 LOAD_PLUGIN_LOGFILE="##"
3381 AC_MSG_RESULT([$default_log_plugin])
3383 AC_SUBST(LOAD_PLUGIN_SYSLOG)
3384 AC_SUBST(LOAD_PLUGIN_LOGFILE)
3386 DEFAULT_LOG_LEVEL="info"
3387 if test "x$enable_debug" = "xyes"
3389 DEFAULT_LOG_LEVEL="debug"
3391 AC_SUBST(DEFAULT_LOG_LEVEL)
3393 # Load only one of rrdtool, network, csv in the default config.
3394 LOAD_PLUGIN_RRDTOOL=""
3395 LOAD_PLUGIN_NETWORK=""
3398 AC_MSG_CHECKING([which default write plugin to load])
3399 default_write_plugin="none"
3400 if test "x$enable_rrdtool" = "xyes"
3402 default_write_plugin="rrdtool"
3404 LOAD_PLUGIN_RRDTOOL="##"
3407 if test "x$enable_network" = "xyes"
3409 if test "x$default_write_plugin" = "xnone"
3411 default_write_plugin="network"
3413 LOAD_PLUGIN_NETWORK="#"
3416 LOAD_PLUGIN_NETWORK="##"
3419 if test "x$enable_csv" = "xyes"
3421 if test "x$default_write_plugin" = "xnone"
3423 default_write_plugin="csv"
3428 LOAD_PLUGIN_CSV="##"
3430 AC_MSG_RESULT([$default_write_plugin])
3432 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
3433 AC_SUBST(LOAD_PLUGIN_NETWORK)
3434 AC_SUBST(LOAD_PLUGIN_CSV)
3437 if test "x$ac_system" = "xLinux" \
3438 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
3440 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
3444 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
3446 if test "x$withval" != "xno" && test "x$withval" != "xyes"
3448 PERL_BINDINGS_OPTIONS="$withval"
3449 with_perl_bindings="yes"
3451 PERL_BINDINGS_OPTIONS=""
3452 with_perl_bindings="$withval"
3456 PERL_BINDINGS_OPTIONS=""
3457 if test -n "$perl_interpreter"
3459 with_perl_bindings="yes"
3461 with_perl_bindings="no (no perl interpreter found)"
3464 if test "x$with_perl_bindings" = "xyes"
3466 PERL_BINDINGS="perl"
3470 AC_SUBST(PERL_BINDINGS)
3471 AC_SUBST(PERL_BINDINGS_OPTIONS)
3473 dnl libcollectdclient
3474 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
3475 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
3476 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
3478 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
3480 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
3482 AC_SUBST(LCC_VERSION_MAJOR)
3483 AC_SUBST(LCC_VERSION_MINOR)
3484 AC_SUBST(LCC_VERSION_PATCH)
3485 AC_SUBST(LCC_VERSION_EXTRA)
3486 AC_SUBST(LCC_VERSION_STRING)
3488 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
3490 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile)
3492 if test "x$with_librrd" = "xyes" \
3493 && test "x$librrd_threadsafe" != "xyes"
3495 with_librrd="yes (warning: librrd is not thread-safe)"
3498 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
3500 with_libiptc="yes (shipped version)"
3503 if test "x$with_libperl" = "xyes"
3505 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
3507 enable_perl="no (needs libperl)"
3510 if test "x$with_perl_bindings" = "xyes" \
3511 && test "x$PERL_BINDINGS_OPTIONS" != "x"
3513 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
3520 libcurl . . . . . . . $with_libcurl
3521 libdbi . . . . . . . $with_libdbi
3522 libesmtp . . . . . . $with_libesmtp
3523 libiokit . . . . . . $with_libiokit
3524 libiptc . . . . . . . $with_libiptc
3525 libjvm . . . . . . . $with_java
3526 libkstat . . . . . . $with_kstat
3527 libkvm . . . . . . . $with_libkvm
3528 libmysql . . . . . . $with_libmysql
3529 libnetlink . . . . . $with_libnetlink
3530 libnetsnmp . . . . . $with_libnetsnmp
3531 libnotify . . . . . . $with_libnotify
3532 liboconfig . . . . . $with_liboconfig
3533 libopenipmi . . . . . $with_libopenipmipthread
3534 liboping . . . . . . $with_liboping
3535 libpcap . . . . . . . $with_libpcap
3536 libperl . . . . . . . $with_libperl
3537 libpq . . . . . . . . $with_libpq
3538 libpthread . . . . . $with_libpthread
3539 librrd . . . . . . . $with_librrd
3540 libsensors . . . . . $with_libsensors
3541 libstatgrab . . . . . $with_libstatgrab
3542 libupsclient . . . . $with_libupsclient
3543 libvirt . . . . . . . $with_libvirt
3544 libxml2 . . . . . . . $with_libxml2
3545 libxmms . . . . . . . $with_libxmms
3546 oracle . . . . . . . $with_oracle
3549 daemon mode . . . . . $enable_daemon
3550 debug . . . . . . . . $enable_debug
3553 perl . . . . . . . . $with_perl_bindings
3556 apache . . . . . . . $enable_apache
3557 apcups . . . . . . . $enable_apcups
3558 apple_sensors . . . . $enable_apple_sensors
3559 ascent . . . . . . . $enable_ascent
3560 battery . . . . . . . $enable_battery
3561 bind . . . . . . . . $enable_bind
3562 cpu . . . . . . . . . $enable_cpu
3563 cpufreq . . . . . . . $enable_cpufreq
3564 csv . . . . . . . . . $enable_csv
3565 curl . . . . . . . . $enable_curl
3566 dbi . . . . . . . . . $enable_dbi
3567 df . . . . . . . . . $enable_df
3568 disk . . . . . . . . $enable_disk
3569 dns . . . . . . . . . $enable_dns
3570 email . . . . . . . . $enable_email
3571 entropy . . . . . . . $enable_entropy
3572 exec . . . . . . . . $enable_exec
3573 filecount . . . . . . $enable_filecount
3574 gmond . . . . . . . . $enable_gmond
3575 hddtemp . . . . . . . $enable_hddtemp
3576 interface . . . . . . $enable_interface
3577 ipmi . . . . . . . . $enable_ipmi
3578 iptables . . . . . . $enable_iptables
3579 ipvs . . . . . . . . $enable_ipvs
3580 irq . . . . . . . . . $enable_irq
3581 java . . . . . . . . $enable_java
3582 libvirt . . . . . . . $enable_libvirt
3583 load . . . . . . . . $enable_load
3584 logfile . . . . . . . $enable_logfile
3585 match_regex . . . . . $enable_match_regex
3586 match_timediff . . . $enable_match_timediff
3587 match_value . . . . . $enable_match_value
3588 mbmon . . . . . . . . $enable_mbmon
3589 memcachec . . . . . . $enable_memcachec
3590 memcached . . . . . . $enable_memcached
3591 memory . . . . . . . $enable_memory
3592 multimeter . . . . . $enable_multimeter
3593 mysql . . . . . . . . $enable_mysql
3594 netlink . . . . . . . $enable_netlink
3595 network . . . . . . . $enable_network
3596 nfs . . . . . . . . . $enable_nfs
3597 nginx . . . . . . . . $enable_nginx
3598 notify_desktop . . . $enable_notify_desktop
3599 notify_email . . . . $enable_notify_email
3600 ntpd . . . . . . . . $enable_ntpd
3601 nut . . . . . . . . . $enable_nut
3602 onewire . . . . . . . $enable_onewire
3603 openvpn . . . . . . . $enable_openvpn
3604 oracle . . . . . . . $enable_oracle
3605 perl . . . . . . . . $enable_perl
3606 ping . . . . . . . . $enable_ping
3607 postgresql . . . . . $enable_postgresql
3608 powerdns . . . . . . $enable_powerdns
3609 processes . . . . . . $enable_processes
3610 protocols . . . . . . $enable_protocols
3611 rrdcached . . . . . . $enable_rrdcached
3612 rrdtool . . . . . . . $enable_rrdtool
3613 sensors . . . . . . . $enable_sensors
3614 serial . . . . . . . $enable_serial
3615 snmp . . . . . . . . $enable_snmp
3616 swap . . . . . . . . $enable_swap
3617 syslog . . . . . . . $enable_syslog
3618 table . . . . . . . . $enable_table
3619 tail . . . . . . . . $enable_tail
3620 tape . . . . . . . . $enable_tape
3621 target_notification . $enable_target_notification
3622 target_replace . . . $enable_target_replace
3623 target_set . . . . . $enable_target_set
3624 tcpconns . . . . . . $enable_tcpconns
3625 teamspeak2 . . . . . $enable_teamspeak2
3626 ted . . . . . . . . . $enable_ted
3627 thermal . . . . . . . $enable_thermal
3628 unixsock . . . . . . $enable_unixsock
3629 uptime . . . . . . . $enable_uptime
3630 users . . . . . . . . $enable_users
3631 uuid . . . . . . . . $enable_uuid
3632 vmem . . . . . . . . $enable_vmem
3633 vserver . . . . . . . $enable_vserver
3634 wireless . . . . . . $enable_wireless
3635 xmms . . . . . . . . $enable_xmms
3639 if test "x$dependency_error" = "xyes"; then
3640 AC_MSG_ERROR("Some plugins are missing dependencies - see above summary for details")
3643 # vim: set fdm=marker :