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)
6 AC_LANG(C)
8 AC_PREFIX_DEFAULT("/opt/collectd")
10 AC_SYS_LARGEFILE
12 #
13 # Checks for programs.
14 #
15 AC_PROG_CC
16 AC_PROG_CPP
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
19 AC_PROG_MAKE_SET
20 AM_PROG_CC_C_O
21 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
23 dnl configure libtool
24 AC_DISABLE_STATIC
25 AC_LIBLTDL_CONVENIENCE
26 AC_SUBST(LTDLINCL)
27 AC_SUBST(LIBLTDL)
28 AC_LIBTOOL_DLOPEN
29 AC_PROG_LIBTOOL
30 AC_PROG_LEX
31 AC_PROG_YACC
32 AC_CONFIG_SUBDIRS(libltdl)
34 AC_MSG_CHECKING([for kernel type ($host_os)])
35 case $host_os in
36 *linux*)
37 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
38 ac_system="Linux"
39 ;;
40 *solaris*)
41 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
42 ac_system="Solaris"
43 ;;
44 *darwin*)
45 ac_system="Darwin"
46 ;;
47 *)
48 ac_system="unknown"
49 esac
50 AC_MSG_RESULT([$ac_system])
52 #
53 # Checks for header files.
54 #
55 AC_HEADER_STDC
56 AC_HEADER_SYS_WAIT
57 AC_HEADER_DIRENT
59 AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h)
61 # For ping library
62 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
63 [#if HAVE_STDINT_H
64 # include <stdint.h>
65 #endif
66 #if HAVE_SYS_TYPES_H
67 # include <sys/types.h>
68 #endif
69 ])
70 AC_CHECK_HEADERS(netinet/in.h, [], [],
71 [#if HAVE_STDINT_H
72 # include <stdint.h>
73 #endif
74 #if HAVE_SYS_TYPES_H
75 # include <sys/types.h>
76 #endif
77 #if HAVE_NETINET_IN_SYSTM_H
78 # include <netinet/in_systm.h>
79 #endif
80 ])
81 AC_CHECK_HEADERS(netinet/ip.h, [], [],
82 [#if HAVE_STDINT_H
83 # include <stdint.h>
84 #endif
85 #if HAVE_SYS_TYPES_H
86 # include <sys/types.h>
87 #endif
88 #if HAVE_NETINET_IN_SYSTM_H
89 # include <netinet/in_systm.h>
90 #endif
91 #if HAVE_NETINET_IN_H
92 # include <netinet/in.h>
93 #endif
94 ])
95 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
96 [#if HAVE_STDINT_H
97 # include <stdint.h>
98 #endif
99 #if HAVE_SYS_TYPES_H
100 # include <sys/types.h>
101 #endif
102 #if HAVE_NETINET_IN_SYSTM_H
103 # include <netinet/in_systm.h>
104 #endif
105 #if HAVE_NETINET_IN_H
106 # include <netinet/in.h>
107 #endif
108 #if HAVE_NETINET_IP_H
109 # include <netinet/ip.h>
110 #endif
111 ])
112 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
113 [#if HAVE_STDINT_H
114 # include <stdint.h>
115 #endif
116 #if HAVE_SYS_TYPES_H
117 # include <sys/types.h>
118 #endif
119 #if HAVE_NETINET_IN_SYSTM_H
120 # include <netinet/in_systm.h>
121 #endif
122 #if HAVE_NETINET_IN_H
123 # include <netinet/in.h>
124 #endif
125 #if HAVE_NETINET_IP_H
126 # include <netinet/ip.h>
127 #endif
128 ])
129 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
130 [#if HAVE_STDINT_H
131 # include <stdint.h>
132 #endif
133 #if HAVE_SYS_TYPES_H
134 # include <sys/types.h>
135 #endif
136 #if HAVE_NETINET_IN_SYSTM_H
137 # include <netinet/in_systm.h>
138 #endif
139 #if HAVE_NETINET_IN_H
140 # include <netinet/in.h>
141 #endif
142 ])
143 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
144 [#if HAVE_STDINT_H
145 # include <stdint.h>
146 #endif
147 #if HAVE_SYS_TYPES_H
148 # include <sys/types.h>
149 #endif
150 #if HAVE_NETINET_IN_SYSTM_H
151 # include <netinet/in_systm.h>
152 #endif
153 #if HAVE_NETINET_IN_H
154 # include <netinet/in.h>
155 #endif
156 #if HAVE_NETINET_IP6_H
157 # include <netinet/ip6.h>
158 #endif
159 ])
160 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
161 [#if HAVE_STDINT_H
162 # include <stdint.h>
163 #endif
164 #if HAVE_SYS_TYPES_H
165 # include <sys/types.h>
166 #endif
167 #if HAVE_NETINET_IN_SYSTM_H
168 # include <netinet/in_systm.h>
169 #endif
170 #if HAVE_NETINET_IN_H
171 # include <netinet/in.h>
172 #endif
173 #if HAVE_NETINET_IP_H
174 # include <netinet/ip.h>
175 #endif
176 ])
177 AC_CHECK_HEADERS(netinet/udp.h, [], [],
178 [#if HAVE_STDINT_H
179 # include <stdint.h>
180 #endif
181 #if HAVE_SYS_TYPES_H
182 # include <sys/types.h>
183 #endif
184 #if HAVE_NETINET_IN_SYSTM_H
185 # include <netinet/in_systm.h>
186 #endif
187 #if HAVE_NETINET_IN_H
188 # include <netinet/in.h>
189 #endif
190 #if HAVE_NETINET_IP_H
191 # include <netinet/ip.h>
192 #endif
193 ])
195 # For cpu modules
196 AC_CHECK_HEADERS(sys/dkstat.h)
197 if test "x$ac_system" = "xDarwin"
198 then
199 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)
200 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
201 fi
202 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
203 [
204 #if HAVE_SYS_TYPES_H
205 # include <sys/types.h>
206 #endif
207 #if HAVE_SYS_PARAM_H
208 # include <sys/param.h>
209 #endif
210 ])
212 # For hddtemp module
213 AC_CHECK_HEADERS(linux/major.h libgen.h)
215 # For the battery plugin
216 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
217 [
218 #if HAVE_IOKIT_IOKITLIB_H
219 # include <IOKit/IOKitLib.h>
220 #endif
221 #if HAVE_IOKIT_IOTYPES_H
222 # include <IOKit/IOTypes.h>
223 #endif
224 ])
226 # For the swap module
227 AC_CHECK_HEADERS(sys/swap.h, [], [],
228 [
229 #if HAVE_SYS_TYPES_H
230 # include <sys/types.h>
231 #endif
232 #if HAVE_SYS_PARAM_H
233 # include <sys/param.h>
234 #endif
235 ])
237 # For load module
238 # For the processes plugin
239 # For users module
240 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
242 # For interface plugin
243 AC_CHECK_HEADERS(ifaddrs.h)
244 AC_CHECK_HEADERS(net/if.h, [], [],
245 [
246 #if HAVE_SYS_TYPES_H
247 # include <sys/types.h>
248 #endif
249 #if HAVE_SYS_SOCKET_H
250 # include <sys/socket.h>
251 #endif
252 ])
253 AC_CHECK_HEADERS(linux/if.h, [], [],
254 [
255 #if HAVE_SYS_TYPES_H
256 # include <sys/types.h>
257 #endif
258 #if HAVE_SYS_SOCKET_H
259 # include <sys/socket.h>
260 #endif
261 ])
262 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
263 [
264 #if HAVE_SYS_TYPES_H
265 # include <sys/types.h>
266 #endif
267 #if HAVE_SYS_SOCKET_H
268 # include <sys/socket.h>
269 #endif
270 #if HAVE_LINUX_IF_H
271 # include <linux/if.h>
272 #endif
273 ])
275 # For ipvs module
276 have_net_ip_vs_h="no"
277 have_ip_vs_h="no"
278 if test "x$ac_system" = "xLinux"
279 then
280 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
281 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
282 fi
284 # For quota module
285 AC_CHECK_HEADERS(sys/ucred.h, [], [],
286 [
287 #if HAVE_SYS_TYPES_H
288 # include <sys/types.h>
289 #endif
290 #if HAVE_SYS_PARAM_H
291 # include <sys/param.h>
292 #endif
293 ])
295 # For mount interface
296 AC_CHECK_HEADERS(sys/mount.h, [], [],
297 [
298 #if HAVE_SYS_TYPES_H
299 # include <sys/types.h>
300 #endif
301 #if HAVE_SYS_PARAM_H
302 # include <sys/param.h>
303 #endif
304 ])
306 # For the email plugin
307 AC_CHECK_HEADERS(linux/un.h, [], [],
308 [
309 #if HAVE_SYS_SOCKET_H
310 # include <sys/socket.h>
311 #endif
312 ])
314 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)
316 # For the dns plugin
317 AC_CHECK_HEADERS(arpa/nameser.h)
318 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
319 [
320 #if HAVE_ARPA_NAMESER_H
321 # include <arpa/nameser.h>
322 #endif
323 ])
325 AC_CHECK_HEADERS(net/if_arp.h, [], [],
326 [#if HAVE_SYS_SOCKET_H
327 # include <sys/socket.h>
328 #endif
329 ])
330 AC_CHECK_HEADERS(net/ppp_defs.h)
331 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
332 [#if HAVE_NET_PPP_DEFS_H
333 # include <net/ppp_defs.h>
334 #endif
335 ])
336 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
337 [#if HAVE_STDINT_H
338 # include <stdint.h>
339 #endif
340 #if HAVE_SYS_TYPES_H
341 # include <sys/types.h>
342 #endif
343 #if HAVE_SYS_SOCKET_H
344 # include <sys/socket.h>
345 #endif
346 #if HAVE_NET_IF_H
347 # include <net/if.h>
348 #endif
349 #if HAVE_NETINET_IN_H
350 # include <netinet/in.h>
351 #endif
352 ])
354 # For the multimeter plugin
355 have_termios_h="no"
356 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
358 #
359 # Checks for typedefs, structures, and compiler characteristics.
360 #
361 AC_C_CONST
362 AC_TYPE_PID_T
363 AC_TYPE_SIZE_T
364 AC_TYPE_UID_T
365 AC_HEADER_TIME
367 #
368 # Checks for library functions.
369 #
370 AC_PROG_GCC_TRADITIONAL
371 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
373 AC_FUNC_STRERROR_R
375 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
377 socket_needs_socket="no"
378 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
379 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
381 nanosleep_needs_rt="no"
382 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
383 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
385 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
386 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
387 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
388 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
389 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
390 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
391 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
392 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
393 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
394 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
396 # For load module
397 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
399 # Check for NAN
400 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
401 [
402 if test "x$withval" = "xno"; then
403 nan_type="none"
404 else if test "x$withval" = "xyes"; then
405 nan_type="zero"
406 else
407 nan_type="$withval"
408 fi; fi
409 ],
410 [nan_type="none"])
411 if test "x$nan_type" = "xnone"; then
412 AC_CACHE_CHECK([whether NAN is defined by default],
413 [have_nan_default],
414 AC_COMPILE_IFELSE(
415 AC_LANG_PROGRAM(
416 [[
417 #include <stdlib.h>
418 #include <math.h>
419 static float foo = NAN;
420 ]],
421 [[
422 if (isnan (foo))
423 return 0;
424 else
425 return 1;
426 ]]),
427 [have_nan_default="yes"],
428 [have_nan_default="no"]
429 )
430 )
431 if test "x$have_nan_default" = "xyes"
432 then
433 nan_type="default"
434 fi
435 fi
436 if test "x$nan_type" = "xnone"; then
437 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
438 [have_nan_isoc],
439 AC_COMPILE_IFELSE(
440 AC_LANG_PROGRAM(
441 [[
442 #include <stdlib.h>
443 #define __USE_ISOC99 1
444 #include <math.h>
445 static float foo = NAN;
446 ]],
447 [[
448 if (isnan (foo))
449 return 0;
450 else
451 return 1;
452 ]]),
453 [have_nan_isoc="yes"],
454 [have_nan_isoc="no"]
455 )
456 )
457 if test "x$have_nan_isoc" = "xyes"
458 then
459 nan_type="isoc99"
460 fi
461 fi
462 if test "x$nan_type" = "xnone"; then
463 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
464 [have_nan_zero],
465 AC_RUN_IFELSE(
466 AC_LANG_PROGRAM(
467 [[
468 #include <stdlib.h>
469 #include <math.h>
470 #ifdef NAN
471 # undef NAN
472 #endif
473 #define NAN (0.0 / 0.0)
474 #ifndef isnan
475 # define isnan(f) ((f) != (f))
476 #endif
477 static float foo = NAN;
478 ]],
479 [[
480 if (isnan (foo))
481 return 0;
482 else
483 return 1;
484 ]]),
485 [have_nan_zero="yes"],
486 [have_nan_zero="no"]
487 )
488 )
489 if test "x$have_nan_zero" = "xyes"
490 then
491 nan_type="zero"
492 fi
493 fi
495 if test "x$nan_type" = "xdefault"; then
496 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
497 [Define if NAN is defined by default and can initialize static variables.])
498 else if test "x$nan_type" = "xisoc99"; then
499 AC_DEFINE(NAN_STATIC_ISOC, 1,
500 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
501 else if test "x$nan_type" = "xzero"; then
502 AC_DEFINE(NAN_ZERO_ZERO, 1,
503 [Define if NAN can be defined as (0.0 / 0.0)])
504 else
505 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
506 fi; fi; fi
508 # For mount interface
509 #AC_CHECK_FUNCS(getfsent getvfsent)
511 have_getfsstat="no"
512 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
513 have_getvfsstat="no"
514 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
515 have_listmntent="no"
516 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
518 have_getmntent="no"
519 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
520 if test "x$have_getmntent" = "xno"; then
521 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
522 fi
523 if test "x$have_getmntent" = "xno"; then
524 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
525 fi
526 if test "x$have_getmntent" = "xno"; then
527 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
528 fi
530 if test "x$have_getmntent" = "xc"; then
531 AC_CACHE_CHECK([whether getmntent takes one argument],
532 [have_one_getmntent],
533 AC_COMPILE_IFELSE(
534 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
535 #include <mntent.h>
536 #include "$srcdir/src/utils_mount.h"]],
537 [[
538 FILE *fh;
539 struct mntent *me;
540 fh = setmntent ("/etc/mtab", "r");
541 me = getmntent (fh);
542 ]]
543 ),
544 [have_one_getmntent="yes"],
545 [have_one_getmntent="no"]
546 )
547 )
548 AC_CACHE_CHECK([whether getmntent takes two arguments],
549 [have_two_getmntent],
550 AC_COMPILE_IFELSE(
551 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
552 #include <sys/mnttab.h>
553 #include "$srcdir/src/utils_mount.h"]],
554 [[
555 FILE *fh;
556 struct mnttab mt;
557 int status;
558 fh = fopen ("/etc/mnttab", "r");
559 status = getmntent (fh, &mt);
560 ]]
561 ),
562 [have_two_getmntent="yes"],
563 [have_two_getmntent="no"]
564 )
565 )
566 fi
568 # Check for different versions of `getmntent' here..
570 if test "x$have_getmntent" = "xc"; then
571 if test "x$have_one_getmntent" = "xyes"; then
572 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
573 [Define if the function getmntent exists and takes one argument.])
574 fi
575 if test "x$have_two_getmntent" = "xyes"; then
576 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
577 [Define if the function getmntent exists and takes two arguments.])
578 fi
579 fi
580 if test "x$have_getmntent" = "xsun"; then
581 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
582 [Define if the function getmntent exists. It's the version from libsun.])
583 fi
584 if test "x$have_getmntent" = "xseq"; then
585 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
586 [Define if the function getmntent exists. It's the version from libseq.])
587 fi
588 if test "x$have_getmntent" = "xgen"; then
589 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
590 [Define if the function getmntent exists. It's the version from libgen.])
591 fi
593 # Check for structures
594 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
595 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
596 [],
597 [
598 #include <sys/types.h>
599 #include <sys/socket.h>
600 #include <net/if.h>
601 ])
602 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
603 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
604 [],
605 [
606 #include <sys/types.h>
607 #include <sys/socket.h>
608 #include <linux/if.h>
609 #include <linux/netdevice.h>
610 ])
612 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
613 [#if HAVE_STDINT_H
614 # include <stdint.h>
615 #endif
616 #if HAVE_SYS_TYPES_H
617 # include <sys/types.h>
618 #endif
619 #if HAVE_NETINET_IN_SYSTM_H
620 # include <netinet/in_systm.h>
621 #endif
622 #if HAVE_NETINET_IN_H
623 # include <netinet/in.h>
624 #endif
625 #if HAVE_NETINET_IP_H
626 # include <netinet/ip.h>
627 #endif
628 #if HAVE_NETINET_UDP_H
629 # include <netinet/udp.h>
630 #endif
631 ])
632 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
633 [#if HAVE_STDINT_H
634 # include <stdint.h>
635 #endif
636 #if HAVE_SYS_TYPES_H
637 # include <sys/types.h>
638 #endif
639 #if HAVE_NETINET_IN_SYSTM_H
640 # include <netinet/in_systm.h>
641 #endif
642 #if HAVE_NETINET_IN_H
643 # include <netinet/in.h>
644 #endif
645 #if HAVE_NETINET_IP_H
646 # include <netinet/ip.h>
647 #endif
648 #if HAVE_NETINET_UDP_H
649 # include <netinet/udp.h>
650 #endif
651 ])
653 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
654 [],
655 [],
656 [
657 #if HAVE_KSTAT_H
658 # include <kstat.h>
659 #endif
660 ])
662 with_libresolv="yes"
663 AC_CHECK_LIB(resolv, res_search,
664 [
665 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
666 ],
667 [with_libresolv="no"])
668 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
670 dnl Check for HAL (hardware abstraction library)
671 with_libhal="yes"
672 AC_CHECK_LIB(hal,libhal_device_property_exists,
673 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
674 [with_libhal="no"])
675 if test "x$with_libhal" = "xyes"; then
676 PKG_PROG_PKG_CONFIG
677 if test "x$PKG_CONFIG" != "x"; then
678 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
679 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
680 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
681 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
682 fi
683 fi
685 m4_divert_once([HELP_WITH], [
686 collectd additional packages:])
688 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
689 librrd_cflags=""
690 librrd_ldflags=""
691 librrd_threadsafe="yes"
692 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
693 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
694 then
695 librrd_cflags="-I$withval/include"
696 librrd_ldflags="-L$withval/lib"
697 with_rrdtool="yes"
698 else
699 with_rrdtool="$withval"
700 fi
701 ], [with_rrdtool="yes"])
702 if test "x$with_rrdtool" = "xyes"
703 then
704 SAVE_CPPFLAGS="$CPPFLAGS"
705 SAVE_LDFLAGS="$LDFLAGS"
707 CPPFLAGS="$CPPFLAGS $librrd_cflags"
708 LDFLAGS="$LDFLAGS $librrd_ldflags"
710 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
712 CPPFLAGS="$SAVE_CPPFLAGS"
713 LDFLAGS="$SAVE_LDFLAGS"
714 fi
715 if test "x$with_rrdtool" = "xyes"
716 then
717 SAVE_CPPFLAGS="$CPPFLAGS"
718 SAVE_LDFLAGS="$LDFLAGS"
720 CPPFLAGS="$CPPFLAGS $librrd_cflags"
721 LDFLAGS="$LDFLAGS $librrd_ldflags"
723 AC_CHECK_LIB(rrd_th, rrd_update_r,
724 [with_rrdtool="yes"
725 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
726 ],
727 [librrd_threadsafe="no"
728 AC_CHECK_LIB(rrd, rrd_update,
729 [with_rrdtool="yes"
730 librrd_ldflags="$librrd_ldflags -lrrd -lm"
731 ],
732 [with_rrdtool="no (symbol 'rrd_update' not found)"],
733 [-lm])
734 ]
735 [-lm])
737 CPPFLAGS="$SAVE_CPPFLAGS"
738 LDFLAGS="$SAVE_LDFLAGS"
739 fi
740 if test "x$with_rrdtool" = "xyes"
741 then
742 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
743 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
744 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
745 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
746 fi
747 if test "x$librrd_threadsafe" = "xyes"
748 then
749 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
750 fi
752 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
753 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
754 then
755 LDFLAGS="$LDFLAGS -L$withval/lib"
756 CPPFLAGS="$CPPFLAGS -I$withval/include"
757 with_libpthread="yes"
758 else
759 if test "x$withval" = "xno"
760 then
761 with_libpthread="no (disabled)"
762 fi
763 fi
764 ], [with_libpthread="yes"])
765 if test "x$with_libpthread" = "xyes"
766 then
767 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
768 fi
769 if test "x$with_libpthread" = "xyes"
770 then
771 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
772 fi
773 if test "x$with_libpthread" = "xyes"
774 then
775 collect_pthread=1
776 else
777 collect_pthread=0
778 fi
779 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
780 [Wether or not to use pthread (POSIX threads) library])
781 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
783 if test "x$ac_system" = "xSolaris"
784 then
785 with_kstat="yes"
786 with_devinfo="yes"
787 else
788 with_kstat="no (Solaris only)"
789 with_devinfo="no (Solaris only)"
790 fi
792 if test "x$with_kstat" = "xyes"
793 then
794 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
795 fi
796 if test "x$with_kstat" = "xyes"
797 then
798 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
799 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
800 fi
801 if test "x$with_kstat" = "xyes"
802 then
803 AC_DEFINE(HAVE_LIBKSTAT, 1,
804 [Define to 1 if you have the 'kstat' library (-lkstat)])
805 fi
806 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
807 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
809 ### BEGIN of check for libcurl ###
810 with_curl_config="curl-config"
811 with_curl_cflags=""
812 with_curl_libs=""
813 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
814 [
815 if test "x$withval" = "xno"
816 then
817 with_libcurl="no"
818 else if test "x$withval" = "xyes"
819 then
820 with_libcurl="yes"
821 else
822 if test -f "$withval" && test -x "$withval"
823 then
824 with_curl_config="$withval"
825 with_libcurl="yes"
826 else if test -x "$withval/bin/curl-config"
827 then
828 with_curl_config="$withval/bin/curl-config"
829 with_libcurl="yes"
830 fi; fi
831 with_libcurl="yes"
832 fi; fi
833 ],
834 [
835 with_libcurl="yes"
836 ])
837 if test "x$with_libcurl" = "xyes"
838 then
839 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
840 curl_config_status=$?
842 if test $curl_config_status -ne 0
843 then
844 with_libcurl="no ($with_curl_config failed)"
845 else
846 SAVE_CFLAGS=$CFLAGS
847 CFLAGS="$CFLAGS $with_curl_cflags"
849 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
851 CFLAGS="$SAVE_CFLAGS"
852 fi
853 fi
854 if test "x$with_libcurl" = "xyes"
855 then
856 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
857 curl_config_status=$?
859 if test $curl_config_status -ne 0
860 then
861 with_libcurl="no ($with_curl_config failed)"
862 else
863 AC_CHECK_LIB(curl, curl_easy_init,
864 [with_libcurl="yes"],
865 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
866 [$with_curl_libs])
867 fi
868 fi
869 if test "x$with_libcurl" = "xyes"
870 then
871 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
872 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
873 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
874 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
875 fi
876 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
877 ### END of check for libcurl ###
879 with_libiokit="no"
880 collectd_libiokit=0
881 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
882 [
883 with_libiokit="yes"
884 collectd_libiokit=1
885 ],
886 [
887 with_libiokit="no"
888 collectd_libiokit=0
889 ])
890 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
891 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
893 with_libstatgrab="yes"
894 with_libdevstat="no"
895 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
896 [
897 if test "x$withval" != "xno" -a "x$withval" != "xyes"
898 then
899 LDFLAGS="$LDFLAGS -L$withval/lib"
900 CPPFLAGS="$CPPFLAGS -I$withval/include"
901 with_libstatgrab="yes"
902 else
903 with_libstatgrab="$withval"
904 fi
905 ],
906 [
907 if test "x$ac_system" == "xunknown"
908 then
909 with_libstatgrab="yes"
910 else
911 with_libstatgrab="no"
912 fi
913 ])
914 if test "x$with_libstatgrab" = "xyes"
915 then
916 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
917 fi
918 if test "x$with_libstatgrab" = "xyes"
919 then
920 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
921 fi
922 if test "x$with_libstatgrab" = "xyes"
923 then
924 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
925 fi
926 if test "x$with_libstatgrab" = "xyes"
927 then
928 collect_libstatgrab=1
929 else
930 collect_libstatgrab=0
931 fi
932 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
933 [Wether or not to use statgrab library])
934 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
935 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
937 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
938 if test "x$with_libkvm" = "xyes"
939 then
940 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
941 fi
942 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
944 with_sensors_cflags=""
945 with_sensors_ldflags=""
946 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
947 [
948 if test "x$withval" = "xno"
949 then
950 with_lm_sensors="no"
951 else
952 with_lm_sensors="yes"
953 if test "x$withval" != "xyes"
954 then
955 with_sensors_cflags="-I$withval/include"
956 with_sensors_ldflags="-L$withval/lib"
957 with_lm_sensors="yes"
958 fi
959 fi
960 ],
961 [
962 if test "x$ac_system" = "xLinux"
963 then
964 with_lm_sensors="yes"
965 else
966 with_lm_sensors="no (Linux only library)"
967 fi
968 ])
969 if test "x$with_lm_sensors" = "xyes"
970 then
971 SAVE_CPPFLAGS="$CPPFLAGS"
972 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
974 # AC_CHECK_HEADERS(sensors/sensors.h,
975 # [
976 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
977 # ],
978 # [with_lm_sensors="no (sensors/sensors.h not found)"])
979 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
981 CPPFLAGS="$SAVE_CPPFLAGS"
982 fi
983 if test "x$with_lm_sensors" = "xyes"
984 then
985 SAVE_CPPFLAGS="$CPPFLAGS"
986 SAVE_LDFLAGS="$LDFLAGS"
987 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
988 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
990 AC_CHECK_LIB(sensors, sensors_init,
991 [
992 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
993 ],
994 [with_lm_sensors="no (libsensors not found)"])
996 CPPFLAGS="$SAVE_CPPFLAGS"
997 LDFLAGS="$SAVE_LDFLAGS"
998 fi
999 if test "x$with_lm_sensors" = "xyes"
1000 then
1001 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1002 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1003 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1004 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1005 fi
1006 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1008 with_mysql_config="mysql_config"
1009 with_mysql_cflags=""
1010 with_mysql_libs=""
1011 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1012 [
1013 if test "x$withval" = "xno"
1014 then
1015 with_libmysql="no"
1016 else if test "x$withval" = "xyes"
1017 then
1018 with_libmysql="yes"
1019 else
1020 if test -f "$withval" && test -x "$withval";
1021 then
1022 with_mysql_config="$withval"
1023 else if test -x "$withval/bin/mysql_config"
1024 then
1025 with_mysql_config="$withval/bin/mysql_config"
1026 fi; fi
1027 with_libmysql="yes"
1028 fi; fi
1029 ],
1030 [
1031 with_libmysql="yes"
1032 ])
1033 if test "x$with_libmysql" = "xyes"
1034 then
1035 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1036 mysql_config_status=$?
1038 if test $mysql_config_status -ne 0
1039 then
1040 with_libmysql="no"
1041 else
1042 SAVE_CFLAGS=$CFLAGS
1043 CFLAGS="$CFLAGS $with_mysql_cflags"
1045 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1047 CFLAGS="$SAVE_CFLAGS"
1048 fi
1049 fi
1050 if test "x$with_libmysql" = "xyes"
1051 then
1052 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1053 mysql_config_status=$?
1055 if test $mysql_config_status -ne 0
1056 then
1057 with_libmysql="no"
1058 else
1059 AC_CHECK_LIB(mysqlclient, mysql_init,
1060 [with_libmysql="yes"],
1061 [with_libmysql="no (symbol 'mysql_init' not found)"],
1062 [$with_mysql_libs])
1063 fi
1064 fi
1065 if test "x$with_libmysql" = "xyes"
1066 then
1067 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1068 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1069 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1070 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1071 fi
1072 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1074 with_own_liboconfig="no"
1075 liboconfig_LDFLAGS="$LDFLAGS"
1076 liboconfig_CPPFLAGS="$CPPFLAGS"
1077 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1078 [
1079 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1080 then
1081 if test -d "$withval/lib"
1082 then
1083 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1084 fi
1085 if test -d "$withval/include"
1086 then
1087 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1088 fi
1089 fi
1090 if test "x$withval" = "xno"
1091 then
1092 AC_MSG_ERROR("liboconfig is required")
1093 fi
1094 ],
1095 [
1096 with_liboconfig="yes"
1097 ])
1099 save_LDFLAGS="$LDFLAGS"
1100 save_CPPFLAGS="$CPPFLAGS"
1101 LDFLAGS="$liboconfig_LDFLAGS"
1102 CPPFLAGS="$liboconfig_CPPFLAGS"
1103 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1104 [
1105 with_liboconfig="yes"
1106 with_own_liboconfig="no"
1107 ],
1108 [
1109 with_liboconfig="yes"
1110 with_own_liboconfig="yes"
1111 LDFLAGS="$save_LDFLAGS"
1112 CPPFLAGS="$save_CPPFLAGS"
1113 ])
1115 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1116 if test "x$with_own_liboconfig" = "xyes"
1117 then
1118 with_liboconfig="yes (shipped version)"
1119 fi
1121 #with_liboping="yes"
1122 with_own_liboping="no"
1123 liboping_LDFLAGS="$LDFLAGS"
1124 liboping_CPPFLAGS="$CPPFLAGS"
1125 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1126 [
1127 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1128 then
1129 if test -d "$withval/lib"
1130 then
1131 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1132 fi
1133 if test -d "$withval/include"
1134 then
1135 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1136 fi
1137 fi
1138 if test "x$withval" = "xno"
1139 then
1140 with_liboping="no"
1141 with_own_liboping="no"
1142 else if test "x$withval" = "xyes"
1143 then
1144 with_liboping="yes"
1145 fi; fi
1146 ],
1147 [
1148 with_liboping="yes"
1149 ])
1151 if test "x$with_liboping" = "xyes"
1152 then
1153 save_LDFLAGS="$LDFLAGS"
1154 save_CPPFLAGS="$CPPFLAGS"
1155 LDFLAGS="$liboping_LDFLAGS"
1156 CPPFLAGS="$liboping_CPPFLAGS"
1157 AC_CHECK_LIB(oping, ping_construct,
1158 [
1159 with_liboping="yes"
1160 with_own_liboping="no"
1161 ],
1162 [
1163 with_liboping="yes"
1164 with_own_liboping="yes"
1165 LDFLAGS="$save_LDFLAGS"
1166 CPPFLAGS="$save_CPPFLAGS"
1167 ])
1168 fi
1169 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1170 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1172 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1173 [
1174 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1175 then
1176 LDFLAGS="$LDFLAGS -L$withval/lib"
1177 CPPFLAGS="$CPPFLAGS -I$withval/include"
1178 with_libpcap="yes"
1179 else
1180 with_libpcap="$withval"
1181 fi
1182 ],
1183 [
1184 with_libpcap="yes"
1185 ])
1186 if test "x$with_libpcap" = "xyes"
1187 then
1188 AC_CHECK_LIB(pcap, pcap_open_live,
1189 [
1190 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1191 ], [with_libpcap="no (libpcap not found)"])
1192 fi
1193 if test "x$with_libpcap" = "xyes"
1194 then
1195 AC_CHECK_HEADERS(pcap.h,
1196 [
1197 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1198 ], [with_libpcap="no (pcap.h not found)"])
1199 fi
1200 if test "x$with_libpcap" = "xyes"
1201 then
1202 collect_libpcap=1
1203 else
1204 collect_libpcap=0
1205 fi
1206 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1207 [Wether or not to use the pcap library])
1208 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1210 perl_interpreter="perl"
1211 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1212 [
1213 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1214 then
1215 LDFLAGS="$LDFLAGS -L$withval/lib"
1216 CPPFLAGS="$CPPFLAGS -I$withval/include"
1217 perl_interpreter="$withval/bin/perl"
1218 with_libperl="yes"
1219 else
1220 with_libperl="$withval"
1221 fi
1222 ],
1223 [
1224 with_libperl="yes"
1225 ])
1227 AC_SUBST(PERL, "$perl_interpreter")
1229 if test "x$with_libperl" = "xyes"
1230 then
1231 SAVE_CFLAGS=$CFLAGS
1232 SAVE_LDFLAGS=$LDFLAGS
1233 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1234 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1235 CFLAGS="$CFLAGS $PERL_CFLAGS"
1236 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1238 AC_CACHE_CHECK([for libperl],
1239 [have_libperl],
1240 AC_LINK_IFELSE(
1241 AC_LANG_PROGRAM(
1242 [[
1243 #include <EXTERN.h>
1244 #include <perl.h>
1245 #include <XSUB.h>
1246 ]],
1247 [[
1248 PerlInterpreter *perl = NULL;
1249 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1250 newSVpv ("Collectd::Plugin::FooBar", 24),
1251 Nullsv);
1252 ]]),
1253 [have_libperl="yes"],
1254 [have_libperl="no"]
1255 )
1256 )
1258 if test "x$have_libperl" = "xyes"
1259 then
1260 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1261 AC_SUBST(PERL_CFLAGS)
1262 AC_SUBST(PERL_LDFLAGS)
1263 else
1264 with_libperl="no"
1265 fi
1267 CFLAGS=$SAVE_CFLAGS
1268 LDFLAGS=$SAVE_LDFLAGS
1269 fi
1270 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1272 if test "x$with_libperl" = "xyes"
1273 then
1274 SAVE_CFLAGS=$CFLAGS
1275 SAVE_LDFLAGS=$LDFLAGS
1276 CFLAGS="$CFLAGS $PERL_CFLAGS"
1277 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1279 AC_CACHE_CHECK([if perl supports ithreads],
1280 [have_perl_ithreads],
1281 AC_LINK_IFELSE(
1282 AC_LANG_PROGRAM(
1283 [[
1284 #include <EXTERN.h>
1285 #include <perl.h>
1286 #include <XSUB.h>
1288 #if !defined(USE_ITHREADS)
1289 # error "Perl does not support ithreads!"
1290 #endif /* !defined(USE_ITHREADS) */
1291 ]],
1292 [[ ]]),
1293 [have_perl_ithreads="yes"],
1294 [have_perl_ithreads="no"]
1295 )
1296 )
1298 if test "x$have_perl_ithreads" = "xyes"
1299 then
1300 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1301 fi
1303 CFLAGS=$SAVE_CFLAGS
1304 LDFLAGS=$SAVE_LDFLAGS
1305 fi
1307 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1308 [
1309 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1310 then
1311 LDFLAGS="$LDFLAGS -L$withval/lib"
1312 CPPFLAGS="$CPPFLAGS -I$withval/include"
1313 with_libiptc="yes"
1314 else
1315 with_libiptc="$withval"
1316 fi
1317 ],
1318 [
1319 if test "x$ac_system" = "xLinux"
1320 then
1321 with_libiptc="yes"
1322 else
1323 with_libiptc="no (Linux only)"
1324 fi
1325 ])
1326 if test "x$with_libiptc" = "xyes"
1327 then
1328 AC_CHECK_LIB(iptc, iptc_init,
1329 [
1330 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1331 ], [with_libiptc="no (libiptc not found)"])
1332 fi
1333 if test "x$with_libiptc" = "xyes"
1334 then
1335 AC_CHECK_HEADERS(libiptc/libiptc.h,
1336 [
1337 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1338 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1339 fi
1340 if test "x$with_libiptc" = "xyes"
1341 then
1342 collect_libiptc=1
1343 else
1344 collect_libiptc=0
1345 fi
1346 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1348 with_snmp_config="net-snmp-config"
1349 with_snmp_cflags=""
1350 with_snmp_libs=""
1351 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1352 [
1353 if test "x$withval" = "xno"
1354 then
1355 with_libnetsnmp="no"
1356 else if test "x$withval" = "xyes"
1357 then
1358 with_libnetsnmp="yes"
1359 else
1360 if test -x "$withval"
1361 then
1362 with_snmp_config="$withval"
1363 with_libnetsnmp="yes"
1364 else
1365 with_snmp_config="$withval/bin/net-snmp-config"
1366 with_libnetsnmp="yes"
1367 fi
1368 fi; fi
1369 ],
1370 [with_libnetsnmp="yes"])
1371 if test "x$with_libnetsnmp" = "xyes"
1372 then
1373 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1374 snmp_config_status=$?
1376 if test $snmp_config_status -ne 0
1377 then
1378 with_libnetsnmp="no ($with_snmp_config failed)"
1379 else
1380 SAVE_CFLAGS=$CFLAGS
1381 CFLAGS="$CFLAGS $with_snmp_cflags"
1383 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1385 CFLAGS="$SAVE_CFLAGS"
1386 fi
1387 fi
1388 if test "x$with_libnetsnmp" = "xyes"
1389 then
1390 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1391 snmp_config_status=$?
1393 if test $snmp_config_status -ne 0
1394 then
1395 with_libnetsnmp="no ($with_snmp_config failed)"
1396 else
1397 AC_CHECK_LIB(netsnmp, init_snmp,
1398 [with_libnetsnmp="yes"],
1399 [with_libnetsnmp="no (libnetsnmp not found)"],
1400 [$with_snmp_libs])
1401 fi
1402 fi
1403 if test "x$with_libnetsnmp" = "xyes"
1404 then
1405 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1406 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1407 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1408 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1409 fi
1410 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1412 with_upsclient_config="libupsclient-config"
1413 with_upsclient_cflags=""
1414 with_upsclient_libs=""
1415 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1416 [
1417 if test "x$withval" = "xno"
1418 then
1419 with_libupsclient="no"
1420 else
1421 if test "x$withval" != "xyes"
1422 then
1423 if test -f "$withval" && test -x "$withval";
1424 then
1425 with_upsclient_config="$withval"
1426 else
1427 with_upsclient_config="$withval/bin/libupsclient-config"
1428 fi
1429 fi
1430 with_libupsclient="yes"
1431 fi
1432 ],
1433 [
1434 with_libupsclient="yes"
1435 ])
1436 if test "x$with_libupsclient" = "xyes"
1437 then
1438 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1439 upsclient_config_status=$?
1441 if test $upsclient_config_status -ne 0
1442 then
1443 with_libupsclient="no ($with_upsclient_config failed)"
1444 fi
1445 fi
1446 if test "x$with_libupsclient" = "xyes"
1447 then
1448 SAVE_CFLAGS="$CFLAGS"
1449 CFLAGS="$CFLAGS $with_upsclient_cflags"
1451 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1453 CFLAGS="$SAVE_CFLAGS"
1454 fi
1455 if test "x$with_libupsclient" = "xyes"
1456 then
1457 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1458 upsclient_config_status=$?
1460 if test $upsclient_config_status -ne 0
1461 then
1462 with_libupsclient="no ($with_upsclient_config failed)"
1463 fi
1464 fi
1465 if test "x$with_libupsclient" = "xyes"
1466 then
1467 AC_CHECK_LIB(upsclient, upscli_connect,
1468 [
1469 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1470 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1471 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1472 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1473 ],
1474 [
1475 with_libupsclient="no (symbol 'upscli_connect' not found)"
1476 ], [$with_upsclient_libs])
1477 fi
1478 if test "x$with_libupsclient" = "xyes"
1479 then
1480 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1481 [#include <stdlib.h>
1482 #include <stdio.h>
1483 #include <upsclient.h>])
1484 fi
1485 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1487 ### BEGIN of check for libxmms ###
1488 with_xmms_config="xmms-config"
1489 with_xmms_cflags=""
1490 with_xmms_libs=""
1491 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1492 [
1493 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1494 then
1495 if test -f "$withval" && test -x "$withval";
1496 then
1497 with_xmms_config="$withval"
1498 else if test -x "$withval/bin/xmms-config"
1499 then
1500 with_xmms_config="$withval/bin/xmms-config"
1501 fi; fi
1502 with_libxmms="yes"
1503 else if test "x$withval" = "xno"
1504 then
1505 with_libxmms="no"
1506 else
1507 with_libxmms="yes"
1508 fi; fi
1509 ],
1510 [
1511 with_libxmms="yes"
1512 ])
1513 if test "x$with_libxmms" = "xyes"
1514 then
1515 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1516 xmms_config_status=$?
1518 if test $xmms_config_status -ne 0
1519 then
1520 with_libxmms="no"
1521 fi
1522 fi
1523 if test "x$with_libxmms" = "xyes"
1524 then
1525 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1526 xmms_config_status=$?
1528 if test $xmms_config_status -ne 0
1529 then
1530 with_libxmms="no"
1531 fi
1532 fi
1533 if test "x$with_libxmms" = "xyes"
1534 then
1535 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1536 [
1537 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1538 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1539 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1540 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1541 ],
1542 [
1543 with_libxmms="no"
1544 ],
1545 [$with_xmms_libs])
1546 fi
1547 with_libxmms_numeric=0
1548 if test "x$with_libxmms" = "xyes"
1549 then
1550 with_libxmms_numeric=1
1551 fi
1552 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1553 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1554 ### END of check for libxmms ###
1556 with_libnetlink_cflags=""
1557 with_libnetlink_libs="-lnetlink"
1558 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1559 [
1560 echo "libnetlink: withval = $withval"
1561 if test "x$withval" = "xyes"
1562 then
1563 with_libnetlink="yes"
1564 else if test "x$withval" = "xno"
1565 then
1566 with_libnetlink="no"
1567 else
1568 if test -d "$withval/include"
1569 then
1570 with_libnetlink_cflags="-I$withval/include"
1571 with_libnetlink_libs="-L$withval/lib -lnetlink"
1572 with_libnetlink="yes"
1573 else
1574 AC_MSG_ERROR("no such directory: $withval/include")
1575 fi
1576 fi; fi
1577 ],
1578 [
1579 if test "x$ac_system" = "xLinux"
1580 then
1581 with_libnetlink="yes"
1582 else
1583 with_libnetlink="no (Linux only library)"
1584 fi
1585 ])
1586 if test "x$with_libnetlink" = "xyes"
1587 then
1588 SAVE_CFLAGS=$CFLAGS
1589 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1591 with_libnetlink="no (libnetlink.h not found)"
1593 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1594 [
1595 with_libnetlink="yes"
1596 break
1597 ], [],
1598 [#include <stdio.h>
1599 #include <sys/types.h>
1600 #include <asm/types.h>
1601 #include <sys/socket.h>
1602 #include <linux/netlink.h>
1603 #include <linux/rtnetlink.h>])
1604 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1605 [#include <stdio.h>
1606 #include <sys/types.h>
1607 #include <asm/types.h>
1608 #include <sys/socket.h>])
1610 AC_COMPILE_IFELSE(
1611 [#include <stdio.h>
1612 #include <sys/types.h>
1613 #include <asm/types.h>
1614 #include <sys/socket.h>
1615 #include <linux/netlink.h>
1616 #include <linux/rtnetlink.h>
1618 int main (void)
1619 {
1620 int retval = TCA_STATS2;
1621 return (retval);
1622 }],
1623 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1624 []);
1626 AC_COMPILE_IFELSE(
1627 [#include <stdio.h>
1628 #include <sys/types.h>
1629 #include <asm/types.h>
1630 #include <sys/socket.h>
1631 #include <linux/netlink.h>
1632 #include <linux/rtnetlink.h>
1634 int main (void)
1635 {
1636 int retval = TCA_STATS;
1637 return (retval);
1638 }],
1639 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1640 []);
1642 CFLAGS="$SAVE_CFLAGS"
1643 fi
1644 if test "x$with_libnetlink" = "xyes"
1645 then
1646 AC_CHECK_LIB(netlink, rtnl_open,
1647 [with_libnetlink="yes"],
1648 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1649 [$with_libnetlink_libs])
1650 fi
1651 if test "x$with_libnetlink" = "xyes"
1652 then
1653 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1654 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1655 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1656 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1657 fi
1658 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1660 dnl Check for libvirt and libxml2 libraries.
1661 with_libxml2="no (pkg-config isn't available)"
1662 with_libxml2_cflags=""
1663 with_libxml2_ldflags=""
1664 with_libvirt="no (pkg-config isn't available)"
1665 with_libvirt_cflags=""
1666 with_libvirt_ldflags=""
1667 PKG_PROG_PKG_CONFIG
1668 if test "x$PKG_CONFIG" != "x"
1669 then
1670 pkg-config --exists 'libxml-2.0' 2>/dev/null
1671 if test "$?" = "0"
1672 then
1673 with_libxml2="yes"
1674 else
1675 with_libxml2="no (pkg-config doesn't know library)"
1676 fi
1678 pkg-config --exists libvirt 2>/dev/null
1679 if test "$?" = "0"
1680 then
1681 with_libvirt="yes"
1682 else
1683 with_libvirt="no (pkg-config doesn't know library)"
1684 fi
1685 fi
1686 if test "x$with_libxml2" = "xyes"
1687 then
1688 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
1689 if test $? -ne 0
1690 then
1691 with_libxml2="no"
1692 fi
1693 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
1694 if test $? -ne 0
1695 then
1696 with_libxml2="no"
1697 fi
1698 fi
1699 if test "x$with_libxml2" = "xyes"
1700 then
1701 SAVE_CPPFLAGS="$CPPFLAGS"
1702 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
1704 AC_CHECK_HEADERS(libxml/parser.h, [],
1705 [with_libxml2="no (libxml/parser.h not found)"])
1707 CPPFLAGS="$SAVE_CPPFLAGS"
1708 fi
1709 if test "x$with_libxml2" = "xyes"
1710 then
1711 SAVE_CFLAGS="$CFLAGS"
1712 SAVE_LD_FLAGS="$LDFLAGS"
1714 CFLAGS="$CFLAGS $with_libxml2_cflags"
1715 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
1717 AC_CHECK_LIB(xml2, xmlXPathEval,
1718 [with_libxml2="yes"],
1719 [with_libxml2="no (symbol xmlXPathEval not found)"])
1721 CFLAGS="$SAVE_CFLAGS"
1722 LDFLAGS="$SAVE_LDFLAGS"
1723 fi
1724 dnl Add the right compiler flags and libraries.
1725 if test "x$with_libxml2" = "xyes"; then
1726 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
1727 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
1728 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
1729 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
1730 fi
1731 if test "x$with_libvirt" = "xyes"
1732 then
1733 with_libvirt_cflags="`pkg-config --cflags libvirt`"
1734 if test $? -ne 0
1735 then
1736 with_libvirt="no"
1737 fi
1738 with_libvirt_ldflags="`pkg-config --libs libvirt`"
1739 if test $? -ne 0
1740 then
1741 with_libvirt="no"
1742 fi
1743 fi
1744 if test "x$with_libvirt" = "xyes"
1745 then
1746 SAVE_CPPFLAGS="$CPPFLAGS"
1747 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
1749 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
1750 [with_libvirt="no (libvirt/libvirt.h not found)"])
1752 CPPFLAGS="$SAVE_CPPFLAGS"
1753 fi
1754 if test "x$with_libvirt" = "xyes"
1755 then
1756 SAVE_CFLAGS="$CFLAGS"
1757 SAVE_LD_FLAGS="$LDFLAGS"
1759 CFLAGS="$CFLAGS $with_libvirt_cflags"
1760 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
1762 AC_CHECK_LIB(virt, virDomainBlockStats,
1763 [with_libvirt="yes"],
1764 [with_libvirt="no (symbol virDomainBlockStats not found)"])
1766 CFLAGS="$SAVE_CFLAGS"
1767 LDFLAGS="$SAVE_LDFLAGS"
1768 fi
1769 dnl Add the right compiler flags and libraries.
1770 if test "x$with_libvirt" = "xyes"; then
1771 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
1772 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
1773 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
1774 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
1775 fi
1777 dnl End of check for libvirt and libxml2 libraries.
1779 # Check for enabled/disabled features
1780 #
1782 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1783 # ------------------------------------------------------------
1784 dnl
1785 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1786 dnl
1787 AC_DEFUN(
1788 [AC_COLLECTD],
1789 [
1790 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1791 m4_if(
1792 [$2],
1793 [enable],
1794 [dnl
1795 m4_define([EnDis],[disabled])dnl
1796 m4_define([YesNo],[no])dnl
1797 ],dnl
1798 [m4_if(
1799 [$2],
1800 [disable],
1801 [dnl
1802 m4_define([EnDis],[enabled])dnl
1803 m4_define([YesNo],[yes])dnl
1804 ],
1805 [dnl
1806 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1807 ]dnl
1808 )]dnl
1809 )dnl
1810 m4_if([$3], [feature], [],
1811 [m4_if(
1812 [$3], [module], [],
1813 [dnl
1814 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1815 ]dnl
1816 )]dnl
1817 )dnl
1818 AC_ARG_ENABLE(
1819 [$1],
1820 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1821 [],
1822 enable_$1='[YesNo]'dnl
1823 )# AC_ARG_ENABLE
1824 if test "x$enable_$1" = "xno"
1825 then
1826 collectd_$1=0
1827 else
1828 if test "x$enable_$1" = "xyes"
1829 then
1830 collectd_$1=1
1831 else
1832 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1833 collectd_$1=1
1834 enable_$1='yes'
1835 fi
1836 fi
1837 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1838 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1839 ]dnl
1840 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1842 # AC_PLUGIN(name, default, info)
1843 # ------------------------------------------------------------
1844 dnl
1845 AC_DEFUN(
1846 [AC_PLUGIN],
1847 [
1848 enable_plugin="no"
1849 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1850 [
1851 if test "x$enableval" = "xyes"
1852 then
1853 enable_plugin="yes"
1854 else
1855 enable_plugin="no"
1856 fi
1857 ],
1858 [
1859 if test "x$2" = "xyes"
1860 then
1861 enable_plugin="yes"
1862 else
1863 enable_plugin="no"
1864 fi
1865 ])
1866 if test "x$enable_plugin" = "xyes"
1867 then
1868 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1869 fi
1870 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1871 enable_$1="$enable_plugin"
1872 ]
1873 )# AC_PLUGIN(name, default, info)
1875 m4_divert_once([HELP_ENABLE], [
1876 collectd features:])
1877 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1878 AC_COLLECTD([debug], [enable], [feature], [debugging])
1879 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1880 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1882 plugin_battery="no"
1883 plugin_cpu="no"
1884 plugin_cpufreq="no"
1885 plugin_df="no"
1886 plugin_disk="no"
1887 plugin_entropy="no"
1888 plugin_interface="no"
1889 plugin_ipvs="no"
1890 plugin_irq="no"
1891 plugin_libvirt="no"
1892 plugin_load="no"
1893 plugin_memory="no"
1894 plugin_multimeter="no"
1895 plugin_nfs="no"
1896 plugin_perl="no"
1897 plugin_processes="no"
1898 plugin_serial="no"
1899 plugin_swap="no"
1900 plugin_tape="no"
1901 plugin_tcpconns="no"
1902 plugin_users="no"
1903 plugin_vserver="no"
1904 plugin_wireless="no"
1906 # Linux
1907 if test "x$ac_system" = "xLinux"
1908 then
1909 plugin_battery="yes"
1910 plugin_cpu="yes"
1911 plugin_cpufreq="yes"
1912 plugin_disk="yes"
1913 plugin_entropy="yes"
1914 plugin_interface="yes"
1915 plugin_irq="yes"
1916 plugin_load="yes"
1917 plugin_memory="yes"
1918 plugin_nfs="yes"
1919 plugin_processes="yes"
1920 plugin_serial="yes"
1921 plugin_swap="yes"
1922 plugin_tcpconns="yes"
1923 plugin_vserver="yes"
1924 plugin_wireless="yes"
1926 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1927 then
1928 plugin_ipvs="yes"
1929 fi
1930 fi
1932 # Mac OS X devices
1933 if test "x$with_libiokit" = "xyes"
1934 then
1935 plugin_battery="yes"
1936 plugin_disk="yes"
1937 fi
1939 # Solaris
1940 if test "x$with_devinfo$with_kstat" = "xyesyes"
1941 then
1942 plugin_cpu="yes"
1943 plugin_disk="yes"
1944 plugin_interface="yes"
1945 plugin_memory="yes"
1946 plugin_swap="yes"
1947 plugin_tape="yes"
1948 fi
1950 # libstatgrab
1951 if test "x$with_libstatgrab" = "xyes"
1952 then
1953 plugin_interface="yes"
1954 plugin_load="yes"
1955 plugin_memory="yes"
1956 plugin_swap="yes"
1957 fi
1959 if test "x$have_processor_info" = "xyes"
1960 then
1961 plugin_cpu="yes"
1962 fi
1963 if test "x$have_sysctlbyname" = "xyes"
1964 then
1965 plugin_cpu="yes"
1966 plugin_memory="yes"
1967 plugin_tcpconns="yes"
1968 fi
1970 if test "x$have_statfs" = "xyes"
1971 then
1972 plugin_df="yes"
1973 fi
1974 if test "x$have_statvfs" = "xyes"
1975 then
1976 plugin_df="yes"
1977 fi
1979 if test "x$have_getifaddrs" = "xyes"
1980 then
1981 plugin_interface="yes"
1982 fi
1984 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
1985 then
1986 plugin_libvirt="yes"
1987 fi
1989 if test "x$have_getloadavg" = "xyes"
1990 then
1991 plugin_load="yes"
1992 fi
1994 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
1995 then
1996 plugin_perl="yes"
1997 fi
1999 # Mac OS X memory interface
2000 if test "x$have_host_statistics" = "xyes"
2001 then
2002 plugin_memory="yes"
2003 fi
2005 if test "x$have_termios_h" = "xyes"
2006 then
2007 plugin_multimeter="yes"
2008 fi
2010 if test "x$have_thread_info" = "xyes"
2011 then
2012 plugin_processes="yes"
2013 fi
2015 if test "x$with_libkvm" = "xyes"
2016 then
2017 plugin_swap="yes"
2018 fi
2020 if test "x$have_getutent" = "xyes"
2021 then
2022 plugin_users="yes"
2023 fi
2024 if test "x$have_getutxent" = "xyes"
2025 then
2026 plugin_users="yes"
2027 fi
2029 # FIXME: sysctl for swap plugin
2031 m4_divert_once([HELP_ENABLE], [
2032 collectd plugins:])
2034 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2035 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2036 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2037 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2038 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2039 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2040 AC_PLUGIN([csv], [yes], [CSV output plugin])
2041 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2042 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2043 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2044 AC_PLUGIN([email], [yes], [EMail statistics])
2045 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2046 AC_PLUGIN([exec], [yes], [Execution of external programs])
2047 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2048 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2049 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2050 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2051 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2052 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2053 AC_PLUGIN([load], [$plugin_load], [System load])
2054 AC_PLUGIN([logfile], [yes], [File logging plugin])
2055 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2056 AC_PLUGIN([memcached], [yes], [memcached statistics])
2057 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2058 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2059 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2060 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2061 AC_PLUGIN([network], [yes], [Network communication plugin])
2062 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2063 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2064 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2065 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2066 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2067 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2068 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2069 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2070 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2071 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2072 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2073 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2074 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2075 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
2076 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2077 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2078 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2079 AC_PLUGIN([users], [$plugin_users], [User statistics])
2080 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2081 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2082 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2083 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2085 dnl ip_vs.h
2086 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2087 then
2088 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2089 fi
2091 dnl Perl bindings
2092 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2093 [
2094 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2095 then
2096 PERL_BINDINGS_OPTIONS="$withval"
2097 with_perl_bindings="yes"
2098 else
2099 PERL_BINDINGS_OPTIONS=""
2100 with_perl_bindings="$withval"
2101 fi
2102 ],
2103 [
2104 PERL_BINDINGS_OPTIONS=""
2105 with_perl_bindings="yes"
2106 ])
2107 if test "x$with_perl_bindings" = "xyes"
2108 then
2109 PERL_BINDINGS="perl"
2110 else
2111 PERL_BINDINGS=""
2112 fi
2113 AC_SUBST(PERL_BINDINGS)
2114 AC_SUBST(PERL_BINDINGS_OPTIONS)
2116 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2118 if test "x$with_rrdtool" = "xyes" -a "x$librrd_threadsafe" != "xyes"
2119 then
2120 with_rrdtool="yes (warning: librrd is not thread-safe)"
2121 fi
2123 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
2124 then
2125 with_liboping="yes (shipped version)"
2126 fi
2128 if test "x$with_libperl" = "xyes"
2129 then
2130 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2131 else
2132 enable_perl="no (needs libperl)"
2133 fi
2135 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
2136 then
2137 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2138 fi
2140 cat <<EOF;
2142 Configuration:
2143 Libraries:
2144 libcurl . . . . . . $with_libcurl
2145 libiokit . . . . . $with_libiokit
2146 libiptc . . . . . . $with_libiptc
2147 libkstat . . . . . $with_kstat
2148 libkvm . . . . . . $with_libkvm
2149 libmysql . . . . . $with_libmysql
2150 libnetlink . . . . $with_libnetlink
2151 libnetsnmp . . . . $with_libnetsnmp
2152 liboconfig . . . . $with_liboconfig
2153 liboping . . . . . $with_liboping
2154 libpcap . . . . . . $with_libpcap
2155 libperl . . . . . . $with_libperl
2156 libpthread . . . . $with_libpthread
2157 librrd . . . . . . $with_rrdtool
2158 libsensors . . . . $with_lm_sensors
2159 libstatgrab . . . . $with_libstatgrab
2160 libupsclient . . . $with_libupsclient
2161 libvirt . . . . . . $with_libvirt
2162 libxml2 . . . . . . $with_libxml2
2163 libxmms . . . . . . $with_libxmms
2165 Features:
2166 daemon mode . . . . $enable_daemon
2167 debug . . . . . . . $enable_debug
2169 Bindings:
2170 perl . . . . . . . $with_perl_bindings
2172 Modules:
2173 apache . . . . . . $enable_apache
2174 apcups . . . . . . $enable_apcups
2175 apple_sensors . . . $enable_apple_sensors
2176 battery . . . . . . $enable_battery
2177 cpu . . . . . . . . $enable_cpu
2178 cpufreq . . . . . . $enable_cpufreq
2179 csv . . . . . . . . $enable_csv
2180 df . . . . . . . . $enable_df
2181 disk . . . . . . . $enable_disk
2182 dns . . . . . . . . $enable_dns
2183 email . . . . . . . $enable_email
2184 entropy . . . . . . $enable_entropy
2185 exec . . . . . . . $enable_exec
2186 hddtemp . . . . . . $enable_hddtemp
2187 interface . . . . . $enable_interface
2188 iptables . . . . . $enable_iptables
2189 ipvs . . . . . . . $enable_ipvs
2190 irq . . . . . . . . $enable_irq
2191 libvirt . . . . . . $enable_libvirt
2192 load . . . . . . . $enable_load
2193 logfile . . . . . . $enable_logfile
2194 mbmon . . . . . . . $enable_mbmon
2195 memcached . . . . . $enable_memcached
2196 memory . . . . . . $enable_memory
2197 multimeter . . . . $enable_multimeter
2198 mysql . . . . . . . $enable_mysql
2199 netlink . . . . . . $enable_netlink
2200 network . . . . . . $enable_network
2201 nfs . . . . . . . . $enable_nfs
2202 nginx . . . . . . . $enable_nginx
2203 ntpd . . . . . . . $enable_ntpd
2204 nut . . . . . . . . $enable_nut
2205 perl . . . . . . . $enable_perl
2206 ping . . . . . . . $enable_ping
2207 processes . . . . . $enable_processes
2208 rrdtool . . . . . . $enable_rrdtool
2209 sensors . . . . . . $enable_sensors
2210 serial . . . . . . $enable_serial
2211 snmp . . . . . . . $enable_snmp
2212 swap . . . . . . . $enable_swap
2213 syslog . . . . . . $enable_syslog
2214 tape . . . . . . . $enable_tape
2215 tcpconns . . . . . $enable_tcpconns
2216 unixsock . . . . . $enable_unixsock
2217 users . . . . . . . $enable_users
2218 uuid . . . . . . . $enable_uuid
2219 vserver . . . . . . $enable_vserver
2220 wireless . . . . . $enable_wireless
2221 xmms . . . . . . . $enable_xmms
2223 EOF