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)
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)
376 AC_CHECK_FUNCS(getgrnam_r)
378 socket_needs_socket="no"
379 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
380 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
382 nanosleep_needs_rt="no"
383 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
384 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
386 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
388 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
389 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
390 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
391 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
392 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
393 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
394 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
395 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
396 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
397 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
399 # For load module
400 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
402 # Check for NAN
403 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
404 [
405 if test "x$withval" = "xno"; then
406 nan_type="none"
407 else if test "x$withval" = "xyes"; then
408 nan_type="zero"
409 else
410 nan_type="$withval"
411 fi; fi
412 ],
413 [nan_type="none"])
414 if test "x$nan_type" = "xnone"; then
415 AC_CACHE_CHECK([whether NAN is defined by default],
416 [have_nan_default],
417 AC_COMPILE_IFELSE(
418 AC_LANG_PROGRAM(
419 [[
420 #include <stdlib.h>
421 #include <math.h>
422 static float foo = NAN;
423 ]],
424 [[
425 if (isnan (foo))
426 return 0;
427 else
428 return 1;
429 ]]),
430 [have_nan_default="yes"],
431 [have_nan_default="no"]
432 )
433 )
434 if test "x$have_nan_default" = "xyes"
435 then
436 nan_type="default"
437 fi
438 fi
439 if test "x$nan_type" = "xnone"; then
440 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
441 [have_nan_isoc],
442 AC_COMPILE_IFELSE(
443 AC_LANG_PROGRAM(
444 [[
445 #include <stdlib.h>
446 #define __USE_ISOC99 1
447 #include <math.h>
448 static float foo = NAN;
449 ]],
450 [[
451 if (isnan (foo))
452 return 0;
453 else
454 return 1;
455 ]]),
456 [have_nan_isoc="yes"],
457 [have_nan_isoc="no"]
458 )
459 )
460 if test "x$have_nan_isoc" = "xyes"
461 then
462 nan_type="isoc99"
463 fi
464 fi
465 if test "x$nan_type" = "xnone"; then
466 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
467 [have_nan_zero],
468 AC_RUN_IFELSE(
469 AC_LANG_PROGRAM(
470 [[
471 #include <stdlib.h>
472 #include <math.h>
473 #ifdef NAN
474 # undef NAN
475 #endif
476 #define NAN (0.0 / 0.0)
477 #ifndef isnan
478 # define isnan(f) ((f) != (f))
479 #endif
480 static float foo = NAN;
481 ]],
482 [[
483 if (isnan (foo))
484 return 0;
485 else
486 return 1;
487 ]]),
488 [have_nan_zero="yes"],
489 [have_nan_zero="no"]
490 )
491 )
492 if test "x$have_nan_zero" = "xyes"
493 then
494 nan_type="zero"
495 fi
496 fi
498 if test "x$nan_type" = "xdefault"; then
499 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
500 [Define if NAN is defined by default and can initialize static variables.])
501 else if test "x$nan_type" = "xisoc99"; then
502 AC_DEFINE(NAN_STATIC_ISOC, 1,
503 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
504 else if test "x$nan_type" = "xzero"; then
505 AC_DEFINE(NAN_ZERO_ZERO, 1,
506 [Define if NAN can be defined as (0.0 / 0.0)])
507 else
508 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
509 fi; fi; fi
511 # For mount interface
512 #AC_CHECK_FUNCS(getfsent getvfsent)
514 have_getfsstat="no"
515 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
516 have_getvfsstat="no"
517 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
518 have_listmntent="no"
519 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
521 have_getmntent="no"
522 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
523 if test "x$have_getmntent" = "xno"; then
524 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
525 fi
526 if test "x$have_getmntent" = "xno"; then
527 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
528 fi
529 if test "x$have_getmntent" = "xno"; then
530 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
531 fi
533 if test "x$have_getmntent" = "xc"; then
534 AC_CACHE_CHECK([whether getmntent takes one argument],
535 [have_one_getmntent],
536 AC_COMPILE_IFELSE(
537 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
538 #include <mntent.h>
539 #include "$srcdir/src/utils_mount.h"]],
540 [[
541 FILE *fh;
542 struct mntent *me;
543 fh = setmntent ("/etc/mtab", "r");
544 me = getmntent (fh);
545 ]]
546 ),
547 [have_one_getmntent="yes"],
548 [have_one_getmntent="no"]
549 )
550 )
551 AC_CACHE_CHECK([whether getmntent takes two arguments],
552 [have_two_getmntent],
553 AC_COMPILE_IFELSE(
554 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
555 #include <sys/mnttab.h>
556 #include "$srcdir/src/utils_mount.h"]],
557 [[
558 FILE *fh;
559 struct mnttab mt;
560 int status;
561 fh = fopen ("/etc/mnttab", "r");
562 status = getmntent (fh, &mt);
563 ]]
564 ),
565 [have_two_getmntent="yes"],
566 [have_two_getmntent="no"]
567 )
568 )
569 fi
571 # Check for different versions of `getmntent' here..
573 if test "x$have_getmntent" = "xc"; then
574 if test "x$have_one_getmntent" = "xyes"; then
575 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
576 [Define if the function getmntent exists and takes one argument.])
577 fi
578 if test "x$have_two_getmntent" = "xyes"; then
579 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
580 [Define if the function getmntent exists and takes two arguments.])
581 fi
582 fi
583 if test "x$have_getmntent" = "xsun"; then
584 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
585 [Define if the function getmntent exists. It's the version from libsun.])
586 fi
587 if test "x$have_getmntent" = "xseq"; then
588 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
589 [Define if the function getmntent exists. It's the version from libseq.])
590 fi
591 if test "x$have_getmntent" = "xgen"; then
592 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
593 [Define if the function getmntent exists. It's the version from libgen.])
594 fi
596 # Check for structures
597 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
598 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
599 [],
600 [
601 #include <sys/types.h>
602 #include <sys/socket.h>
603 #include <net/if.h>
604 ])
605 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
606 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
607 [],
608 [
609 #include <sys/types.h>
610 #include <sys/socket.h>
611 #include <linux/if.h>
612 #include <linux/netdevice.h>
613 ])
615 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
616 [#if HAVE_STDINT_H
617 # include <stdint.h>
618 #endif
619 #if HAVE_SYS_TYPES_H
620 # include <sys/types.h>
621 #endif
622 #if HAVE_NETINET_IN_SYSTM_H
623 # include <netinet/in_systm.h>
624 #endif
625 #if HAVE_NETINET_IN_H
626 # include <netinet/in.h>
627 #endif
628 #if HAVE_NETINET_IP_H
629 # include <netinet/ip.h>
630 #endif
631 #if HAVE_NETINET_UDP_H
632 # include <netinet/udp.h>
633 #endif
634 ])
635 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
636 [#if HAVE_STDINT_H
637 # include <stdint.h>
638 #endif
639 #if HAVE_SYS_TYPES_H
640 # include <sys/types.h>
641 #endif
642 #if HAVE_NETINET_IN_SYSTM_H
643 # include <netinet/in_systm.h>
644 #endif
645 #if HAVE_NETINET_IN_H
646 # include <netinet/in.h>
647 #endif
648 #if HAVE_NETINET_IP_H
649 # include <netinet/ip.h>
650 #endif
651 #if HAVE_NETINET_UDP_H
652 # include <netinet/udp.h>
653 #endif
654 ])
656 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
657 [],
658 [],
659 [
660 #if HAVE_KSTAT_H
661 # include <kstat.h>
662 #endif
663 ])
665 with_libresolv="yes"
666 AC_CHECK_LIB(resolv, res_search,
667 [
668 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
669 ],
670 [with_libresolv="no"])
671 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
673 dnl Check for HAL (hardware abstraction library)
674 with_libhal="yes"
675 AC_CHECK_LIB(hal,libhal_device_property_exists,
676 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
677 [with_libhal="no"])
678 if test "x$with_libhal" = "xyes"; then
679 PKG_PROG_PKG_CONFIG
680 if test "x$PKG_CONFIG" != "x"; then
681 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
682 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
683 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
684 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
685 fi
686 fi
688 m4_divert_once([HELP_WITH], [
689 collectd additional packages:])
691 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
692 librrd_cflags=""
693 librrd_ldflags=""
694 librrd_threadsafe="yes"
695 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
696 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
697 then
698 librrd_cflags="-I$withval/include"
699 librrd_ldflags="-L$withval/lib"
700 with_rrdtool="yes"
701 fi
702 ], [with_rrdtool="yes"])
703 if test "x$with_rrdtool" = "xyes"
704 then
705 SAVE_CPPFLAGS="$CPPFLAGS"
706 SAVE_LDFLAGS="$LDFLAGS"
708 CPPFLAGS="$CPPFLAGS $librrd_cflags"
709 LDFLAGS="$LDFLAGS $librrd_ldflags"
711 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
713 CPPFLAGS="$SAVE_CPPFLAGS"
714 LDFLAGS="$SAVE_LDFLAGS"
715 fi
716 if test "x$with_rrdtool" = "xyes"
717 then
718 SAVE_CPPFLAGS="$CPPFLAGS"
719 SAVE_LDFLAGS="$LDFLAGS"
721 CPPFLAGS="$CPPFLAGS $librrd_cflags"
722 LDFLAGS="$LDFLAGS $librrd_ldflags"
724 AC_CHECK_LIB(rrd_th, rrd_update_r,
725 [with_rrdtool="yes"
726 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
727 ],
728 [librrd_threadsafe="no"
729 AC_CHECK_LIB(rrd, rrd_update,
730 [with_rrdtool="yes"
731 librrd_ldflags="$librrd_ldflags -lrrd -lm"
732 ],
733 [with_rrdtool="no (symbol 'rrd_update' not found)"],
734 [-lm])
735 ]
736 [-lm])
738 CPPFLAGS="$SAVE_CPPFLAGS"
739 LDFLAGS="$SAVE_LDFLAGS"
740 fi
741 if test "x$with_rrdtool" = "xyes"
742 then
743 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
744 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
745 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
746 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
747 fi
748 if test "x$librrd_threadsafe" = "xyes"
749 then
750 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
751 fi
753 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
754 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
755 then
756 LDFLAGS="$LDFLAGS -L$withval/lib"
757 CPPFLAGS="$CPPFLAGS -I$withval/include"
758 with_libpthread="yes"
759 else
760 if test "x$withval" = "xno"
761 then
762 with_libpthread="no (disabled)"
763 fi
764 fi
765 ], [with_libpthread="yes"])
766 if test "x$with_libpthread" = "xyes"
767 then
768 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
769 fi
770 if test "x$with_libpthread" = "xyes"
771 then
772 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
773 fi
774 if test "x$with_libpthread" = "xyes"
775 then
776 collect_pthread=1
777 else
778 collect_pthread=0
779 fi
780 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
781 [Wether or not to use pthread (POSIX threads) library])
782 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
784 if test "x$ac_system" = "xSolaris"
785 then
786 with_kstat="yes"
787 with_devinfo="yes"
788 else
789 with_kstat="no (Solaris only)"
790 with_devinfo="no (Solaris only)"
791 fi
793 if test "x$with_kstat" = "xyes"
794 then
795 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
796 fi
797 if test "x$with_kstat" = "xyes"
798 then
799 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
800 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
801 fi
802 if test "x$with_kstat" = "xyes"
803 then
804 AC_DEFINE(HAVE_LIBKSTAT, 1,
805 [Define to 1 if you have the 'kstat' library (-lkstat)])
806 fi
807 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
808 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
810 ### BEGIN of check for libcurl ###
811 with_curl_config="curl-config"
812 with_curl_cflags=""
813 with_curl_libs=""
814 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
815 [
816 if test "x$withval" = "xno"
817 then
818 with_libcurl="no"
819 else if test "x$withval" = "xyes"
820 then
821 with_libcurl="yes"
822 else
823 if test -f "$withval" && test -x "$withval"
824 then
825 with_curl_config="$withval"
826 with_libcurl="yes"
827 else if test -x "$withval/bin/curl-config"
828 then
829 with_curl_config="$withval/bin/curl-config"
830 with_libcurl="yes"
831 fi; fi
832 with_libcurl="yes"
833 fi; fi
834 ],
835 [
836 with_libcurl="yes"
837 ])
838 if test "x$with_libcurl" = "xyes"
839 then
840 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
841 curl_config_status=$?
843 if test $curl_config_status -ne 0
844 then
845 with_libcurl="no ($with_curl_config failed)"
846 else
847 SAVE_CFLAGS=$CFLAGS
848 CFLAGS="$CFLAGS $with_curl_cflags"
850 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
852 CFLAGS="$SAVE_CFLAGS"
853 fi
854 fi
855 if test "x$with_libcurl" = "xyes"
856 then
857 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
858 curl_config_status=$?
860 if test $curl_config_status -ne 0
861 then
862 with_libcurl="no ($with_curl_config failed)"
863 else
864 AC_CHECK_LIB(curl, curl_easy_init,
865 [with_libcurl="yes"],
866 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
867 [$with_curl_libs])
868 fi
869 fi
870 if test "x$with_libcurl" = "xyes"
871 then
872 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
873 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
874 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
875 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
876 fi
877 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
878 ### END of check for libcurl ###
880 with_libiokit="no"
881 collectd_libiokit=0
882 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
883 [
884 with_libiokit="yes"
885 collectd_libiokit=1
886 ],
887 [
888 with_libiokit="no"
889 collectd_libiokit=0
890 ])
891 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
892 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
894 with_libstatgrab="yes"
895 with_libdevstat="no"
896 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
897 [
898 if test "x$withval" != "xno" -a "x$withval" != "xyes"
899 then
900 LDFLAGS="$LDFLAGS -L$withval/lib"
901 CPPFLAGS="$CPPFLAGS -I$withval/include"
902 with_libstatgrab="yes"
903 fi
904 ],
905 [
906 if test "x$ac_system" == "xunknown"
907 then
908 with_libstatgrab="yes"
909 else
910 with_libstatgrab="no"
911 fi
912 ])
913 if test "x$with_libstatgrab" = "xyes"
914 then
915 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
916 fi
917 if test "x$with_libstatgrab" = "xyes"
918 then
919 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
920 fi
921 if test "x$with_libstatgrab" = "xyes"
922 then
923 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
924 fi
925 if test "x$with_libstatgrab" = "xyes"
926 then
927 collect_libstatgrab=1
928 else
929 collect_libstatgrab=0
930 fi
931 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
932 [Wether or not to use statgrab library])
933 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
934 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
936 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
937 if test "x$with_libkvm" = "xyes"
938 then
939 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
940 fi
941 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
943 with_sensors_cflags=""
944 with_sensors_ldflags=""
945 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
946 [
947 if test "x$withval" = "xno"
948 then
949 with_lm_sensors="no"
950 else
951 with_lm_sensors="yes"
952 if test "x$withval" != "xyes"
953 then
954 with_sensors_cflags="-I$withval/include"
955 with_sensors_ldflags="-L$withval/lib"
956 with_lm_sensors="yes"
957 fi
958 fi
959 ],
960 [
961 if test "x$ac_system" = "xLinux"
962 then
963 with_lm_sensors="yes"
964 else
965 with_lm_sensors="no (Linux only library)"
966 fi
967 ])
968 if test "x$with_lm_sensors" = "xyes"
969 then
970 SAVE_CPPFLAGS="$CPPFLAGS"
971 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
973 # AC_CHECK_HEADERS(sensors/sensors.h,
974 # [
975 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
976 # ],
977 # [with_lm_sensors="no (sensors/sensors.h not found)"])
978 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
980 CPPFLAGS="$SAVE_CPPFLAGS"
981 fi
982 if test "x$with_lm_sensors" = "xyes"
983 then
984 SAVE_CPPFLAGS="$CPPFLAGS"
985 SAVE_LDFLAGS="$LDFLAGS"
986 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
987 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
989 AC_CHECK_LIB(sensors, sensors_init,
990 [
991 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
992 ],
993 [with_lm_sensors="no (libsensors not found)"])
995 CPPFLAGS="$SAVE_CPPFLAGS"
996 LDFLAGS="$SAVE_LDFLAGS"
997 fi
998 if test "x$with_lm_sensors" = "xyes"
999 then
1000 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1001 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1002 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1003 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1004 fi
1005 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1007 with_mysql_config="mysql_config"
1008 with_mysql_cflags=""
1009 with_mysql_libs=""
1010 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1011 [
1012 if test "x$withval" = "xno"
1013 then
1014 with_libmysql="no"
1015 else if test "x$withval" = "xyes"
1016 then
1017 with_libmysql="yes"
1018 else
1019 if test -f "$withval" && test -x "$withval";
1020 then
1021 with_mysql_config="$withval"
1022 else if test -x "$withval/bin/mysql_config"
1023 then
1024 with_mysql_config="$withval/bin/mysql_config"
1025 fi; fi
1026 with_libmysql="yes"
1027 fi; fi
1028 ],
1029 [
1030 with_libmysql="yes"
1031 ])
1032 if test "x$with_libmysql" = "xyes"
1033 then
1034 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1035 mysql_config_status=$?
1037 if test $mysql_config_status -ne 0
1038 then
1039 with_libmysql="no"
1040 else
1041 SAVE_CFLAGS=$CFLAGS
1042 CFLAGS="$CFLAGS $with_mysql_cflags"
1044 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1046 CFLAGS="$SAVE_CFLAGS"
1047 fi
1048 fi
1049 if test "x$with_libmysql" = "xyes"
1050 then
1051 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1052 mysql_config_status=$?
1054 if test $mysql_config_status -ne 0
1055 then
1056 with_libmysql="no"
1057 else
1058 AC_CHECK_LIB(mysqlclient, mysql_init,
1059 [with_libmysql="yes"],
1060 [with_libmysql="no (symbol 'mysql_init' not found)"],
1061 [$with_mysql_libs])
1062 fi
1063 fi
1064 if test "x$with_libmysql" = "xyes"
1065 then
1066 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1067 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1068 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1069 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1070 fi
1071 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1073 with_own_liboconfig="no"
1074 liboconfig_LDFLAGS="$LDFLAGS"
1075 liboconfig_CPPFLAGS="$CPPFLAGS"
1076 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1077 [
1078 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1079 then
1080 if test -d "$withval/lib"
1081 then
1082 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1083 fi
1084 if test -d "$withval/include"
1085 then
1086 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1087 fi
1088 fi
1089 if test "x$withval" = "xno"
1090 then
1091 AC_MSG_ERROR("liboconfig is required")
1092 fi
1093 ],
1094 [
1095 with_liboconfig="yes"
1096 ])
1098 save_LDFLAGS="$LDFLAGS"
1099 save_CPPFLAGS="$CPPFLAGS"
1100 LDFLAGS="$liboconfig_LDFLAGS"
1101 CPPFLAGS="$liboconfig_CPPFLAGS"
1102 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1103 [
1104 with_liboconfig="yes"
1105 with_own_liboconfig="no"
1106 ],
1107 [
1108 with_liboconfig="yes"
1109 with_own_liboconfig="yes"
1110 LDFLAGS="$save_LDFLAGS"
1111 CPPFLAGS="$save_CPPFLAGS"
1112 ])
1114 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1115 if test "x$with_own_liboconfig" = "xyes"
1116 then
1117 with_liboconfig="yes (shipped version)"
1118 fi
1120 #with_liboping="yes"
1121 with_own_liboping="no"
1122 liboping_LDFLAGS="$LDFLAGS"
1123 liboping_CPPFLAGS="$CPPFLAGS"
1124 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1125 [
1126 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1127 then
1128 if test -d "$withval/lib"
1129 then
1130 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1131 fi
1132 if test -d "$withval/include"
1133 then
1134 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1135 fi
1136 fi
1137 if test "x$withval" = "xno"
1138 then
1139 with_liboping="no"
1140 with_own_liboping="no"
1141 fi
1142 ],
1143 [
1144 with_liboping="yes"
1145 ])
1147 if test "x$with_liboping" = "xyes"
1148 then
1149 save_LDFLAGS="$LDFLAGS"
1150 save_CPPFLAGS="$CPPFLAGS"
1151 LDFLAGS="$liboping_LDFLAGS"
1152 CPPFLAGS="$liboping_CPPFLAGS"
1153 AC_CHECK_LIB(oping, ping_construct,
1154 [
1155 with_liboping="yes"
1156 with_own_liboping="no"
1157 ],
1158 [
1159 with_liboping="yes"
1160 with_own_liboping="yes"
1161 LDFLAGS="$save_LDFLAGS"
1162 CPPFLAGS="$save_CPPFLAGS"
1163 ])
1164 fi
1165 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1166 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1168 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1169 [
1170 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1171 then
1172 LDFLAGS="$LDFLAGS -L$withval/lib"
1173 CPPFLAGS="$CPPFLAGS -I$withval/include"
1174 with_libpcap="yes"
1175 fi
1176 ],
1177 [
1178 with_libpcap="yes"
1179 ])
1180 if test "x$with_libpcap" = "xyes"
1181 then
1182 AC_CHECK_LIB(pcap, pcap_open_live,
1183 [
1184 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1185 ], [with_libpcap="no (libpcap not found)"])
1186 fi
1187 if test "x$with_libpcap" = "xyes"
1188 then
1189 AC_CHECK_HEADERS(pcap.h,
1190 [
1191 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1192 ], [with_libpcap="no (pcap.h not found)"])
1193 fi
1194 if test "x$with_libpcap" = "xyes"
1195 then
1196 collect_libpcap=1
1197 else
1198 collect_libpcap=0
1199 fi
1200 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1201 [Wether or not to use the pcap library])
1202 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1204 perl_interpreter="perl"
1205 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1206 [
1207 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1208 then
1209 LDFLAGS="$LDFLAGS -L$withval/lib"
1210 CPPFLAGS="$CPPFLAGS -I$withval/include"
1211 perl_interpreter="$withval/bin/perl"
1212 with_libperl="yes"
1213 fi
1214 ],
1215 [
1216 with_libperl="yes"
1217 ])
1219 AC_SUBST(PERL, "$perl_interpreter")
1221 if test "x$with_libperl" = "xyes"
1222 then
1223 SAVE_CFLAGS=$CFLAGS
1224 SAVE_LDFLAGS=$LDFLAGS
1225 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1226 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1227 CFLAGS="$CFLAGS $PERL_CFLAGS"
1228 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1230 AC_CACHE_CHECK([for libperl],
1231 [have_libperl],
1232 AC_LINK_IFELSE(
1233 AC_LANG_PROGRAM(
1234 [[
1235 #include <EXTERN.h>
1236 #include <perl.h>
1237 #include <XSUB.h>
1238 ]],
1239 [[
1240 PerlInterpreter *perl = NULL;
1241 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1242 newSVpv ("Collectd::Plugin::FooBar", 24),
1243 Nullsv);
1244 ]]),
1245 [have_libperl="yes"],
1246 [have_libperl="no"]
1247 )
1248 )
1250 if test "x$have_libperl" = "xyes"
1251 then
1252 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1253 AC_SUBST(PERL_CFLAGS)
1254 AC_SUBST(PERL_LDFLAGS)
1255 else
1256 with_libperl="no"
1257 fi
1259 CFLAGS=$SAVE_CFLAGS
1260 LDFLAGS=$SAVE_LDFLAGS
1261 fi
1262 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1264 if test "x$with_libperl" = "xyes"
1265 then
1266 SAVE_CFLAGS=$CFLAGS
1267 SAVE_LDFLAGS=$LDFLAGS
1268 CFLAGS="$CFLAGS $PERL_CFLAGS"
1269 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1271 AC_CACHE_CHECK([if perl supports ithreads],
1272 [have_perl_ithreads],
1273 AC_LINK_IFELSE(
1274 AC_LANG_PROGRAM(
1275 [[
1276 #include <EXTERN.h>
1277 #include <perl.h>
1278 #include <XSUB.h>
1280 #if !defined(USE_ITHREADS)
1281 # error "Perl does not support ithreads!"
1282 #endif /* !defined(USE_ITHREADS) */
1283 ]],
1284 [[ ]]),
1285 [have_perl_ithreads="yes"],
1286 [have_perl_ithreads="no"]
1287 )
1288 )
1290 if test "x$have_perl_ithreads" = "xyes"
1291 then
1292 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1293 fi
1295 CFLAGS=$SAVE_CFLAGS
1296 LDFLAGS=$SAVE_LDFLAGS
1297 fi
1299 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1300 [
1301 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1302 then
1303 LDFLAGS="$LDFLAGS -L$withval/lib"
1304 CPPFLAGS="$CPPFLAGS -I$withval/include"
1305 with_libiptc="yes"
1306 fi
1307 ],
1308 [
1309 if test "x$ac_system" = "xLinux"
1310 then
1311 with_libiptc="yes"
1312 else
1313 with_libiptc="no (Linux only)"
1314 fi
1315 ])
1316 if test "x$with_libiptc" = "xyes"
1317 then
1318 AC_CHECK_LIB(iptc, iptc_init,
1319 [
1320 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1321 ], [with_libiptc="no (libiptc not found)"])
1322 fi
1323 if test "x$with_libiptc" = "xyes"
1324 then
1325 AC_CHECK_HEADERS(libiptc/libiptc.h,
1326 [
1327 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1328 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1329 fi
1330 if test "x$with_libiptc" = "xyes"
1331 then
1332 collect_libiptc=1
1333 else
1334 collect_libiptc=0
1335 fi
1336 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1338 with_snmp_config="net-snmp-config"
1339 with_snmp_cflags=""
1340 with_snmp_libs=""
1341 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1342 [
1343 if test "x$withval" = "xno"
1344 then
1345 with_libnetsnmp="no"
1346 else if test "x$withval" = "xyes"
1347 then
1348 with_libnetsnmp="yes"
1349 else
1350 if test -x "$withval"
1351 then
1352 with_snmp_config="$withval"
1353 with_libnetsnmp="yes"
1354 else
1355 with_snmp_config="$withval/bin/net-snmp-config"
1356 with_libnetsnmp="yes"
1357 fi
1358 fi; fi
1359 ],
1360 [with_libnetsnmp="yes"])
1361 if test "x$with_libnetsnmp" = "xyes"
1362 then
1363 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1364 snmp_config_status=$?
1366 if test $snmp_config_status -ne 0
1367 then
1368 with_libnetsnmp="no ($with_snmp_config failed)"
1369 else
1370 SAVE_CFLAGS=$CFLAGS
1371 CFLAGS="$CFLAGS $with_snmp_cflags"
1373 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1375 CFLAGS="$SAVE_CFLAGS"
1376 fi
1377 fi
1378 if test "x$with_libnetsnmp" = "xyes"
1379 then
1380 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1381 snmp_config_status=$?
1383 if test $snmp_config_status -ne 0
1384 then
1385 with_libnetsnmp="no ($with_snmp_config failed)"
1386 else
1387 AC_CHECK_LIB(netsnmp, init_snmp,
1388 [with_libnetsnmp="yes"],
1389 [with_libnetsnmp="no (libnetsnmp not found)"],
1390 [$with_snmp_libs])
1391 fi
1392 fi
1393 if test "x$with_libnetsnmp" = "xyes"
1394 then
1395 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1396 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1397 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1398 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1399 fi
1400 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1402 with_upsclient_config="libupsclient-config"
1403 with_upsclient_cflags=""
1404 with_upsclient_libs=""
1405 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1406 [
1407 if test "x$withval" = "xno"
1408 then
1409 with_libupsclient="no"
1410 else
1411 if test "x$withval" != "xyes"
1412 then
1413 if test -f "$withval" && test -x "$withval";
1414 then
1415 with_upsclient_config="$withval"
1416 else
1417 with_upsclient_config="$withval/bin/libupsclient-config"
1418 fi
1419 fi
1420 with_libupsclient="yes"
1421 fi
1422 ],
1423 [
1424 with_libupsclient="yes"
1425 ])
1426 if test "x$with_libupsclient" = "xyes"
1427 then
1428 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1429 upsclient_config_status=$?
1431 if test $upsclient_config_status -ne 0
1432 then
1433 with_libupsclient="no ($with_upsclient_config failed)"
1434 fi
1435 fi
1436 if test "x$with_libupsclient" = "xyes"
1437 then
1438 SAVE_CFLAGS="$CFLAGS"
1439 CFLAGS="$CFLAGS $with_upsclient_cflags"
1441 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1443 CFLAGS="$SAVE_CFLAGS"
1444 fi
1445 if test "x$with_libupsclient" = "xyes"
1446 then
1447 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1448 upsclient_config_status=$?
1450 if test $upsclient_config_status -ne 0
1451 then
1452 with_libupsclient="no ($with_upsclient_config failed)"
1453 fi
1454 fi
1455 if test "x$with_libupsclient" = "xyes"
1456 then
1457 AC_CHECK_LIB(upsclient, upscli_connect,
1458 [
1459 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1460 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1461 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1462 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1463 ],
1464 [
1465 with_libupsclient="no (symbol 'upscli_connect' not found)"
1466 ], [$with_upsclient_libs])
1467 fi
1468 if test "x$with_libupsclient" = "xyes"
1469 then
1470 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1471 [#include <stdlib.h>
1472 #include <stdio.h>
1473 #include <upsclient.h>])
1474 fi
1475 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1477 ### BEGIN of check for libxmms ###
1478 with_xmms_config="xmms-config"
1479 with_xmms_cflags=""
1480 with_xmms_libs=""
1481 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1482 [
1483 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1484 then
1485 if test -f "$withval" && test -x "$withval";
1486 then
1487 with_xmms_config="$withval"
1488 else if test -x "$withval/bin/xmms-config"
1489 then
1490 with_xmms_config="$withval/bin/xmms-config"
1491 fi; fi
1492 with_libxmms="yes"
1493 else if test "x$withval" = "xno"
1494 then
1495 with_libxmms="no"
1496 else
1497 with_libxmms="yes"
1498 fi; fi
1499 ],
1500 [
1501 with_libxmms="yes"
1502 ])
1503 if test "x$with_libxmms" = "xyes"
1504 then
1505 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1506 xmms_config_status=$?
1508 if test $xmms_config_status -ne 0
1509 then
1510 with_libxmms="no"
1511 fi
1512 fi
1513 if test "x$with_libxmms" = "xyes"
1514 then
1515 with_xmms_libs=`$with_xmms_config --libs 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 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1526 [
1527 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1528 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1529 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1530 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1531 ],
1532 [
1533 with_libxmms="no"
1534 ],
1535 [$with_xmms_libs])
1536 fi
1537 with_libxmms_numeric=0
1538 if test "x$with_libxmms" = "xyes"
1539 then
1540 with_libxmms_numeric=1
1541 fi
1542 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1543 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1544 ### END of check for libxmms ###
1546 with_libnetlink_cflags=""
1547 with_libnetlink_libs="-lnetlink"
1548 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1549 [
1550 echo "libnetlink: withval = $withval"
1551 if test "x$withval" = "xyes"
1552 then
1553 with_libnetlink="yes"
1554 else if test "x$withval" = "xno"
1555 then
1556 with_libnetlink="no"
1557 else
1558 if test -d "$withval/include"
1559 then
1560 with_libnetlink_cflags="-I$withval/include"
1561 with_libnetlink_libs="-L$withval/lib -lnetlink"
1562 with_libnetlink="yes"
1563 else
1564 AC_MSG_ERROR("no such directory: $withval/include")
1565 fi
1566 fi; fi
1567 ],
1568 [
1569 if test "x$ac_system" = "xLinux"
1570 then
1571 with_libnetlink="yes"
1572 else
1573 with_libnetlink="no (Linux only library)"
1574 fi
1575 ])
1576 if test "x$with_libnetlink" = "xyes"
1577 then
1578 SAVE_CFLAGS=$CFLAGS
1579 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1581 with_libnetlink="no (libnetlink.h not found)"
1583 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1584 [
1585 with_libnetlink="yes"
1586 break
1587 ], [],
1588 [#include <stdio.h>
1589 #include <sys/types.h>
1590 #include <asm/types.h>
1591 #include <sys/socket.h>
1592 #include <linux/netlink.h>
1593 #include <linux/rtnetlink.h>])
1594 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1595 [#include <stdio.h>
1596 #include <sys/types.h>
1597 #include <asm/types.h>
1598 #include <sys/socket.h>])
1600 AC_COMPILE_IFELSE(
1601 [#include <stdio.h>
1602 #include <sys/types.h>
1603 #include <asm/types.h>
1604 #include <sys/socket.h>
1605 #include <linux/netlink.h>
1606 #include <linux/rtnetlink.h>
1608 int main (void)
1609 {
1610 int retval = TCA_STATS2;
1611 return (retval);
1612 }],
1613 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1614 []);
1616 AC_COMPILE_IFELSE(
1617 [#include <stdio.h>
1618 #include <sys/types.h>
1619 #include <asm/types.h>
1620 #include <sys/socket.h>
1621 #include <linux/netlink.h>
1622 #include <linux/rtnetlink.h>
1624 int main (void)
1625 {
1626 int retval = TCA_STATS;
1627 return (retval);
1628 }],
1629 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1630 []);
1632 CFLAGS="$SAVE_CFLAGS"
1633 fi
1634 if test "x$with_libnetlink" = "xyes"
1635 then
1636 AC_CHECK_LIB(netlink, rtnl_open,
1637 [with_libnetlink="yes"],
1638 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1639 [$with_libnetlink_libs])
1640 fi
1641 if test "x$with_libnetlink" = "xyes"
1642 then
1643 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1644 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1645 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1646 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1647 fi
1648 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1650 dnl Check for libvirt and libxml2 libraries.
1651 with_libxml2="no (pkg-config isn't available)"
1652 with_libxml2_cflags=""
1653 with_libxml2_ldflags=""
1654 with_libvirt="no (pkg-config isn't available)"
1655 with_libvirt_cflags=""
1656 with_libvirt_ldflags=""
1657 PKG_PROG_PKG_CONFIG
1658 if test "x$PKG_CONFIG" != "x"
1659 then
1660 pkg-config --exists 'libxml-2.0' 2>/dev/null
1661 if test "$?" = "0"
1662 then
1663 with_libxml2="yes"
1664 else
1665 with_libxml2="no (pkg-config doesn't know library)"
1666 fi
1668 pkg-config --exists libvirt 2>/dev/null
1669 if test "$?" = "0"
1670 then
1671 with_libvirt="yes"
1672 else
1673 with_libvirt="no (pkg-config doesn't know library)"
1674 fi
1675 fi
1676 if test "x$with_libxml2" = "xyes"
1677 then
1678 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
1679 if test $? -ne 0
1680 then
1681 with_libxml2="no"
1682 fi
1683 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
1684 if test $? -ne 0
1685 then
1686 with_libxml2="no"
1687 fi
1688 fi
1689 if test "x$with_libxml2" = "xyes"
1690 then
1691 SAVE_CPPFLAGS="$CPPFLAGS"
1692 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
1694 AC_CHECK_HEADERS(libxml/parser.h, [],
1695 [with_libxml2="no (libxml/parser.h not found)"])
1697 CPPFLAGS="$SAVE_CPPFLAGS"
1698 fi
1699 if test "x$with_libxml2" = "xyes"
1700 then
1701 SAVE_CFLAGS="$CFLAGS"
1702 SAVE_LD_FLAGS="$LDFLAGS"
1704 CFLAGS="$CFLAGS $with_libxml2_cflags"
1705 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
1707 AC_CHECK_LIB(xml2, xmlXPathEval,
1708 [with_libxml2="yes"],
1709 [with_libxml2="no (symbol xmlXPathEval not found)"])
1711 CFLAGS="$SAVE_CFLAGS"
1712 LDFLAGS="$SAVE_LDFLAGS"
1713 fi
1714 dnl Add the right compiler flags and libraries.
1715 if test "x$with_libxml2" = "xyes"; then
1716 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
1717 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
1718 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
1719 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
1720 fi
1721 if test "x$with_libvirt" = "xyes"
1722 then
1723 with_libvirt_cflags="`pkg-config --cflags libvirt`"
1724 if test $? -ne 0
1725 then
1726 with_libvirt="no"
1727 fi
1728 with_libvirt_ldflags="`pkg-config --libs libvirt`"
1729 if test $? -ne 0
1730 then
1731 with_libvirt="no"
1732 fi
1733 fi
1734 if test "x$with_libvirt" = "xyes"
1735 then
1736 SAVE_CPPFLAGS="$CPPFLAGS"
1737 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
1739 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
1740 [with_libvirt="no (libvirt/libvirt.h not found)"])
1742 CPPFLAGS="$SAVE_CPPFLAGS"
1743 fi
1744 if test "x$with_libvirt" = "xyes"
1745 then
1746 SAVE_CFLAGS="$CFLAGS"
1747 SAVE_LD_FLAGS="$LDFLAGS"
1749 CFLAGS="$CFLAGS $with_libvirt_cflags"
1750 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
1752 AC_CHECK_LIB(virt, virDomainBlockStats,
1753 [with_libvirt="yes"],
1754 [with_libvirt="no (symbol virDomainBlockStats not found)"])
1756 CFLAGS="$SAVE_CFLAGS"
1757 LDFLAGS="$SAVE_LDFLAGS"
1758 fi
1759 dnl Add the right compiler flags and libraries.
1760 if test "x$with_libvirt" = "xyes"; then
1761 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
1762 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
1763 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
1764 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
1765 fi
1767 dnl End of check for libvirt and libxml2 libraries.
1769 # Check for enabled/disabled features
1770 #
1772 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1773 # ------------------------------------------------------------
1774 dnl
1775 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1776 dnl
1777 AC_DEFUN(
1778 [AC_COLLECTD],
1779 [
1780 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1781 m4_if(
1782 [$2],
1783 [enable],
1784 [dnl
1785 m4_define([EnDis],[disabled])dnl
1786 m4_define([YesNo],[no])dnl
1787 ],dnl
1788 [m4_if(
1789 [$2],
1790 [disable],
1791 [dnl
1792 m4_define([EnDis],[enabled])dnl
1793 m4_define([YesNo],[yes])dnl
1794 ],
1795 [dnl
1796 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1797 ]dnl
1798 )]dnl
1799 )dnl
1800 m4_if([$3], [feature], [],
1801 [m4_if(
1802 [$3], [module], [],
1803 [dnl
1804 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1805 ]dnl
1806 )]dnl
1807 )dnl
1808 AC_ARG_ENABLE(
1809 [$1],
1810 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1811 [],
1812 enable_$1='[YesNo]'dnl
1813 )# AC_ARG_ENABLE
1814 if test "x$enable_$1" = "xno"
1815 then
1816 collectd_$1=0
1817 else
1818 if test "x$enable_$1" = "xyes"
1819 then
1820 collectd_$1=1
1821 else
1822 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1823 collectd_$1=1
1824 enable_$1='yes'
1825 fi
1826 fi
1827 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1828 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1829 ]dnl
1830 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1832 # AC_PLUGIN(name, default, info)
1833 # ------------------------------------------------------------
1834 dnl
1835 AC_DEFUN(
1836 [AC_PLUGIN],
1837 [
1838 enable_plugin="no"
1839 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1840 [
1841 if test "x$enableval" = "xyes"
1842 then
1843 enable_plugin="yes"
1844 else
1845 enable_plugin="no"
1846 fi
1847 ],
1848 [
1849 if test "x$2" = "xyes"
1850 then
1851 enable_plugin="yes"
1852 else
1853 enable_plugin="no"
1854 fi
1855 ])
1856 if test "x$enable_plugin" = "xyes"
1857 then
1858 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1859 fi
1860 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1861 enable_$1="$enable_plugin"
1862 ]
1863 )# AC_PLUGIN(name, default, info)
1865 m4_divert_once([HELP_ENABLE], [
1866 collectd features:])
1867 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1868 AC_COLLECTD([debug], [enable], [feature], [debugging])
1869 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1870 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1872 plugin_battery="no"
1873 plugin_cpu="no"
1874 plugin_cpufreq="no"
1875 plugin_df="no"
1876 plugin_disk="no"
1877 plugin_entropy="no"
1878 plugin_interface="no"
1879 plugin_ipvs="no"
1880 plugin_irq="no"
1881 plugin_libvirt="no"
1882 plugin_load="no"
1883 plugin_memory="no"
1884 plugin_multimeter="no"
1885 plugin_nfs="no"
1886 plugin_perl="no"
1887 plugin_processes="no"
1888 plugin_serial="no"
1889 plugin_swap="no"
1890 plugin_tape="no"
1891 plugin_tcpconns="no"
1892 plugin_users="no"
1893 plugin_vserver="no"
1894 plugin_wireless="no"
1896 # Linux
1897 if test "x$ac_system" = "xLinux"
1898 then
1899 plugin_battery="yes"
1900 plugin_cpu="yes"
1901 plugin_cpufreq="yes"
1902 plugin_disk="yes"
1903 plugin_entropy="yes"
1904 plugin_interface="yes"
1905 plugin_irq="yes"
1906 plugin_load="yes"
1907 plugin_memory="yes"
1908 plugin_nfs="yes"
1909 plugin_processes="yes"
1910 plugin_serial="yes"
1911 plugin_swap="yes"
1912 plugin_tcpconns="yes"
1913 plugin_vserver="yes"
1914 plugin_wireless="yes"
1916 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1917 then
1918 plugin_ipvs="yes"
1919 fi
1920 fi
1922 # Mac OS X devices
1923 if test "x$with_libiokit" = "xyes"
1924 then
1925 plugin_battery="yes"
1926 plugin_disk="yes"
1927 fi
1929 # Solaris
1930 if test "x$with_devinfo$with_kstat" = "xyesyes"
1931 then
1932 plugin_cpu="yes"
1933 plugin_disk="yes"
1934 plugin_interface="yes"
1935 plugin_memory="yes"
1936 plugin_swap="yes"
1937 plugin_tape="yes"
1938 fi
1940 # libstatgrab
1941 if test "x$with_libstatgrab" = "xyes"
1942 then
1943 plugin_interface="yes"
1944 plugin_load="yes"
1945 plugin_memory="yes"
1946 plugin_swap="yes"
1947 fi
1949 if test "x$have_processor_info" = "xyes"
1950 then
1951 plugin_cpu="yes"
1952 fi
1953 if test "x$have_sysctlbyname" = "xyes"
1954 then
1955 plugin_cpu="yes"
1956 plugin_memory="yes"
1957 plugin_tcpconns="yes"
1958 fi
1960 if test "x$have_statfs" = "xyes"
1961 then
1962 plugin_df="yes"
1963 fi
1964 if test "x$have_statvfs" = "xyes"
1965 then
1966 plugin_df="yes"
1967 fi
1969 if test "x$have_getifaddrs" = "xyes"
1970 then
1971 plugin_interface="yes"
1972 fi
1974 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
1975 then
1976 plugin_libvirt="yes"
1977 fi
1979 if test "x$have_getloadavg" = "xyes"
1980 then
1981 plugin_load="yes"
1982 fi
1984 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
1985 then
1986 plugin_perl="yes"
1987 fi
1989 # Mac OS X memory interface
1990 if test "x$have_host_statistics" = "xyes"
1991 then
1992 plugin_memory="yes"
1993 fi
1995 if test "x$have_termios_h" = "xyes"
1996 then
1997 plugin_multimeter="yes"
1998 fi
2000 if test "x$have_thread_info" = "xyes"
2001 then
2002 plugin_processes="yes"
2003 fi
2005 if test "x$with_libkvm" = "xyes"
2006 then
2007 plugin_swap="yes"
2008 fi
2010 if test "x$have_getutent" = "xyes"
2011 then
2012 plugin_users="yes"
2013 fi
2014 if test "x$have_getutxent" = "xyes"
2015 then
2016 plugin_users="yes"
2017 fi
2019 # FIXME: sysctl for swap plugin
2021 m4_divert_once([HELP_ENABLE], [
2022 collectd plugins:])
2024 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2025 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2026 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2027 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2028 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2029 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2030 AC_PLUGIN([csv], [yes], [CSV output plugin])
2031 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2032 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2033 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2034 AC_PLUGIN([email], [yes], [EMail statistics])
2035 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2036 AC_PLUGIN([exec], [yes], [Execution of external programs])
2037 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2038 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2039 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2040 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2041 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2042 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2043 AC_PLUGIN([load], [$plugin_load], [System load])
2044 AC_PLUGIN([logfile], [yes], [File logging plugin])
2045 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2046 AC_PLUGIN([memcached], [yes], [memcached statistics])
2047 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2048 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2049 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2050 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2051 AC_PLUGIN([network], [yes], [Network communication plugin])
2052 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2053 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2054 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2055 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2056 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2057 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2058 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2059 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2060 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2061 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2062 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2063 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2064 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2065 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2066 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2067 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2068 AC_PLUGIN([users], [$plugin_users], [User statistics])
2069 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2070 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2071 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2072 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2074 dnl ip_vs.h
2075 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2076 then
2077 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2078 fi
2080 dnl Perl bindings
2081 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2082 [
2083 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2084 then
2085 PERL_BINDINGS_OPTIONS="$withval"
2086 with_perl_bindings="yes"
2087 fi
2088 ],
2089 [
2090 PERL_BINDINGS_OPTIONS=""
2091 with_perl_bindings="yes"
2092 ])
2093 if test "x$with_perl_bindings" = "xyes"
2094 then
2095 PERL_BINDINGS="perl"
2096 else
2097 PERL_BINDINGS=""
2098 fi
2099 AC_SUBST(PERL_BINDINGS)
2100 AC_SUBST(PERL_BINDINGS_OPTIONS)
2102 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2104 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
2105 then
2106 with_liboping="yes (shipped version)"
2107 fi
2109 if test "x$with_libperl" = "xyes"
2110 then
2111 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2112 else
2113 enable_perl="no (needs libperl)"
2114 fi
2116 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
2117 then
2118 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2119 fi
2121 cat <<EOF;
2123 Configuration:
2124 Libraries:
2125 libcurl . . . . . . $with_libcurl
2126 libiokit . . . . . $with_libiokit
2127 libiptc . . . . . . $with_libiptc
2128 libkstat . . . . . $with_kstat
2129 libkvm . . . . . . $with_libkvm
2130 libmysql . . . . . $with_libmysql
2131 libnetlink . . . . $with_libnetlink
2132 libnetsnmp . . . . $with_libnetsnmp
2133 liboconfig . . . . $with_liboconfig
2134 liboping . . . . . $with_liboping
2135 libpcap . . . . . . $with_libpcap
2136 libperl . . . . . . $with_libperl
2137 libpthread . . . . $with_libpthread
2138 librrd . . . . . . $with_rrdtool
2139 libsensors . . . . $with_lm_sensors
2140 libstatgrab . . . . $with_libstatgrab
2141 libupsclient . . . $with_libupsclient
2142 libvirt . . . . . . $with_libvirt
2143 libxml2 . . . . . . $with_libxml2
2144 libxmms . . . . . . $with_libxmms
2146 Features:
2147 daemon mode . . . . $enable_daemon
2148 debug . . . . . . . $enable_debug
2150 Bindings:
2151 perl . . . . . . . $with_perl_bindings
2153 Modules:
2154 apache . . . . . . $enable_apache
2155 apcups . . . . . . $enable_apcups
2156 apple_sensors . . . $enable_apple_sensors
2157 battery . . . . . . $enable_battery
2158 cpu . . . . . . . . $enable_cpu
2159 cpufreq . . . . . . $enable_cpufreq
2160 csv . . . . . . . . $enable_csv
2161 df . . . . . . . . $enable_df
2162 disk . . . . . . . $enable_disk
2163 dns . . . . . . . . $enable_dns
2164 email . . . . . . . $enable_email
2165 entropy . . . . . . $enable_entropy
2166 exec . . . . . . . $enable_exec
2167 hddtemp . . . . . . $enable_hddtemp
2168 interface . . . . . $enable_interface
2169 iptables . . . . . $enable_iptables
2170 ipvs . . . . . . . $enable_ipvs
2171 irq . . . . . . . . $enable_irq
2172 libvirt . . . . . . $enable_libvirt
2173 load . . . . . . . $enable_load
2174 logfile . . . . . . $enable_logfile
2175 mbmon . . . . . . . $enable_mbmon
2176 memcached . . . . . $enable_memcached
2177 memory . . . . . . $enable_memory
2178 multimeter . . . . $enable_multimeter
2179 mysql . . . . . . . $enable_mysql
2180 netlink . . . . . . $enable_netlink
2181 network . . . . . . $enable_network
2182 nfs . . . . . . . . $enable_nfs
2183 nginx . . . . . . . $enable_nginx
2184 ntpd . . . . . . . $enable_ntpd
2185 nut . . . . . . . . $enable_nut
2186 perl . . . . . . . $enable_perl
2187 ping . . . . . . . $enable_ping
2188 processes . . . . . $enable_processes
2189 rrdtool . . . . . . $enable_rrdtool
2190 sensors . . . . . . $enable_sensors
2191 serial . . . . . . $enable_serial
2192 snmp . . . . . . . $enable_snmp
2193 swap . . . . . . . $enable_swap
2194 syslog . . . . . . $enable_syslog
2195 tape . . . . . . . $enable_tape
2196 tcpconns . . . . . $enable_tcpconns
2197 unixsock . . . . . $enable_unixsock
2198 users . . . . . . . $enable_users
2199 uuid . . . . . . . $enable_uuid
2200 vserver . . . . . . $enable_vserver
2201 wireless . . . . . $enable_wireless
2202 xmms . . . . . . . $enable_xmms
2204 EOF