1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 4.0.4)
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.
20 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
24 AC_LIBLTDL_CONVENIENCE
31 AC_CONFIG_SUBDIRS(libltdl)
34 # Checks for header files.
39 AC_CHECK_HEADERS(stdint.h)
40 AC_CHECK_HEADERS(stdio.h)
41 AC_CHECK_HEADERS(errno.h)
42 AC_CHECK_HEADERS(math.h)
43 AC_CHECK_HEADERS(syslog.h)
44 AC_CHECK_HEADERS(fcntl.h)
45 AC_CHECK_HEADERS(signal.h)
46 AC_CHECK_HEADERS(assert.h)
47 AC_CHECK_HEADERS(sys/types.h)
48 AC_CHECK_HEADERS(sys/socket.h)
49 AC_CHECK_HEADERS(sys/select.h)
50 AC_CHECK_HEADERS(poll.h)
51 AC_CHECK_HEADERS(netdb.h)
52 AC_CHECK_HEADERS(arpa/inet.h)
53 AC_CHECK_HEADERS(sys/resource.h)
54 AC_CHECK_HEADERS(sys/param.h)
55 AC_CHECK_HEADERS(kstat.h)
58 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
63 # include <sys/types.h>
66 AC_CHECK_HEADERS(netinet/in.h, [], [],
71 # include <sys/types.h>
73 #if HAVE_NETINET_IN_SYSTM_H
74 # include <netinet/in_systm.h>
77 AC_CHECK_HEADERS(netinet/ip.h, [], [],
82 # include <sys/types.h>
84 #if HAVE_NETINET_IN_SYSTM_H
85 # include <netinet/in_systm.h>
88 # include <netinet/in.h>
91 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
96 # include <sys/types.h>
98 #if HAVE_NETINET_IN_SYSTM_H
99 # include <netinet/in_systm.h>
101 #if HAVE_NETINET_IN_H
102 # include <netinet/in.h>
104 #if HAVE_NETINET_IP_H
105 # include <netinet/ip.h>
108 AC_CHECK_HEADERS(netinet/ip_var.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/ip6.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>
139 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
144 # include <sys/types.h>
146 #if HAVE_NETINET_IN_SYSTM_H
147 # include <netinet/in_systm.h>
149 #if HAVE_NETINET_IN_H
150 # include <netinet/in.h>
152 #if HAVE_NETINET_IP6_H
153 # include <netinet/ip6.h>
156 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
161 # include <sys/types.h>
163 #if HAVE_NETINET_IN_SYSTM_H
164 # include <netinet/in_systm.h>
166 #if HAVE_NETINET_IN_H
167 # include <netinet/in.h>
169 #if HAVE_NETINET_IP_H
170 # include <netinet/ip.h>
173 AC_CHECK_HEADERS(netinet/udp.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>
192 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
195 # include <sys/types.h>
198 # include <sys/param.h>
201 AC_CHECK_HEADERS(sys/dkstat.h)
202 AC_CHECK_HEADERS(mach/mach_init.h)
203 AC_CHECK_HEADERS(mach/host_priv.h)
204 AC_CHECK_HEADERS(mach/mach_error.h)
205 AC_CHECK_HEADERS(mach/mach_host.h)
206 AC_CHECK_HEADERS(mach/mach_port.h)
207 AC_CHECK_HEADERS(mach/mach_types.h)
208 AC_CHECK_HEADERS(mach/message.h)
209 AC_CHECK_HEADERS(mach/processor_set.h)
210 AC_CHECK_HEADERS(mach/processor.h)
211 AC_CHECK_HEADERS(mach/processor_info.h)
212 AC_CHECK_HEADERS(mach/task.h)
213 AC_CHECK_HEADERS(mach/thread_act.h)
214 AC_CHECK_HEADERS(mach/vm_region.h)
215 AC_CHECK_HEADERS(mach/vm_map.h)
216 AC_CHECK_HEADERS(mach/vm_prot.h)
217 AC_CHECK_HEADERS(mach/vm_statistics.h)
218 AC_CHECK_HEADERS(mach/kern_return.h)
221 AC_CHECK_HEADERS(linux/major.h)
222 AC_CHECK_HEADERS(libgen.h)
224 # For the apple_sensors module
225 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
226 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
227 AC_CHECK_HEADERS(IOKit/IOTypes.h)
229 # For the battery plugin
230 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
232 #if HAVE_IOKIT_IOKITLIB_H
233 # include <IOKit/IOKitLib.h>
235 #if HAVE_IOKIT_IOTYPES_H
236 # include <IOKit/IOTypes.h>
239 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
241 # For the `disk' plugin
242 AC_CHECK_HEADERS(IOKit/IOBSD.h)
243 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
246 AC_CHECK_HEADERS(sys/loadavg.h)
248 # For the processes plugin
249 AC_CHECK_HEADERS(linux/config.h)
251 # For the swap module
252 AC_CHECK_HEADERS(sys/swap.h, [], [],
255 # include <sys/types.h>
258 # include <sys/param.h>
263 AC_CHECK_HEADERS(utmp.h)
264 AC_CHECK_HEADERS(utmpx.h)
266 # For interface plugin
267 AC_CHECK_HEADERS(ifaddrs.h)
268 AC_CHECK_HEADERS(net/if.h, [], [],
271 # include <sys/types.h>
273 #if HAVE_SYS_SOCKET_H
274 # include <sys/socket.h>
277 AC_CHECK_HEADERS(linux/if.h, [], [],
280 # include <sys/types.h>
282 #if HAVE_SYS_SOCKET_H
283 # include <sys/socket.h>
286 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
289 # include <sys/types.h>
291 #if HAVE_SYS_SOCKET_H
292 # include <sys/socket.h>
295 # include <linux/if.h>
300 AC_CHECK_HEADERS(curl/curl.h)
303 AC_CHECK_HEADERS(pwd.h)
304 AC_CHECK_HEADERS(sys/ucred.h, [], [],
307 # include <sys/types.h>
310 # include <sys/param.h>
313 AC_CHECK_HEADERS(ctype.h)
314 AC_CHECK_HEADERS(limits.h)
315 AC_CHECK_HEADERS(sys/quota.h)
316 AC_CHECK_HEADERS(xfs/xqm.h)
318 # For mount interface
319 AC_CHECK_HEADERS(fs_info.h)
320 AC_CHECK_HEADERS(fshelp.h)
321 AC_CHECK_HEADERS(paths.h)
322 AC_CHECK_HEADERS(mntent.h)
323 AC_CHECK_HEADERS(mnttab.h)
324 AC_CHECK_HEADERS(sys/fstyp.h)
325 AC_CHECK_HEADERS(sys/fs_types.h)
326 AC_CHECK_HEADERS(sys/mntent.h)
327 AC_CHECK_HEADERS(sys/mnttab.h)
328 AC_CHECK_HEADERS(sys/mount.h, [], [],
331 # include <sys/types.h>
334 # include <sys/param.h>
337 AC_CHECK_HEADERS(sys/statfs.h)
338 AC_CHECK_HEADERS(sys/statvfs.h)
339 AC_CHECK_HEADERS(sys/vfs.h)
340 AC_CHECK_HEADERS(sys/vfstab.h)
342 # For the swap plugin, FreeBSD
343 AC_CHECK_HEADERS(kvm.h)
345 # For the email plugin
346 AC_CHECK_HEADERS(linux/un.h, [], [],
348 #if HAVE_SYS_SOCKET_H
349 # include <sys/socket.h>
352 AC_CHECK_HEADERS(sys/un.h)
353 AC_CHECK_HEADERS(grp.h)
355 # For debugging interface (variable number of arguments)
356 AC_CHECK_HEADERS(stdarg.h)
358 # Regular expressions for the ignorelist.
359 AC_CHECK_HEADERS(regex.h)
362 AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
364 AC_CHECK_HEADERS(net/if_arp.h, [], [],
365 [#if HAVE_SYS_SOCKET_H
366 # include <sys/socket.h>
369 AC_CHECK_HEADERS(net/ppp_defs.h)
370 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
371 [#if HAVE_NET_PPP_DEFS_H
372 # include <net/ppp_defs.h>
375 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
380 # include <sys/types.h>
382 #if HAVE_SYS_SOCKET_H
383 # include <sys/socket.h>
388 #if HAVE_NETINET_IN_H
389 # include <netinet/in.h>
393 # For the multimeter plugin
394 AC_CHECK_HEADERS(termios.h)
395 AC_CHECK_HEADERS(sys/ioctl.h)
398 # Checking for libraries
403 # Checks for typedefs, structures, and compiler characteristics.
412 # Checks for library functions.
414 AC_PROG_GCC_TRADITIONAL
415 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
416 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
417 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
418 AC_CHECK_FUNCS(strncasecmp strcasecmp)
419 AC_CHECK_FUNCS(openlog syslog closelog)
421 socket_needs_socket="no"
422 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
423 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
425 nanosleep_needs_rt="no"
426 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
427 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
429 # Regular expressions for the ignorelist.
430 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
433 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
436 AC_CHECK_FUNCS(statfs statvfs)
439 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
441 # For the `processes' plugin
442 AC_CHECK_FUNCS(thread_info)
445 AC_CHECK_FUNCS(getutent getutxent)
448 AC_CHECK_FUNCS(quotactl)
449 AC_CHECK_FUNCS(getgrgid getpwuid)
451 # For interface module
452 AC_CHECK_FUNCS(getifaddrs)
455 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
457 if test "x$withval" = "xno"; then
459 else if test "x$withval" = "xyes"; then
466 if test "x$nan_type" = "xnone"; then
467 AC_CACHE_CHECK([whether NAN is defined by default],
474 static float foo = NAN;
482 [have_nan_default="yes"],
483 [have_nan_default="no"]
486 if test "x$have_nan_default" = "xyes"
491 if test "x$nan_type" = "xnone"; then
492 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
498 #define __USE_ISOC99 1
500 static float foo = NAN;
508 [have_nan_isoc="yes"],
512 if test "x$have_nan_isoc" = "xyes"
517 if test "x$nan_type" = "xnone"; then
518 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
528 #define NAN (0.0 / 0.0)
530 # define isnan(f) ((f) != (f))
532 static float foo = NAN;
540 [have_nan_zero="yes"],
544 if test "x$have_nan_zero" = "xyes"
550 if test "x$nan_type" = "xdefault"; then
551 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
552 [Define if NAN is defined by default and can initialize static variables.])
553 else if test "x$nan_type" = "xisoc99"; then
554 AC_DEFINE(NAN_STATIC_ISOC, 1,
555 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
556 else if test "x$nan_type" = "xzero"; then
557 AC_DEFINE(NAN_ZERO_ZERO, 1,
558 [Define if NAN can be defined as (0.0 / 0.0)])
560 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
563 # For mount interface
564 #AC_CHECK_FUNCS(getfsent getvfsent)
567 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
569 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
571 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
574 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
575 if test "x$have_getmntent" = "xno"; then
576 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
578 if test "x$have_getmntent" = "xno"; then
579 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
581 if test "x$have_getmntent" = "xno"; then
582 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
585 if test "x$have_getmntent" = "xc"; then
586 AC_CACHE_CHECK([whether getmntent takes one argument],
587 [have_one_getmntent],
589 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
591 #include "$srcdir/src/utils_mount.h"]],
595 fh = setmntent ("/etc/mtab", "r");
599 [have_one_getmntent="yes"],
600 [have_one_getmntent="no"]
603 AC_CACHE_CHECK([whether getmntent takes two arguments],
604 [have_two_getmntent],
606 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
607 #include <sys/mnttab.h>
608 #include "$srcdir/src/utils_mount.h"]],
613 fh = fopen ("/etc/mnttab", "r");
614 status = getmntent (fh, &mt);
617 [have_two_getmntent="yes"],
618 [have_two_getmntent="no"]
623 # Check for different versions of `getmntent' here..
625 if test "x$have_getmntent" = "xc"; then
626 if test "x$have_one_getmntent" = "xyes"; then
627 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
628 [Define if the function getmntent exists and takes one argument.])
630 if test "x$have_two_getmntent" = "xyes"; then
631 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
632 [Define if the function getmntent exists and takes two arguments.])
635 if test "x$have_getmntent" = "xsun"; then
636 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
637 [Define if the function getmntent exists. It's the version from libsun.])
639 if test "x$have_getmntent" = "xseq"; then
640 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
641 [Define if the function getmntent exists. It's the version from libseq.])
643 if test "x$have_getmntent" = "xgen"; then
644 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
645 [Define if the function getmntent exists. It's the version from libgen.])
648 # Check for structures
649 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
650 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
653 #include <sys/types.h>
654 #include <sys/socket.h>
657 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
658 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
661 #include <sys/types.h>
662 #include <sys/socket.h>
663 #include <linux/if.h>
664 #include <linux/netdevice.h>
667 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
672 # include <sys/types.h>
674 #if HAVE_NETINET_IN_SYSTM_H
675 # include <netinet/in_systm.h>
677 #if HAVE_NETINET_IN_H
678 # include <netinet/in.h>
680 #if HAVE_NETINET_IP_H
681 # include <netinet/ip.h>
683 #if HAVE_NETINET_UDP_H
684 # include <netinet/udp.h>
687 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
692 # include <sys/types.h>
694 #if HAVE_NETINET_IN_SYSTM_H
695 # include <netinet/in_systm.h>
697 #if HAVE_NETINET_IN_H
698 # include <netinet/in.h>
700 #if HAVE_NETINET_IP_H
701 # include <netinet/ip.h>
703 #if HAVE_NETINET_UDP_H
704 # include <netinet/udp.h>
708 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
717 AC_MSG_CHECKING([for kernel type ($host_os)])
720 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
724 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
730 AC_MSG_RESULT([$ac_system])
733 AC_CHECK_LIB(resolv, res_search,
735 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
737 [with_libresolv="no"])
738 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
741 m4_divert_once([HELP_WITH], [
742 collectd additional packages:])
744 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
745 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
746 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
748 LDFLAGS="$LDFLAGS -L$withval/lib"
749 CPPFLAGS="$CPPFLAGS -I$withval/include"
752 ], [with_rrdtool="yes"])
753 if test "x$with_rrdtool" = "xyes"
755 AC_CHECK_LIB(rrd, rrd_update,
757 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
759 [with_rrdtool="no (librrd not found)"], [-lm])
761 if test "x$with_rrdtool" = "xyes"
763 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
765 if test "x$with_rrdtool" = "xyes"
771 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
772 [Wether or not to use rrdtool library])
773 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
775 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
776 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
778 LDFLAGS="$LDFLAGS -L$withval/lib"
779 CPPFLAGS="$CPPFLAGS -I$withval/include"
780 with_libpthread="yes"
782 if test "x$withval" = "xno"
784 with_libpthread="no (disabled)"
787 ], [with_libpthread="yes"])
788 if test "x$with_libpthread" = "xyes"
790 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
792 if test "x$with_libpthread" = "xyes"
794 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
796 if test "x$with_libpthread" = "xyes"
802 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
803 [Wether or not to use pthread (POSIX threads) library])
804 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
806 if test "$ac_system" = "Solaris"
811 with_kstat="no (Solaris only)"
812 with_devinfo="no (Solaris only)"
815 if test "x$with_kstat" = "xyes"
817 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
819 if test "x$with_kstat" = "xyes"
821 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
822 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
824 if test "x$with_kstat" = "xyes"
826 AC_DEFINE(HAVE_LIBKSTAT, 1,
827 [Define to 1 if you have the 'kstat' library (-lkstat)])
829 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
830 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
832 ### BEGIN of check for libcurl ###
833 with_curl_config="curl-config"
836 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
838 if test "x$withval" != "xno" -a "x$withval" != "xyes"
840 if test -x "$withval/bin/curl-config"
842 with_curl_config="$withval/bin/curl-config"
846 if test "x$withval" = "xno"
856 if test "x$with_libcurl" = "xyes"
858 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
859 curl_config_status=$?
861 if test $curl_config_status -ne 0
865 AC_CHECK_LIB(curl, curl_easy_init,
867 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
868 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
876 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
878 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
879 curl_config_status=$?
881 if test $curl_config_status -ne 0
885 if test -d "$with_curl_prefix/include"
887 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
892 with_libcurl_numeric=0
893 if test "x$with_libcurl" = "xyes"
895 with_libcurl_numeric=1
897 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
898 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
899 ### END of check for libcurl ###
903 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
912 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
913 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
915 with_libstatgrab="yes"
917 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
919 if test "x$withval" != "xno" -a "x$withval" != "xyes"
921 LDFLAGS="$LDFLAGS -L$withval/lib"
922 CPPFLAGS="$CPPFLAGS -I$withval/include"
923 with_libstatgrab="yes"
927 if test "x$ac_system" == "xunknown"
929 with_libstatgrab="yes"
931 with_libstatgrab="no"
934 if test "x$with_libstatgrab" = "xyes"
936 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
938 if test "x$with_libstatgrab" = "xyes"
940 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
942 if test "x$with_libstatgrab" = "xyes"
944 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
946 if test "x$with_libstatgrab" = "xyes"
948 collect_libstatgrab=1
950 collect_libstatgrab=0
952 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
953 [Wether or not to use statgrab library])
954 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
955 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
957 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
958 if test "x$with_libkvm" = "xyes"
960 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
962 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
964 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
966 if test "x$withval" != "xno" && test "x$withval" != "xyes"
968 LDFLAGS="$LDFLAGS -L$withval/lib"
969 CPPFLAGS="$CPPFLAGS -I$withval/include"
970 with_lm_sensors="yes"
974 if test "x$ac_system" = "xLinux"
976 with_lm_sensors="yes"
981 if test "x$with_lm_sensors" = "xyes"
983 AC_CHECK_LIB(sensors, sensors_init,
985 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
987 [with_lm_sensors="no (libsensors not found)"])
989 if test "x$with_lm_sensors" = "xyes"
991 AC_CHECK_HEADERS(sensors/sensors.h,
993 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
995 [with_lm_sensors="no (sensors/sensors.h not found)"])
997 if test "x$with_lm_sensors" = "xyes"
1001 collect_lm_sensors=0
1003 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
1004 [Wether or not to use sensors library])
1005 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1007 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1009 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1011 LDFLAGS="$LDFLAGS -L$withval/lib"
1012 CPPFLAGS="$CPPFLAGS -I$withval/include"
1019 if test "x$with_libmysql" = "xyes"
1021 AC_CHECK_LIB(mysqlclient, mysql_init,
1023 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
1024 ], [with_libmysql="no (libmysql not found)"])
1026 if test "x$with_libmysql" = "xyes"
1028 AC_CHECK_HEADERS(mysql/mysql.h,
1030 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
1031 ], [with_libmysql="no (mysql/mysql.h not found)"])
1033 if test "x$with_libmysql" = "xyes"
1039 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
1040 [Wether or not to use mysql library])
1041 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1043 with_own_liboconfig="no"
1044 liboconfig_LDFLAGS="$LDFLAGS"
1045 liboconfig_CPPFLAGS="$CPPFLAGS"
1046 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1048 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1050 if test -d "$withval/lib"
1052 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1054 if test -d "$withval/include"
1056 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1059 if test "x$withval" = "xno"
1061 AC_MSG_ERROR("liboconfig is required")
1065 with_liboconfig="yes"
1068 save_LDFLAGS="$LDFLAGS"
1069 save_CPPFLAGS="$CPPFLAGS"
1070 LDFLAGS="$liboconfig_LDFLAGS"
1071 CPPFLAGS="$liboconfig_CPPFLAGS"
1072 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1074 with_liboconfig="yes"
1075 with_own_liboconfig="no"
1078 with_liboconfig="yes"
1079 with_own_liboconfig="yes"
1080 LDFLAGS="$save_LDFLAGS"
1081 CPPFLAGS="$save_CPPFLAGS"
1084 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1085 if test "x$with_own_liboconfig" = "xyes"
1087 with_liboconfig="yes (shipped version)"
1090 #with_liboping="yes"
1091 with_own_liboping="no"
1092 liboping_LDFLAGS="$LDFLAGS"
1093 liboping_CPPFLAGS="$CPPFLAGS"
1094 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1096 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1098 if test -d "$withval/lib"
1100 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1102 if test -d "$withval/include"
1104 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1107 if test "x$withval" = "xno"
1110 with_own_liboping="no"
1118 if test "x$with_liboping" = "xyes"
1120 save_LDFLAGS="$LDFLAGS"
1121 save_CPPFLAGS="$CPPFLAGS"
1122 LDFLAGS="$liboping_LDFLAGS"
1123 CPPFLAGS="$liboping_CPPFLAGS"
1124 AC_CHECK_LIB(oping, ping_construct,
1127 with_own_liboping="no"
1131 with_own_liboping="yes"
1132 LDFLAGS="$save_LDFLAGS"
1133 CPPFLAGS="$save_CPPFLAGS"
1136 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1137 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1138 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1140 with_liboping="yes (shipped version)"
1143 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1145 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1147 LDFLAGS="$LDFLAGS -L$withval/lib"
1148 CPPFLAGS="$CPPFLAGS -I$withval/include"
1155 if test "x$with_libpcap" = "xyes"
1157 AC_CHECK_LIB(pcap, pcap_open_live,
1159 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1160 ], [with_libpcap="no (libpcap not found)"])
1162 if test "x$with_libpcap" = "xyes"
1164 AC_CHECK_HEADERS(pcap.h,
1166 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1167 ], [with_libpcap="no (pcap.h not found)"])
1169 if test "x$with_libpcap" = "xyes"
1175 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1176 [Wether or not to use the pcap library])
1177 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1179 perl_interpreter="perl"
1180 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1182 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1184 LDFLAGS="$LDFLAGS -L$withval/lib"
1185 CPPFLAGS="$CPPFLAGS -I$withval/include"
1186 perl_interpreter="$withval/bin/perl"
1193 if test "x$with_libperl" = "xyes"
1196 SAVE_LDFLAGS=$LDFLAGS
1197 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1198 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1199 CFLAGS="$CFLAGS $PERL_CFLAGS"
1200 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1202 AC_CACHE_CHECK([for libperl],
1212 PerlInterpreter *perl = NULL;
1213 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1214 newSVpv ("Collectd::Plugin::FooBar", 24),
1217 [have_libperl="yes"],
1222 if test "x$have_libperl" = "xyes"
1224 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1225 AC_SUBST(PERL_CFLAGS)
1226 AC_SUBST(PERL_LDFLAGS)
1232 LDFLAGS=$SAVE_LDFLAGS
1234 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1236 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1238 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1240 LDFLAGS="$LDFLAGS -L$withval/lib"
1241 CPPFLAGS="$CPPFLAGS -I$withval/include"
1246 if test "x$ac_system" = "xLinux"
1250 with_libiptc="no (Linux only)"
1253 if test "x$with_libiptc" = "xyes"
1255 AC_CHECK_LIB(iptc, iptc_init,
1257 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1258 ], [with_libiptc="no (libiptc not found)"])
1260 if test "x$with_libiptc" = "xyes"
1262 AC_CHECK_HEADERS(libiptc/libiptc.h,
1264 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1265 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1267 if test "x$with_libiptc" = "xyes"
1273 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1275 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1277 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1279 LDFLAGS="$LDFLAGS -L$withval/lib"
1280 CPPFLAGS="$CPPFLAGS -I$withval/include"
1281 with_libupsclient="yes"
1285 with_libupsclient="yes"
1287 if test "x$with_libupsclient" = "xyes"
1289 AC_CHECK_LIB(upsclient, upscli_connect,
1291 AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
1292 ], [with_libupsclient="no (libupsclient not found)"])
1294 if test "x$with_libupsclient" = "xyes"
1296 AC_CHECK_HEADERS(upsclient.h,
1298 AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the <upsclient.h> header file.])
1299 ], [with_libupsclient="no (upsclient.h not found)"])
1301 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1303 # Check for enabled/disabled features
1306 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1307 # ------------------------------------------------------------
1309 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1314 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1319 m4_define([EnDis],[disabled])dnl
1320 m4_define([YesNo],[no])dnl
1326 m4_define([EnDis],[enabled])dnl
1327 m4_define([YesNo],[yes])dnl
1330 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1334 m4_if([$3], [feature], [],
1338 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1344 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1346 enable_$1='[YesNo]'dnl
1348 if test "x$enable_$1" = "xno"
1352 if test "x$enable_$1" = "xyes"
1356 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1361 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1362 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1364 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1366 m4_divert_once([HELP_ENABLE], [
1367 collectd features:])
1368 AC_COLLECTD([debug], [enable], [feature], [debugging])
1369 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1370 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1372 m4_divert_once([HELP_ENABLE], [
1374 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
1375 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
1376 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1377 AC_COLLECTD([battery], [disable], [module], [battery statistics])
1378 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
1379 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1380 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
1381 AC_COLLECTD([csv], [disable], [module], [csv output plugin])
1382 AC_COLLECTD([df], [disable], [module], [df statistics])
1383 AC_COLLECTD([dns], [disable], [module], [dns statistics])
1384 AC_COLLECTD([email], [disable], [module], [email statistics])
1385 AC_COLLECTD([entropy], [disable], [module], [entropy statistics])
1386 AC_COLLECTD([exec], [disable], [module], [exec of external programs])
1387 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
1388 AC_COLLECTD([interface], [disable], [module], [interface statistics])
1389 AC_COLLECTD([iptables], [disable], [module], [IPtables statistics])
1390 AC_COLLECTD([irq], [disable], [module], [irq statistics])
1391 AC_COLLECTD([load], [disable], [module], [system load statistics])
1392 AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
1393 AC_COLLECTD([memory], [disable], [module], [memory statistics])
1394 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1395 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
1396 AC_COLLECTD([network], [disable], [module], [network functionality])
1397 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
1398 AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
1399 AC_COLLECTD([nut], [disable], [module], [network UPS tools statistics])
1400 AC_COLLECTD([perl], [disable], [module], [embedded perl interpreter])
1401 AC_COLLECTD([ping], [disable], [module], [ping statistics])
1402 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1403 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1404 AC_COLLECTD([serial], [disable], [module], [serial statistics])
1405 AC_COLLECTD([logfile], [disable], [module], [logfile log facility])
1406 AC_COLLECTD([swap], [disable], [module], [swap statistics])
1407 AC_COLLECTD([syslog], [disable], [module], [syslog log facility])
1408 AC_COLLECTD([tape], [disable], [module], [tape statistics])
1409 AC_COLLECTD([unixsock], [disable], [module], [UNIX socket plugin])
1410 AC_COLLECTD([users], [disable], [module], [user count statistics])
1411 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
1412 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
1414 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
1416 if test "x$with_libperl" = "xyes"
1418 with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)"
1420 enable_perl="no (needs libperl)"
1427 libcurl . . . . . . $with_libcurl
1428 libiokit . . . . . $with_libiokit
1429 libiptc . . . . . . $with_libiptc
1430 libkstat . . . . . $with_kstat
1431 libmysql . . . . . $with_libmysql
1432 liboconfig . . . . $with_liboconfig
1433 liboping . . . . . $with_liboping
1434 libpcap . . . . . . $with_libpcap
1435 libperl . . . . . . $with_libperl
1436 libpthread . . . . $with_libpthread
1437 librrd . . . . . . $with_rrdtool
1438 libsensors . . . . $with_lm_sensors
1439 libstatgrab . . . . $with_libstatgrab
1440 libupsclient . . . $with_libupsclient
1443 daemon mode . . . . $enable_daemon
1444 debug . . . . . . . $enable_debug
1447 apache . . . . . . $enable_apache
1448 apcups . . . . . . $enable_apcups
1449 apple_sensors . . . $enable_apple_sensors
1450 battery . . . . . . $enable_battery
1451 cpu . . . . . . . . $enable_cpu
1452 cpufreq . . . . . . $enable_cpufreq
1453 csv . . . . . . . . $enable_csv
1454 df . . . . . . . . $enable_df
1455 disk . . . . . . . $enable_disk
1456 dns . . . . . . . . $enable_dns
1457 email . . . . . . . $enable_email
1458 entropy . . . . . . $enable_entropy
1459 exec . . . . . . . $enable_exec
1460 hddtemp . . . . . . $enable_hddtemp
1461 interface . . . . . $enable_interface
1462 iptables . . . . . $enable_iptables
1463 irq . . . . . . . . $enable_irq
1464 load . . . . . . . $enable_load
1465 logfile . . . . . . $enable_logfile
1466 mbmon . . . . . . . $enable_mbmon
1467 memory . . . . . . $enable_memory
1468 multimeter . . . . $enable_multimeter
1469 mysql . . . . . . . $enable_mysql
1470 network . . . . . . $enable_network
1471 nfs . . . . . . . . $enable_nfs
1472 ntpd . . . . . . . $enable_ntpd
1473 nut . . . . . . . . $enable_nut
1474 perl . . . . . . . $enable_perl
1475 ping . . . . . . . $enable_ping
1476 processes . . . . . $enable_processes
1477 sensors . . . . . . $enable_sensors
1478 serial . . . . . . $enable_serial
1479 swap . . . . . . . $enable_swap
1480 syslog . . . . . . $enable_syslog
1481 tape . . . . . . . $enable_tape
1482 unixsock . . . . . $enable_unixsock
1483 users . . . . . . . $enable_users
1484 vserver . . . . . . $enable_vserver
1485 wireless . . . . . $enable_wireless