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])
51 AC_MSG_RESULT([$ac_system])
53 if test "x$ac_system" = "xLinux"
55 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
56 if test -z "$KERNEL_DIR"
58 KERNEL_DIR="/lib/modules/`uname -r`/source"
61 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
62 AC_SUBST(KERNEL_CFLAGS)
66 # Checks for header files.
72 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)
75 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
80 # include <sys/types.h>
83 AC_CHECK_HEADERS(netinet/in.h, [], [],
88 # include <sys/types.h>
90 #if HAVE_NETINET_IN_SYSTM_H
91 # include <netinet/in_systm.h>
94 AC_CHECK_HEADERS(netinet/ip.h, [], [],
99 # include <sys/types.h>
101 #if HAVE_NETINET_IN_SYSTM_H
102 # include <netinet/in_systm.h>
104 #if HAVE_NETINET_IN_H
105 # include <netinet/in.h>
108 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
113 # include <sys/types.h>
115 #if HAVE_NETINET_IN_SYSTM_H
116 # include <netinet/in_systm.h>
118 #if HAVE_NETINET_IN_H
119 # include <netinet/in.h>
121 #if HAVE_NETINET_IP_H
122 # include <netinet/ip.h>
125 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
130 # include <sys/types.h>
132 #if HAVE_NETINET_IN_SYSTM_H
133 # include <netinet/in_systm.h>
135 #if HAVE_NETINET_IN_H
136 # include <netinet/in.h>
138 #if HAVE_NETINET_IP_H
139 # include <netinet/ip.h>
142 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
147 # include <sys/types.h>
149 #if HAVE_NETINET_IN_SYSTM_H
150 # include <netinet/in_systm.h>
152 #if HAVE_NETINET_IN_H
153 # include <netinet/in.h>
156 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
161 # include <sys/types.h>
163 #if HAVE_NETINET_IN_SYSTM_H
164 # include <netinet/in_systm.h>
166 #if HAVE_NETINET_IN_H
167 # include <netinet/in.h>
169 #if HAVE_NETINET_IP6_H
170 # include <netinet/ip6.h>
173 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
178 # include <sys/types.h>
180 #if HAVE_NETINET_IN_SYSTM_H
181 # include <netinet/in_systm.h>
183 #if HAVE_NETINET_IN_H
184 # include <netinet/in.h>
186 #if HAVE_NETINET_IP_H
187 # include <netinet/ip.h>
190 AC_CHECK_HEADERS(netinet/udp.h, [], [],
195 # include <sys/types.h>
197 #if HAVE_NETINET_IN_SYSTM_H
198 # include <netinet/in_systm.h>
200 #if HAVE_NETINET_IN_H
201 # include <netinet/in.h>
203 #if HAVE_NETINET_IP_H
204 # include <netinet/ip.h>
209 AC_CHECK_HEADERS(sys/dkstat.h)
210 if test "x$ac_system" = "xDarwin"
212 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)
213 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
215 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
218 # include <sys/types.h>
221 # include <sys/param.h>
226 AC_CHECK_HEADERS(linux/major.h libgen.h)
228 # For the battery plugin
229 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
231 #if HAVE_IOKIT_IOKITLIB_H
232 # include <IOKit/IOKitLib.h>
234 #if HAVE_IOKIT_IOTYPES_H
235 # include <IOKit/IOTypes.h>
239 # For the swap module
240 AC_CHECK_HEADERS(sys/swap.h, [], [],
243 # include <sys/types.h>
246 # include <sys/param.h>
251 # For the processes plugin
253 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
255 # For interface plugin
256 AC_CHECK_HEADERS(ifaddrs.h)
257 AC_CHECK_HEADERS(net/if.h, [], [],
260 # include <sys/types.h>
262 #if HAVE_SYS_SOCKET_H
263 # include <sys/socket.h>
266 AC_CHECK_HEADERS(linux/if.h, [], [],
269 # include <sys/types.h>
271 #if HAVE_SYS_SOCKET_H
272 # include <sys/socket.h>
275 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
278 # include <sys/types.h>
280 #if HAVE_SYS_SOCKET_H
281 # include <sys/socket.h>
284 # include <linux/if.h>
289 have_net_ip_vs_h="no"
291 if test "x$ac_system" = "xLinux"
294 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
296 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
297 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
303 AC_CHECK_HEADERS(sys/ucred.h, [], [],
306 # include <sys/types.h>
309 # include <sys/param.h>
313 # For mount interface
314 AC_CHECK_HEADERS(sys/mount.h, [], [],
317 # include <sys/types.h>
320 # include <sys/param.h>
324 # For the email plugin
325 AC_CHECK_HEADERS(linux/un.h, [], [],
327 #if HAVE_SYS_SOCKET_H
328 # include <sys/socket.h>
332 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)
335 AC_CHECK_HEADERS(arpa/nameser.h)
336 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
338 #if HAVE_ARPA_NAMESER_H
339 # include <arpa/nameser.h>
343 AC_CHECK_HEADERS(net/if_arp.h, [], [],
344 [#if HAVE_SYS_SOCKET_H
345 # include <sys/socket.h>
348 AC_CHECK_HEADERS(net/ppp_defs.h)
349 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
350 [#if HAVE_NET_PPP_DEFS_H
351 # include <net/ppp_defs.h>
354 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
359 # include <sys/types.h>
361 #if HAVE_SYS_SOCKET_H
362 # include <sys/socket.h>
367 #if HAVE_NETINET_IN_H
368 # include <netinet/in.h>
372 # For the multimeter plugin
374 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
377 # Checks for typedefs, structures, and compiler characteristics.
386 # Checks for library functions.
388 AC_PROG_GCC_TRADITIONAL
389 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
393 AC_CACHE_CHECK([for strtok_r],
394 [have_strtok_r_default],
403 char buffer[] = "foo,bar,baz";
410 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
413 printf ("token = %s;\n", token);
416 [have_strtok_r_default="yes"],
417 [have_strtok_r_default="no"]
421 if test "x$have_strtok_r_default" = "xno"
423 SAVE_CFLAGS="$CFLAGS"
424 CFLAGS="$CFLAGS -D_REENTRANT=1"
426 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
427 [have_strtok_r_reentrant],
436 char buffer[] = "foo,bar,baz";
443 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
446 printf ("token = %s;\n", token);
449 [have_strtok_r_reentrant="yes"],
450 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
455 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
457 socket_needs_socket="no"
458 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
459 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
461 nanosleep_needs_rt="no"
462 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
463 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
465 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
466 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
467 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
468 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
469 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
470 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
471 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
472 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
473 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
474 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
477 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
480 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
482 if test "x$withval" = "xno"; then
484 else if test "x$withval" = "xyes"; then
491 if test "x$nan_type" = "xnone"; then
492 AC_CACHE_CHECK([whether NAN is defined by default],
499 static float foo = NAN;
507 [have_nan_default="yes"],
508 [have_nan_default="no"]
511 if test "x$have_nan_default" = "xyes"
516 if test "x$nan_type" = "xnone"; then
517 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
523 #define __USE_ISOC99 1
525 static float foo = NAN;
533 [have_nan_isoc="yes"],
537 if test "x$have_nan_isoc" = "xyes"
542 if test "x$nan_type" = "xnone"; then
543 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
553 #define NAN (0.0 / 0.0)
555 # define isnan(f) ((f) != (f))
557 static float foo = NAN;
565 [have_nan_zero="yes"],
569 if test "x$have_nan_zero" = "xyes"
575 if test "x$nan_type" = "xdefault"; then
576 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
577 [Define if NAN is defined by default and can initialize static variables.])
578 else if test "x$nan_type" = "xisoc99"; then
579 AC_DEFINE(NAN_STATIC_ISOC, 1,
580 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
581 else if test "x$nan_type" = "xzero"; then
582 AC_DEFINE(NAN_ZERO_ZERO, 1,
583 [Define if NAN can be defined as (0.0 / 0.0)])
585 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
588 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
590 if test "x$withval" = "xnothing"; then
591 fp_layout_type="nothing"
592 else if test "x$withval" = "xendianflip"; then
593 fp_layout_type="endianflip"
594 else if test "x$withval" = "xintswap"; then
595 fp_layout_type="intswap"
597 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
600 [fp_layout_type="unknown"])
602 if test "x$fp_layout_type" = "xunknown"; then
603 AC_CACHE_CHECK([if doubles are stored in x86 representation],
604 [fp_layout_need_nothing],
620 memcpy ((void *) &i0, (void *) &d, 8);
623 memcpy ((void *) c, (void *) &i1, 8);
625 if ((c[0] == 0x2f) && (c[1] == 0x25)
626 && (c[2] == 0xc0) && (c[3] == 0xc7)
627 && (c[4] == 0x43) && (c[5] == 0x2b)
628 && (c[6] == 0x1f) && (c[7] == 0x5b))
633 [fp_layout_need_nothing="yes"],
634 [fp_layout_need_nothing="no"]
637 if test "x$fp_layout_need_nothing" = "xyes"; then
638 fp_layout_type="nothing"
641 if test "x$fp_layout_type" = "xunknown"; then
642 AC_CACHE_CHECK([if endianflip converts to x86 representation],
643 [fp_layout_need_endianflip],
651 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
652 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
653 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
654 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
655 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
656 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
657 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
658 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
667 memcpy ((void *) &i0, (void *) &d, 8);
669 i1 = endianflip (i0);
670 memcpy ((void *) c, (void *) &i1, 8);
672 if ((c[0] == 0x2f) && (c[1] == 0x25)
673 && (c[2] == 0xc0) && (c[3] == 0xc7)
674 && (c[4] == 0x43) && (c[5] == 0x2b)
675 && (c[6] == 0x1f) && (c[7] == 0x5b))
680 [fp_layout_need_endianflip="yes"],
681 [fp_layout_need_endianflip="no"]
684 if test "x$fp_layout_need_endianflip" = "xyes"; then
685 fp_layout_type="endianflip"
688 if test "x$fp_layout_type" = "xunknown"; then
689 AC_CACHE_CHECK([if intswap converts to x86 representation],
690 [fp_layout_need_intswap],
698 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
699 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
708 memcpy ((void *) &i0, (void *) &d, 8);
711 memcpy ((void *) c, (void *) &i1, 8);
713 if ((c[0] == 0x2f) && (c[1] == 0x25)
714 && (c[2] == 0xc0) && (c[3] == 0xc7)
715 && (c[4] == 0x43) && (c[5] == 0x2b)
716 && (c[6] == 0x1f) && (c[7] == 0x5b))
721 [fp_layout_need_intswap="yes"],
722 [fp_layout_need_intswap="no"]
725 if test "x$fp_layout_need_intswap" = "xyes"; then
726 fp_layout_type="intswap"
730 if test "x$fp_layout_type" = "xnothing"; then
731 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
732 [Define if doubles are stored in x86 representation.])
733 else if test "x$fp_layout_type" = "xendianflip"; then
734 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
735 [Define if endianflip is needed to convert to x86 representation.])
736 else if test "x$fp_layout_type" = "xintswap"; then
737 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
738 [Define if intswap is needed to convert to x86 representation.])
740 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
744 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
746 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
748 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
751 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
752 if test "x$have_getmntent" = "xno"; then
753 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
755 if test "x$have_getmntent" = "xno"; then
756 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
758 if test "x$have_getmntent" = "xno"; then
759 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
762 if test "x$have_getmntent" = "xc"; then
763 AC_CACHE_CHECK([whether getmntent takes one argument],
764 [have_one_getmntent],
766 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
768 #include "$srcdir/src/utils_mount.h"]],
772 fh = setmntent ("/etc/mtab", "r");
776 [have_one_getmntent="yes"],
777 [have_one_getmntent="no"]
780 AC_CACHE_CHECK([whether getmntent takes two arguments],
781 [have_two_getmntent],
783 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
784 #include <sys/mnttab.h>
785 #include "$srcdir/src/utils_mount.h"]],
790 fh = fopen ("/etc/mnttab", "r");
791 status = getmntent (fh, &mt);
794 [have_two_getmntent="yes"],
795 [have_two_getmntent="no"]
800 # Check for different versions of `getmntent' here..
802 if test "x$have_getmntent" = "xc"; then
803 if test "x$have_one_getmntent" = "xyes"; then
804 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
805 [Define if the function getmntent exists and takes one argument.])
807 if test "x$have_two_getmntent" = "xyes"; then
808 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
809 [Define if the function getmntent exists and takes two arguments.])
812 if test "x$have_getmntent" = "xsun"; then
813 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
814 [Define if the function getmntent exists. It's the version from libsun.])
816 if test "x$have_getmntent" = "xseq"; then
817 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
818 [Define if the function getmntent exists. It's the version from libseq.])
820 if test "x$have_getmntent" = "xgen"; then
821 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
822 [Define if the function getmntent exists. It's the version from libgen.])
825 # Check for structures
826 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
827 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
830 #include <sys/types.h>
831 #include <sys/socket.h>
834 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
835 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
838 #include <sys/types.h>
839 #include <sys/socket.h>
840 #include <linux/if.h>
841 #include <linux/netdevice.h>
844 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
849 # include <sys/types.h>
851 #if HAVE_NETINET_IN_SYSTM_H
852 # include <netinet/in_systm.h>
854 #if HAVE_NETINET_IN_H
855 # include <netinet/in.h>
857 #if HAVE_NETINET_IP_H
858 # include <netinet/ip.h>
860 #if HAVE_NETINET_UDP_H
861 # include <netinet/udp.h>
864 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
869 # include <sys/types.h>
871 #if HAVE_NETINET_IN_SYSTM_H
872 # include <netinet/in_systm.h>
874 #if HAVE_NETINET_IN_H
875 # include <netinet/in.h>
877 #if HAVE_NETINET_IP_H
878 # include <netinet/ip.h>
880 #if HAVE_NETINET_UDP_H
881 # include <netinet/udp.h>
885 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
895 # Checks for libraries begin here
898 AC_CHECK_LIB(resolv, res_search,
900 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
902 [with_libresolv="no"])
903 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
905 dnl Check for HAL (hardware abstraction library)
907 AC_CHECK_LIB(hal,libhal_device_property_exists,
908 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
910 if test "x$with_libhal" = "xyes"; then
911 if test "x$PKG_CONFIG" != "x"; then
912 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
913 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
914 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
915 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
919 m4_divert_once([HELP_WITH], [
920 collectd additional packages:])
922 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
925 librrd_threadsafe="yes"
926 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
927 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
929 librrd_cflags="-I$withval/include"
930 librrd_ldflags="-L$withval/lib"
933 with_rrdtool="$withval"
935 ], [with_rrdtool="yes"])
936 if test "x$with_rrdtool" = "xyes"
938 SAVE_CPPFLAGS="$CPPFLAGS"
939 SAVE_LDFLAGS="$LDFLAGS"
941 CPPFLAGS="$CPPFLAGS $librrd_cflags"
942 LDFLAGS="$LDFLAGS $librrd_ldflags"
944 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
946 CPPFLAGS="$SAVE_CPPFLAGS"
947 LDFLAGS="$SAVE_LDFLAGS"
949 if test "x$with_rrdtool" = "xyes"
951 SAVE_CPPFLAGS="$CPPFLAGS"
952 SAVE_LDFLAGS="$LDFLAGS"
954 CPPFLAGS="$CPPFLAGS $librrd_cflags"
955 LDFLAGS="$LDFLAGS $librrd_ldflags"
957 AC_CHECK_LIB(rrd_th, rrd_update_r,
959 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
961 [librrd_threadsafe="no"
962 AC_CHECK_LIB(rrd, rrd_update,
964 librrd_ldflags="$librrd_ldflags -lrrd -lm"
966 [with_rrdtool="no (symbol 'rrd_update' not found)"],
971 CPPFLAGS="$SAVE_CPPFLAGS"
972 LDFLAGS="$SAVE_LDFLAGS"
974 if test "x$with_rrdtool" = "xyes"
976 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
977 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
978 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
979 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
981 if test "x$librrd_threadsafe" = "xyes"
983 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
986 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
987 [ if test "x$withval" != "xno" \
988 && test "x$withval" != "xyes"
990 LDFLAGS="$LDFLAGS -L$withval/lib"
991 CPPFLAGS="$CPPFLAGS -I$withval/include"
992 with_libpthread="yes"
994 if test "x$withval" = "xno"
996 with_libpthread="no (disabled)"
999 ], [with_libpthread="yes"])
1000 if test "x$with_libpthread" = "xyes"
1002 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
1004 if test "x$with_libpthread" = "xyes"
1006 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
1008 if test "x$with_libpthread" = "xyes"
1014 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
1015 [Wether or not to use pthread (POSIX threads) library])
1016 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
1018 if test "x$ac_system" = "xSolaris"
1023 with_kstat="no (Solaris only)"
1024 with_devinfo="no (Solaris only)"
1027 if test "x$with_kstat" = "xyes"
1029 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1031 if test "x$with_kstat" = "xyes"
1033 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1034 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1036 if test "x$with_kstat" = "xyes"
1038 AC_DEFINE(HAVE_LIBKSTAT, 1,
1039 [Define to 1 if you have the 'kstat' library (-lkstat)])
1041 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1042 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1044 ### BEGIN of check for libcurl ###
1045 with_curl_config="curl-config"
1048 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1050 if test "x$withval" = "xno"
1053 else if test "x$withval" = "xyes"
1057 if test -f "$withval" && test -x "$withval"
1059 with_curl_config="$withval"
1061 else if test -x "$withval/bin/curl-config"
1063 with_curl_config="$withval/bin/curl-config"
1072 if test "x$with_libcurl" = "xyes"
1074 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1075 curl_config_status=$?
1077 if test $curl_config_status -ne 0
1079 with_libcurl="no ($with_curl_config failed)"
1081 SAVE_CPPFLAGS="$CPPFLAGS"
1082 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1084 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1086 CPPFLAGS="$SAVE_CPPFLAGS"
1089 if test "x$with_libcurl" = "xyes"
1091 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1092 curl_config_status=$?
1094 if test $curl_config_status -ne 0
1096 with_libcurl="no ($with_curl_config failed)"
1098 AC_CHECK_LIB(curl, curl_easy_init,
1099 [with_libcurl="yes"],
1100 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1104 if test "x$with_libcurl" = "xyes"
1106 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1107 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1108 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1109 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1111 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1112 ### END of check for libcurl ###
1115 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1122 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1124 with_libstatgrab_cflags=""
1125 with_libstatgrab_ldflags=""
1126 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1128 if test "x$withval" != "xno" \
1129 && test "x$withval" != "xyes"
1131 with_libstatgrab_cflags="-I$withval/include"
1132 with_libstatgrab_ldflags="-L$withval/lib"
1133 with_libstatgrab="yes"
1135 with_libstatgrab="$withval"
1139 if test "x$ac_system" = "xunknown"
1141 with_libstatgrab="yes"
1143 with_libstatgrab="no"
1146 with_libstatgrab_pkg_config="yes"
1147 if test "x$with_libstatgrab" = "xyes" \
1148 && test "x$PKG_CONFIG" != "x"
1150 AC_MSG_CHECKING([pkg-config for libstatgrab])
1152 $PKG_CONFIG --exists libstatgrab 2>/dev/null
1155 with_libstatgrab_pkg_config="no"
1156 temp_result="not found"
1158 AC_MSG_RESULT([$temp_result])
1160 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
1161 with_libstatgrab_pkg_config="no"
1162 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
1165 if test "x$with_libstatgrab" = "xyes" \
1166 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1167 && test "x$with_libstatgrab_cflags" = "x"
1169 AC_MSG_CHECKING([for libstatgrab CFLAGS])
1170 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
1173 with_libstatgrab_cflags="$temp_result"
1175 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
1176 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
1178 AC_MSG_RESULT([$temp_result])
1181 if test "x$with_libstatgrab" = "xyes" \
1182 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1183 && test "x$with_libstatgrab_ldflags" = "x"
1185 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
1186 temp_result="`$PKG_CONFIG --libs libstatgrab`"
1189 with_libstatgrab_ldflags="$temp_result"
1191 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
1192 temp_result="$PKG_CONFIG --libs libstatgrab failed"
1194 AC_MSG_RESULT([$temp_result])
1197 if test "x$with_libstatgrab" = "xyes"
1199 SAVE_CPPFLAGS="$CPPFLAGS"
1200 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
1202 AC_CHECK_HEADERS(statgrab.h,
1203 [with_libstatgrab="yes"],
1204 [with_libstatgrab="no (statgrab.h not found)"])
1206 CPPFLAGS="$SAVE_CPPFLAGS"
1209 if test "x$with_libstatgrab" = "xyes"
1211 SAVE_CFLAGS="$CFLAGS"
1212 SAVE_LDFLAGS="$LDFLAGS"
1214 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
1215 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
1217 AC_CHECK_LIB(statgrab, sg_init,
1218 [with_libstatgrab="yes"],
1219 [with_libstatgrab="no (symbol sg_init not found)"])
1221 CFLAGS="$SAVE_CFLAGS"
1222 LDFLAGS="$SAVE_LDFLAGS"
1225 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1226 if test "x$with_libstatgrab" = "xyes"
1228 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
1229 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
1230 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
1231 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
1232 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
1235 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
1236 if test "x$with_libkvm" = "xyes"
1238 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
1240 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
1242 with_sensors_cflags=""
1243 with_sensors_ldflags=""
1244 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1246 if test "x$withval" = "xno"
1248 with_lm_sensors="no"
1250 with_lm_sensors="yes"
1251 if test "x$withval" != "xyes"
1253 with_sensors_cflags="-I$withval/include"
1254 with_sensors_ldflags="-L$withval/lib"
1255 with_lm_sensors="yes"
1260 if test "x$ac_system" = "xLinux"
1262 with_lm_sensors="yes"
1264 with_lm_sensors="no (Linux only library)"
1267 if test "x$with_lm_sensors" = "xyes"
1269 SAVE_CPPFLAGS="$CPPFLAGS"
1270 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1272 # AC_CHECK_HEADERS(sensors/sensors.h,
1274 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1276 # [with_lm_sensors="no (sensors/sensors.h not found)"])
1277 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1279 CPPFLAGS="$SAVE_CPPFLAGS"
1281 if test "x$with_lm_sensors" = "xyes"
1283 SAVE_CPPFLAGS="$CPPFLAGS"
1284 SAVE_LDFLAGS="$LDFLAGS"
1285 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1286 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1288 AC_CHECK_LIB(sensors, sensors_init,
1290 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1292 [with_lm_sensors="no (libsensors not found)"])
1294 CPPFLAGS="$SAVE_CPPFLAGS"
1295 LDFLAGS="$SAVE_LDFLAGS"
1297 if test "x$with_lm_sensors" = "xyes"
1299 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1300 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1301 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1302 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1304 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1306 with_mysql_config="mysql_config"
1307 with_mysql_cflags=""
1309 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1311 if test "x$withval" = "xno"
1314 else if test "x$withval" = "xyes"
1318 if test -f "$withval" && test -x "$withval";
1320 with_mysql_config="$withval"
1321 else if test -x "$withval/bin/mysql_config"
1323 with_mysql_config="$withval/bin/mysql_config"
1331 if test "x$with_libmysql" = "xyes"
1333 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1334 mysql_config_status=$?
1336 if test $mysql_config_status -ne 0
1340 SAVE_CPPFLAGS="$CPPFLAGS"
1341 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1343 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1345 CPPFLAGS="$SAVE_CPPFLAGS"
1348 if test "x$with_libmysql" = "xyes"
1350 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1351 mysql_config_status=$?
1353 if test $mysql_config_status -ne 0
1357 AC_CHECK_LIB(mysqlclient, mysql_init,
1358 [with_libmysql="yes"],
1359 [with_libmysql="no (symbol 'mysql_init' not found)"],
1363 if test "x$with_libmysql" = "xyes"
1365 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1366 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1367 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1368 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1370 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1372 with_own_liboconfig="no"
1373 liboconfig_LDFLAGS="$LDFLAGS"
1374 liboconfig_CPPFLAGS="$CPPFLAGS"
1375 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1377 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1379 if test -d "$withval/lib"
1381 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1383 if test -d "$withval/include"
1385 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1388 if test "x$withval" = "xno"
1390 AC_MSG_ERROR("liboconfig is required")
1394 with_liboconfig="yes"
1397 save_LDFLAGS="$LDFLAGS"
1398 save_CPPFLAGS="$CPPFLAGS"
1399 LDFLAGS="$liboconfig_LDFLAGS"
1400 CPPFLAGS="$liboconfig_CPPFLAGS"
1401 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1403 with_liboconfig="yes"
1404 with_own_liboconfig="no"
1407 with_liboconfig="yes"
1408 with_own_liboconfig="yes"
1409 LDFLAGS="$save_LDFLAGS"
1410 CPPFLAGS="$save_CPPFLAGS"
1413 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1414 if test "x$with_own_liboconfig" = "xyes"
1416 with_liboconfig="yes (shipped version)"
1419 #with_liboping="yes"
1420 with_own_liboping="no"
1421 liboping_LDFLAGS="$LDFLAGS"
1422 liboping_CPPFLAGS="$CPPFLAGS"
1423 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1425 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1427 if test -d "$withval/lib"
1429 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1431 if test -d "$withval/include"
1433 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1436 if test "x$withval" = "xno"
1439 with_own_liboping="no"
1440 else if test "x$withval" = "xyes"
1449 if test "x$with_liboping" = "xyes"
1451 save_LDFLAGS="$LDFLAGS"
1452 save_CPPFLAGS="$CPPFLAGS"
1453 LDFLAGS="$liboping_LDFLAGS"
1454 CPPFLAGS="$liboping_CPPFLAGS"
1455 AC_CHECK_LIB(oping, ping_construct,
1458 with_own_liboping="no"
1462 with_own_liboping="yes"
1463 LDFLAGS="$save_LDFLAGS"
1464 CPPFLAGS="$save_CPPFLAGS"
1467 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1468 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1470 with_libowcapi_cppflags=""
1471 with_libowcapi_libs="-lowcapi"
1472 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
1474 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1476 with_libowcapi_cppflags="-I$withval/include"
1477 with_libowcapi_libs="-L$withval/lib -lowcapi"
1478 with_libowcapi="yes"
1480 with_libowcapi="$withval"
1484 with_libowcapi="yes"
1486 if test "x$with_libowcapi" = "xyes"
1488 SAVE_CPPFLAGS="$CPPFLAGS"
1489 CPPFLAGS="$with_libowcapi_cppflags"
1491 AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
1493 CPPFLAGS="$SAVE_CPPFLAGS"
1495 if test "x$with_libowcapi" = "xyes"
1497 SAVE_LDFLAGS="$LDFLAGS"
1498 SAVE_CPPFLAGS="$CPPFLAGS"
1499 LDFLAGS="$with_libowcapi_libs"
1500 CPPFLAGS="$with_libowcapi_cppflags"
1502 AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
1504 LDFLAGS="$SAVE_LDFLAGS"
1505 CPPFLAGS="$SAVE_CPPFLAGS"
1507 if test "x$with_libowcapi" = "xyes"
1509 BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
1510 BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
1511 AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
1512 AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
1516 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1518 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1520 LDFLAGS="$LDFLAGS -L$withval/lib"
1521 CPPFLAGS="$CPPFLAGS -I$withval/include"
1524 with_libpcap="$withval"
1530 if test "x$with_libpcap" = "xyes"
1532 AC_CHECK_LIB(pcap, pcap_open_live,
1534 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1535 ], [with_libpcap="no (libpcap not found)"])
1537 if test "x$with_libpcap" = "xyes"
1539 AC_CHECK_HEADERS(pcap.h,
1541 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1542 ], [with_libpcap="no (pcap.h not found)"])
1544 if test "x$with_libpcap" = "xyes"
1550 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1551 [Wether or not to use the pcap library])
1552 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1554 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1556 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1558 LDFLAGS="$LDFLAGS -L$withval/lib"
1559 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1562 with_libesmtp="$withval"
1568 if test "x$with_libesmtp" = "xyes"
1570 AC_CHECK_LIB(esmtp, smtp_create_session,
1572 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1573 ], [with_libesmtp="no (libesmtp not found)"])
1575 if test "x$with_libesmtp" = "xyes"
1577 AC_CHECK_HEADERS(libesmtp.h,
1579 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1580 ], [with_libesmtp="no (libesmtp.h not found)"])
1582 if test "x$with_libesmtp" = "xyes"
1588 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1589 [Wether or not to use the esmtp library])
1590 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1592 perl_interpreter="perl"
1593 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1595 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1597 LDFLAGS="$LDFLAGS -L$withval/lib"
1598 CPPFLAGS="$CPPFLAGS -I$withval/include"
1599 perl_interpreter="$withval/bin/perl"
1602 with_libperl="$withval"
1609 AC_MSG_CHECKING([for perl])
1610 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1611 if test -x "$perl_interpreter"
1613 AC_MSG_RESULT([yes])
1619 AC_SUBST(PERL, "$perl_interpreter")
1621 if test "x$with_libperl" = "xyes" \
1622 && test -n "$perl_interpreter"
1625 SAVE_LDFLAGS=$LDFLAGS
1626 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1627 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1628 CFLAGS="$CFLAGS $PERL_CFLAGS"
1629 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1631 AC_CACHE_CHECK([for libperl],
1641 PerlInterpreter *perl = NULL;
1642 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1643 newSVpv ("Collectd::Plugin::FooBar", 24),
1646 [have_libperl="yes"],
1651 if test "x$have_libperl" = "xyes"
1653 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1654 AC_SUBST(PERL_CFLAGS)
1655 AC_SUBST(PERL_LDFLAGS)
1661 LDFLAGS=$SAVE_LDFLAGS
1662 else if test -z "$perl_interpreter"; then
1663 with_libperl="no (no perl interpreter found)"
1666 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1668 if test "x$with_libperl" = "xyes"
1671 SAVE_LDFLAGS=$LDFLAGS
1672 CFLAGS="$CFLAGS $PERL_CFLAGS"
1673 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1675 AC_CACHE_CHECK([if perl supports ithreads],
1676 [have_perl_ithreads],
1684 #if !defined(USE_ITHREADS)
1685 # error "Perl does not support ithreads!"
1686 #endif /* !defined(USE_ITHREADS) */
1689 [have_perl_ithreads="yes"],
1690 [have_perl_ithreads="no"]
1694 if test "x$have_perl_ithreads" = "xyes"
1696 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1700 LDFLAGS=$SAVE_LDFLAGS
1703 with_own_libiptc="no"
1704 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1706 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1708 LDFLAGS="$LDFLAGS -L$withval/lib"
1709 CPPFLAGS="$CPPFLAGS -I$withval/include"
1712 with_libiptc="$withval"
1716 if test "x$ac_system" = "xLinux"
1720 with_libiptc="no (Linux only)"
1723 if test "x$with_libiptc" = "xyes"
1725 AC_CHECK_LIB(iptc, iptc_init,
1727 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1731 with_own_libiptc="yes"
1734 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1736 AC_CHECK_HEADERS(libiptc/libiptc.h,
1738 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1742 with_own_libiptc="yes"
1745 if test "x$with_libiptc" = "xyes"
1748 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1750 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1752 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1753 with_own_libiptc="no"
1756 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1761 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1762 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1763 if test "x$with_own_libiptc" = "xyes"
1765 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1768 with_snmp_config="net-snmp-config"
1771 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1773 if test "x$withval" = "xno"
1775 with_libnetsnmp="no"
1776 else if test "x$withval" = "xyes"
1778 with_libnetsnmp="yes"
1780 if test -x "$withval"
1782 with_snmp_config="$withval"
1783 with_libnetsnmp="yes"
1785 with_snmp_config="$withval/bin/net-snmp-config"
1786 with_libnetsnmp="yes"
1790 [with_libnetsnmp="yes"])
1791 if test "x$with_libnetsnmp" = "xyes"
1793 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1794 snmp_config_status=$?
1796 if test $snmp_config_status -ne 0
1798 with_libnetsnmp="no ($with_snmp_config failed)"
1800 SAVE_CPPFLAGS="$CPPFLAGS"
1801 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1803 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1805 CPPFLAGS="$SAVE_CPPFLAGS"
1808 if test "x$with_libnetsnmp" = "xyes"
1810 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1811 snmp_config_status=$?
1813 if test $snmp_config_status -ne 0
1815 with_libnetsnmp="no ($with_snmp_config failed)"
1817 AC_CHECK_LIB(netsnmp, init_snmp,
1818 [with_libnetsnmp="yes"],
1819 [with_libnetsnmp="no (libnetsnmp not found)"],
1823 if test "x$with_libnetsnmp" = "xyes"
1825 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1826 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1827 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1828 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1830 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1832 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
1833 [with_libnotify="yes"],
1834 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
1836 with_libupsclient="no (pkg-config isn't available)"
1837 with_libupsclient_cflags=""
1838 with_libupsclient_libs=""
1839 if test "x$PKG_CONFIG" != "x"
1841 pkg-config --exists 'libupsclient' 2>/dev/null
1844 with_libupsclient="yes"
1846 with_libupsclient="no (pkg-config doesn't know library)"
1849 if test "x$with_libupsclient" = "xyes"
1851 with_libupsclient_cflags="`pkg-config --cflags 'libupsclient'`"
1854 with_libupsclient="no"
1856 with_libupsclient_libs="`pkg-config --libs 'libupsclient'`"
1859 with_libupsclient="no"
1862 if test "x$with_libupsclient" = "xyes"
1864 SAVE_CPPFLAGS="$CPPFLAGS"
1865 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1867 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1869 CPPFLAGS="$SAVE_CPPFLAGS"
1871 if test "x$with_libupsclient" = "xyes"
1873 SAVE_CPPFLAGS="$CPPFLAGS"
1874 SAVE_LDFLAGS="$LDFLAGS"
1876 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1877 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
1879 AC_CHECK_LIB(upsclient, upscli_connect,
1880 [with_libupsclient="yes"],
1881 [with_libupsclient="no (symbol upscli_connect not found)"])
1883 CPPFLAGS="$SAVE_CPPFLAGS"
1884 LDFLAGS="$SAVE_LDFLAGS"
1886 if test "x$with_libupsclient" = "xyes"
1888 SAVE_CPPFLAGS="$CPPFLAGS"
1889 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1891 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1892 [#include <stdlib.h>
1894 #include <upsclient.h>])
1896 CPPFLAGS="$SAVE_CPPFLAGS"
1898 if test "x$with_libupsclient" = "xyes"
1900 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
1901 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
1902 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1903 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1906 ### BEGIN of check for libxmms ###
1907 with_xmms_config="xmms-config"
1910 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1912 if test "x$withval" != "xno" \
1913 && test "x$withval" != "xyes"
1915 if test -f "$withval" && test -x "$withval";
1917 with_xmms_config="$withval"
1918 else if test -x "$withval/bin/xmms-config"
1920 with_xmms_config="$withval/bin/xmms-config"
1923 else if test "x$withval" = "xno"
1933 if test "x$with_libxmms" = "xyes"
1935 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1936 xmms_config_status=$?
1938 if test $xmms_config_status -ne 0
1943 if test "x$with_libxmms" = "xyes"
1945 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1946 xmms_config_status=$?
1948 if test $xmms_config_status -ne 0
1953 if test "x$with_libxmms" = "xyes"
1955 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1957 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1958 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1959 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1960 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1967 with_libxmms_numeric=0
1968 if test "x$with_libxmms" = "xyes"
1970 with_libxmms_numeric=1
1972 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1973 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1974 ### END of check for libxmms ###
1976 with_libnetlink_cflags=""
1977 with_libnetlink_libs="-lnetlink"
1978 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1980 echo "libnetlink: withval = $withval"
1981 if test "x$withval" = "xyes"
1983 with_libnetlink="yes"
1984 else if test "x$withval" = "xno"
1986 with_libnetlink="no"
1988 if test -d "$withval/include"
1990 with_libnetlink_cflags="-I$withval/include"
1991 with_libnetlink_libs="-L$withval/lib -lnetlink"
1992 with_libnetlink="yes"
1994 AC_MSG_ERROR("no such directory: $withval/include")
1999 if test "x$ac_system" = "xLinux"
2001 with_libnetlink="yes"
2003 with_libnetlink="no (Linux only library)"
2006 if test "x$with_libnetlink" = "xyes"
2009 CFLAGS="$CFLAGS $with_libnetlink_cflags"
2011 with_libnetlink="no (libnetlink.h not found)"
2013 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
2015 with_libnetlink="yes"
2019 #include <sys/types.h>
2020 #include <asm/types.h>
2021 #include <sys/socket.h>
2022 #include <linux/netlink.h>
2023 #include <linux/rtnetlink.h>])
2024 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2026 #include <sys/types.h>
2027 #include <asm/types.h>
2028 #include <sys/socket.h>])
2032 #include <sys/types.h>
2033 #include <asm/types.h>
2034 #include <sys/socket.h>
2035 #include <linux/netlink.h>
2036 #include <linux/rtnetlink.h>
2040 int retval = TCA_STATS2;
2043 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
2048 #include <sys/types.h>
2049 #include <asm/types.h>
2050 #include <sys/socket.h>
2051 #include <linux/netlink.h>
2052 #include <linux/rtnetlink.h>
2056 int retval = TCA_STATS;
2059 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
2062 CFLAGS="$SAVE_CFLAGS"
2064 if test "x$with_libnetlink" = "xyes"
2066 AC_CHECK_LIB(netlink, rtnl_open,
2067 [with_libnetlink="yes"],
2068 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
2069 [$with_libnetlink_libs])
2071 if test "x$with_libnetlink" = "xyes"
2073 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
2074 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
2075 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
2076 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
2078 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
2080 with_libopenipmipthread="yes"
2081 with_libopenipmipthread_cflags=""
2082 with_libopenipmipthread_libs=""
2084 AC_MSG_CHECKING([for pkg-config])
2086 if test "x$PKG_CONFIG" = "x"
2088 with_libopenipmipthread="no"
2091 temp_result="$PKG_CONFIG"
2093 AC_MSG_RESULT([$temp_result])
2095 if test "x$with_libopenipmipthread" = "xyes"
2097 AC_MSG_CHECKING([for libOpenIPMIpthread])
2098 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2101 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2103 AC_MSG_RESULT([$with_libopenipmipthread])
2106 if test "x$with_libopenipmipthread" = "xyes"
2108 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2109 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2112 with_libopenipmipthread_cflags="$temp_result"
2114 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2115 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2117 AC_MSG_RESULT([$temp_result])
2120 if test "x$with_libopenipmipthread" = "xyes"
2122 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2123 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2126 with_libopenipmipthread_ldflags="$temp_result"
2128 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2129 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2131 AC_MSG_RESULT([$temp_result])
2134 if test "x$with_libopenipmipthread" = "xyes"
2136 SAVE_CPPFLAGS="$CPPFLAGS"
2137 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2139 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2140 [with_libopenipmipthread="yes"],
2141 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2142 [#include <OpenIPMI/ipmiif.h>
2143 #include <OpenIPMI/ipmi_err.h>
2144 #include <OpenIPMI/ipmi_posix.h>
2145 #include <OpenIPMI/ipmi_conn.h>
2148 CPPFLAGS="$SAVE_CPPFLAGS"
2151 if test "x$with_libopenipmipthread" = "xyes"
2153 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2154 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2155 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2156 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2159 dnl Check for libpq.
2160 with_pg_config="pg_config"
2161 with_libpq_includedir=""
2162 with_libpq_libdir=""
2163 with_libpq_cppflags=""
2164 with_libpq_ldflags=""
2165 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2168 if test "x$withval" = "xno"
2171 else if test "x$withval" = "xyes"
2175 if test -f "$withval" && test -x "$withval";
2177 with_pg_config="$withval"
2178 else if test -x "$withval/bin/pg_config"
2180 with_pg_config="$withval/bin/pg_config"
2188 if test "x$with_libpq" = "xyes"
2190 with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2193 if test $pg_config_status -eq 0
2195 if test -n "$with_libpq_includedir"; then
2196 for dir in $with_libpq_includedir; do
2197 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2201 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2204 SAVE_CPPFLAGS="$CPPFLAGS"
2205 CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2207 AC_CHECK_HEADERS(libpq-fe.h, [],
2208 [with_libpq="no (libpq-fe.h not found)"], [])
2210 CPPFLAGS="$SAVE_CPPFLAGS"
2212 if test "x$with_libpq" = "xyes"
2214 with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2217 if test $pg_config_status -eq 0
2219 if test -n "$with_libpq_libdir"; then
2220 for dir in $with_libpq_libdir; do
2221 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2225 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2228 SAVE_LDFLAGS="$LDFLAGS"
2229 LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2231 AC_CHECK_LIB(pq, PQconnectdb,
2233 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2235 LDFLAGS="$SAVE_LDFLAGS"
2237 if test "x$with_libpq" = "xyes"
2239 BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2240 BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2241 AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2242 AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2244 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2246 dnl Check for libvirt and libxml2 libraries.
2247 with_libxml2="no (pkg-config isn't available)"
2248 with_libxml2_cflags=""
2249 with_libxml2_ldflags=""
2250 with_libvirt="no (pkg-config isn't available)"
2251 with_libvirt_cflags=""
2252 with_libvirt_ldflags=""
2253 if test "x$PKG_CONFIG" != "x"
2255 pkg-config --exists 'libxml-2.0' 2>/dev/null
2260 with_libxml2="no (pkg-config doesn't know library)"
2263 pkg-config --exists libvirt 2>/dev/null
2268 with_libvirt="no (pkg-config doesn't know library)"
2271 if test "x$with_libxml2" = "xyes"
2273 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2278 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2284 if test "x$with_libxml2" = "xyes"
2286 SAVE_CPPFLAGS="$CPPFLAGS"
2287 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2289 AC_CHECK_HEADERS(libxml/parser.h, [],
2290 [with_libxml2="no (libxml/parser.h not found)"])
2292 CPPFLAGS="$SAVE_CPPFLAGS"
2294 if test "x$with_libxml2" = "xyes"
2296 SAVE_CFLAGS="$CFLAGS"
2297 SAVE_LDFLAGS="$LDFLAGS"
2299 CFLAGS="$CFLAGS $with_libxml2_cflags"
2300 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2302 AC_CHECK_LIB(xml2, xmlXPathEval,
2303 [with_libxml2="yes"],
2304 [with_libxml2="no (symbol xmlXPathEval not found)"])
2306 CFLAGS="$SAVE_CFLAGS"
2307 LDFLAGS="$SAVE_LDFLAGS"
2309 dnl Add the right compiler flags and libraries.
2310 if test "x$with_libxml2" = "xyes"; then
2311 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2312 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2313 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2314 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2316 if test "x$with_libvirt" = "xyes"
2318 with_libvirt_cflags="`pkg-config --cflags libvirt`"
2323 with_libvirt_ldflags="`pkg-config --libs libvirt`"
2329 if test "x$with_libvirt" = "xyes"
2331 SAVE_CPPFLAGS="$CPPFLAGS"
2332 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2334 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2335 [with_libvirt="no (libvirt/libvirt.h not found)"])
2337 CPPFLAGS="$SAVE_CPPFLAGS"
2339 if test "x$with_libvirt" = "xyes"
2341 SAVE_CFLAGS="$CFLAGS"
2342 SAVE_LDFLAGS="$LDFLAGS"
2344 CFLAGS="$CFLAGS $with_libvirt_cflags"
2345 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2347 AC_CHECK_LIB(virt, virDomainBlockStats,
2348 [with_libvirt="yes"],
2349 [with_libvirt="no (symbol virDomainBlockStats not found)"])
2351 CFLAGS="$SAVE_CFLAGS"
2352 LDFLAGS="$SAVE_LDFLAGS"
2354 dnl Add the right compiler flags and libraries.
2355 if test "x$with_libvirt" = "xyes"; then
2356 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2357 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2358 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2359 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2362 dnl End of check for libvirt and libxml2 libraries.
2364 # Check for enabled/disabled features
2367 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2368 # ------------------------------------------------------------
2370 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2375 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2380 m4_define([EnDis],[disabled])dnl
2381 m4_define([YesNo],[no])dnl
2387 m4_define([EnDis],[enabled])dnl
2388 m4_define([YesNo],[yes])dnl
2391 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2395 m4_if([$3], [feature], [],
2399 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2405 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2407 enable_$1='[YesNo]'dnl
2409 if test "x$enable_$1" = "xno"
2413 if test "x$enable_$1" = "xyes"
2417 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
2422 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
2423 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
2425 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
2427 # AC_PLUGIN(name, default, info)
2428 # ------------------------------------------------------------
2434 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
2436 if test "x$enableval" = "xyes"
2444 if test "x$2" = "xyes"
2451 if test "x$enable_plugin" = "xyes"
2453 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
2455 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
2456 enable_$1="$enable_plugin"
2458 )# AC_PLUGIN(name, default, info)
2460 m4_divert_once([HELP_ENABLE], [
2461 collectd features:])
2462 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
2463 AC_COLLECTD([debug], [enable], [feature], [debugging])
2464 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
2465 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
2474 plugin_interface="no"
2481 plugin_multimeter="no"
2484 plugin_processes="no"
2488 plugin_tcpconns="no"
2493 plugin_wireless="no"
2496 if test "x$ac_system" = "xLinux"
2498 plugin_battery="yes"
2500 plugin_cpufreq="yes"
2502 plugin_entropy="yes"
2503 plugin_interface="yes"
2508 plugin_processes="yes"
2511 plugin_tcpconns="yes"
2512 plugin_thermal="yes"
2514 plugin_vserver="yes"
2515 plugin_wireless="yes"
2517 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2524 if test "x$with_libiokit" = "xyes"
2526 plugin_battery="yes"
2531 if test "x$with_devinfo$with_kstat" = "xyesyes"
2535 plugin_interface="yes"
2542 if test "x$with_libstatgrab" = "xyes"
2546 plugin_interface="yes"
2553 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
2558 if test "x$with_libopenipmipthread" = "xyes"
2563 if test "x$have_processor_info" = "xyes"
2567 if test "x$have_sysctlbyname" = "xyes"
2571 plugin_tcpconns="yes"
2574 if test "x$have_statfs" = "xyes"
2578 if test "x$have_statvfs" = "xyes"
2583 if test "x$have_getifaddrs" = "xyes"
2585 plugin_interface="yes"
2588 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
2590 plugin_libvirt="yes"
2593 if test "x$have_getloadavg" = "xyes"
2598 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
2603 # Mac OS X memory interface
2604 if test "x$have_host_statistics" = "xyes"
2609 if test "x$have_termios_h" = "xyes"
2611 plugin_multimeter="yes"
2614 if test "x$have_thread_info" = "xyes"
2616 plugin_processes="yes"
2619 if test "x$with_libkvm" = "xyes"
2621 plugin_processes="yes"
2625 if test "x$have_getutent" = "xyes"
2629 if test "x$have_getutxent" = "xyes"
2634 # FIXME: sysctl for swap plugin
2636 m4_divert_once([HELP_ENABLE], [
2639 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2640 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2641 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2642 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
2643 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2644 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2645 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2646 AC_PLUGIN([csv], [yes], [CSV output plugin])
2647 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
2648 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2649 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2650 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2651 AC_PLUGIN([email], [yes], [EMail statistics])
2652 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2653 AC_PLUGIN([exec], [yes], [Execution of external programs])
2654 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2655 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2656 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2657 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
2658 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2659 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2660 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2661 AC_PLUGIN([load], [$plugin_load], [System load])
2662 AC_PLUGIN([logfile], [yes], [File logging plugin])
2663 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2664 AC_PLUGIN([memcached], [yes], [memcached statistics])
2665 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2666 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2667 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2668 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2669 AC_PLUGIN([network], [yes], [Network communication plugin])
2670 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2671 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2672 AC_PLUGIN([notify_email], [$with_libesmtp], [Email notifier])
2673 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2674 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2675 AC_PLUGIN([onewire], [$with_libowcapi], [OneWire sensor statistics])
2676 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2677 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2678 AC_PLUGIN([postgresql], [$with_libpq], [PostgreSQL database statistics])
2679 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
2680 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2681 AC_PLUGIN([qmail], [yes], [QMail queue statistics])
2682 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2683 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2684 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2685 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2686 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2687 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2688 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
2689 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2690 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2691 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
2692 AC_PLUGIN([thermal], [$plugin_thermal], [Linux ACPI thermal zone statistics])
2693 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2694 AC_PLUGIN([users], [$plugin_users], [User statistics])
2695 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2696 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
2697 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2698 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2699 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2702 if test "x$ac_system" = "xLinux" \
2703 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2705 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2709 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2711 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2713 PERL_BINDINGS_OPTIONS="$withval"
2714 with_perl_bindings="yes"
2716 PERL_BINDINGS_OPTIONS=""
2717 with_perl_bindings="$withval"
2721 PERL_BINDINGS_OPTIONS=""
2722 if test -n "$perl_interpreter"
2724 with_perl_bindings="yes"
2726 with_perl_bindings="no (no perl interpreter found)"
2729 if test "x$with_perl_bindings" = "xyes"
2731 PERL_BINDINGS="perl"
2735 AC_SUBST(PERL_BINDINGS)
2736 AC_SUBST(PERL_BINDINGS_OPTIONS)
2738 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2740 if test "x$with_rrdtool" = "xyes" \
2741 && test "x$librrd_threadsafe" != "xyes"
2743 with_rrdtool="yes (warning: librrd is not thread-safe)"
2746 if test "x$with_liboping" = "xyes" \
2747 && test "x$with_own_liboping" = "xyes"
2749 with_liboping="yes (shipped version)"
2752 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
2754 with_libiptc="yes (shipped version)"
2757 if test "x$with_libperl" = "xyes"
2759 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2761 enable_perl="no (needs libperl)"
2764 if test "x$with_perl_bindings" = "xyes" \
2765 && test "x$PERL_BINDINGS_OPTIONS" != "x"
2767 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2774 libcurl . . . . . . . $with_libcurl
2775 libesmtp . . . . . . $with_libesmtp
2776 libiokit . . . . . . $with_libiokit
2777 libiptc . . . . . . . $with_libiptc
2778 libkstat . . . . . . $with_kstat
2779 libkvm . . . . . . . $with_libkvm
2780 libmysql . . . . . . $with_libmysql
2781 libnetlink . . . . . $with_libnetlink
2782 libnetsnmp . . . . . $with_libnetsnmp
2783 libnotify . . . . . . $with_libnotify
2784 liboconfig . . . . . $with_liboconfig
2785 libopenipmi . . . . . $with_libopenipmipthread
2786 liboping . . . . . . $with_liboping
2787 libpcap . . . . . . . $with_libpcap
2788 libperl . . . . . . . $with_libperl
2789 libpthread . . . . . $with_libpthread
2790 libpq . . . . . . . . $with_libpq
2791 librrd . . . . . . . $with_rrdtool
2792 libsensors . . . . . $with_lm_sensors
2793 libstatgrab . . . . . $with_libstatgrab
2794 libupsclient . . . . $with_libupsclient
2795 libvirt . . . . . . . $with_libvirt
2796 libxml2 . . . . . . . $with_libxml2
2797 libxmms . . . . . . . $with_libxmms
2800 daemon mode . . . . . $enable_daemon
2801 debug . . . . . . . . $enable_debug
2804 perl . . . . . . . . $with_perl_bindings
2807 apache . . . . . . . $enable_apache
2808 apcups . . . . . . . $enable_apcups
2809 apple_sensors . . . . $enable_apple_sensors
2810 ascent . . . . . . . $enable_ascent
2811 battery . . . . . . . $enable_battery
2812 cpu . . . . . . . . . $enable_cpu
2813 cpufreq . . . . . . . $enable_cpufreq
2814 csv . . . . . . . . . $enable_csv
2815 df . . . . . . . . . $enable_df
2816 disk . . . . . . . . $enable_disk
2817 dns . . . . . . . . . $enable_dns
2818 email . . . . . . . . $enable_email
2819 entropy . . . . . . . $enable_entropy
2820 exec . . . . . . . . $enable_exec
2821 hddtemp . . . . . . . $enable_hddtemp
2822 interface . . . . . . $enable_interface
2823 iptables . . . . . . $enable_iptables
2824 ipmi . . . . . . . . $enable_ipmi
2825 ipvs . . . . . . . . $enable_ipvs
2826 irq . . . . . . . . . $enable_irq
2827 libvirt . . . . . . . $enable_libvirt
2828 load . . . . . . . . $enable_load
2829 logfile . . . . . . . $enable_logfile
2830 mbmon . . . . . . . . $enable_mbmon
2831 memcached . . . . . . $enable_memcached
2832 memory . . . . . . . $enable_memory
2833 multimeter . . . . . $enable_multimeter
2834 mysql . . . . . . . . $enable_mysql
2835 netlink . . . . . . . $enable_netlink
2836 network . . . . . . . $enable_network
2837 nfs . . . . . . . . . $enable_nfs
2838 nginx . . . . . . . . $enable_nginx
2839 notify_desktop . . . $enable_notify_desktop
2840 notify_email . . . . $enable_notify_email
2841 ntpd . . . . . . . . $enable_ntpd
2842 nut . . . . . . . . . $enable_nut
2843 onewire . . . . . . . $enable_onewire
2844 perl . . . . . . . . $enable_perl
2845 ping . . . . . . . . $enable_ping
2846 postgresql . . . . . $enable_postgresql
2847 powerdns . . . . . . $enable_powerdns
2848 processes . . . . . . $enable_processes
2849 qmail . . . . . . . . $enable_qmail
2850 rrdtool . . . . . . . $enable_rrdtool
2851 sensors . . . . . . . $enable_sensors
2852 serial . . . . . . . $enable_serial
2853 snmp . . . . . . . . $enable_snmp
2854 swap . . . . . . . . $enable_swap
2855 syslog . . . . . . . $enable_syslog
2856 tail . . . . . . . . $enable_tail
2857 tape . . . . . . . . $enable_tape
2858 tcpconns . . . . . . $enable_tcpconns
2859 teamspeak2 . . . . . $enable_teamspeak2
2860 thermal . . . . . . . $enable_thermal
2861 unixsock . . . . . . $enable_unixsock
2862 users . . . . . . . . $enable_users
2863 uuid . . . . . . . . $enable_uuid
2864 vmem . . . . . . . . $enable_vmem
2865 vserver . . . . . . . $enable_vserver
2866 wireless . . . . . . $enable_wireless
2867 xmms . . . . . . . . $enable_xmms