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 else
702 with_rrdtool="$withval"
703 fi
704 ], [with_rrdtool="yes"])
705 if test "x$with_rrdtool" = "xyes"
706 then
707 SAVE_CPPFLAGS="$CPPFLAGS"
708 SAVE_LDFLAGS="$LDFLAGS"
710 CPPFLAGS="$CPPFLAGS $librrd_cflags"
711 LDFLAGS="$LDFLAGS $librrd_ldflags"
713 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
715 CPPFLAGS="$SAVE_CPPFLAGS"
716 LDFLAGS="$SAVE_LDFLAGS"
717 fi
718 if test "x$with_rrdtool" = "xyes"
719 then
720 SAVE_CPPFLAGS="$CPPFLAGS"
721 SAVE_LDFLAGS="$LDFLAGS"
723 CPPFLAGS="$CPPFLAGS $librrd_cflags"
724 LDFLAGS="$LDFLAGS $librrd_ldflags"
726 AC_CHECK_LIB(rrd_th, rrd_update_r,
727 [with_rrdtool="yes"
728 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
729 ],
730 [librrd_threadsafe="no"
731 AC_CHECK_LIB(rrd, rrd_update,
732 [with_rrdtool="yes"
733 librrd_ldflags="$librrd_ldflags -lrrd -lm"
734 ],
735 [with_rrdtool="no (symbol 'rrd_update' not found)"],
736 [-lm])
737 ]
738 [-lm])
740 CPPFLAGS="$SAVE_CPPFLAGS"
741 LDFLAGS="$SAVE_LDFLAGS"
742 fi
743 if test "x$with_rrdtool" = "xyes"
744 then
745 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
746 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
747 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
748 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
749 fi
750 if test "x$librrd_threadsafe" = "xyes"
751 then
752 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
753 fi
755 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
756 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
757 then
758 LDFLAGS="$LDFLAGS -L$withval/lib"
759 CPPFLAGS="$CPPFLAGS -I$withval/include"
760 with_libpthread="yes"
761 else
762 if test "x$withval" = "xno"
763 then
764 with_libpthread="no (disabled)"
765 fi
766 else
767 with_libpthread="$withval"
768 fi
769 ], [with_libpthread="yes"])
770 if test "x$with_libpthread" = "xyes"
771 then
772 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
773 fi
774 if test "x$with_libpthread" = "xyes"
775 then
776 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
777 fi
778 if test "x$with_libpthread" = "xyes"
779 then
780 collect_pthread=1
781 else
782 collect_pthread=0
783 fi
784 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
785 [Wether or not to use pthread (POSIX threads) library])
786 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
788 if test "x$ac_system" = "xSolaris"
789 then
790 with_kstat="yes"
791 with_devinfo="yes"
792 else
793 with_kstat="no (Solaris only)"
794 with_devinfo="no (Solaris only)"
795 fi
797 if test "x$with_kstat" = "xyes"
798 then
799 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
800 fi
801 if test "x$with_kstat" = "xyes"
802 then
803 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
804 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
805 fi
806 if test "x$with_kstat" = "xyes"
807 then
808 AC_DEFINE(HAVE_LIBKSTAT, 1,
809 [Define to 1 if you have the 'kstat' library (-lkstat)])
810 fi
811 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
812 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
814 ### BEGIN of check for libcurl ###
815 with_curl_config="curl-config"
816 with_curl_cflags=""
817 with_curl_libs=""
818 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
819 [
820 if test "x$withval" = "xno"
821 then
822 with_libcurl="no"
823 else if test "x$withval" = "xyes"
824 then
825 with_libcurl="yes"
826 else
827 if test -f "$withval" && test -x "$withval"
828 then
829 with_curl_config="$withval"
830 with_libcurl="yes"
831 else if test -x "$withval/bin/curl-config"
832 then
833 with_curl_config="$withval/bin/curl-config"
834 with_libcurl="yes"
835 fi; fi
836 with_libcurl="yes"
837 fi; fi
838 ],
839 [
840 with_libcurl="yes"
841 ])
842 if test "x$with_libcurl" = "xyes"
843 then
844 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
845 curl_config_status=$?
847 if test $curl_config_status -ne 0
848 then
849 with_libcurl="no ($with_curl_config failed)"
850 else
851 SAVE_CFLAGS=$CFLAGS
852 CFLAGS="$CFLAGS $with_curl_cflags"
854 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
856 CFLAGS="$SAVE_CFLAGS"
857 fi
858 fi
859 if test "x$with_libcurl" = "xyes"
860 then
861 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
862 curl_config_status=$?
864 if test $curl_config_status -ne 0
865 then
866 with_libcurl="no ($with_curl_config failed)"
867 else
868 AC_CHECK_LIB(curl, curl_easy_init,
869 [with_libcurl="yes"],
870 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
871 [$with_curl_libs])
872 fi
873 fi
874 if test "x$with_libcurl" = "xyes"
875 then
876 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
877 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
878 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
879 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
880 fi
881 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
882 ### END of check for libcurl ###
884 with_libiokit="no"
885 collectd_libiokit=0
886 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
887 [
888 with_libiokit="yes"
889 collectd_libiokit=1
890 ],
891 [
892 with_libiokit="no"
893 collectd_libiokit=0
894 ])
895 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
896 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
898 with_libstatgrab="yes"
899 with_libdevstat="no"
900 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
901 [
902 if test "x$withval" != "xno" -a "x$withval" != "xyes"
903 then
904 LDFLAGS="$LDFLAGS -L$withval/lib"
905 CPPFLAGS="$CPPFLAGS -I$withval/include"
906 with_libstatgrab="yes"
907 else
908 with_libstatgrab="$withval"
909 fi
910 ],
911 [
912 if test "x$ac_system" == "xunknown"
913 then
914 with_libstatgrab="yes"
915 else
916 with_libstatgrab="no"
917 fi
918 ])
919 if test "x$with_libstatgrab" = "xyes"
920 then
921 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
922 fi
923 if test "x$with_libstatgrab" = "xyes"
924 then
925 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
926 fi
927 if test "x$with_libstatgrab" = "xyes"
928 then
929 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
930 fi
931 if test "x$with_libstatgrab" = "xyes"
932 then
933 collect_libstatgrab=1
934 else
935 collect_libstatgrab=0
936 fi
937 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
938 [Wether or not to use statgrab library])
939 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
940 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
942 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
943 if test "x$with_libkvm" = "xyes"
944 then
945 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
946 fi
947 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
949 with_sensors_cflags=""
950 with_sensors_ldflags=""
951 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
952 [
953 if test "x$withval" = "xno"
954 then
955 with_lm_sensors="no"
956 else
957 with_lm_sensors="yes"
958 if test "x$withval" != "xyes"
959 then
960 with_sensors_cflags="-I$withval/include"
961 with_sensors_ldflags="-L$withval/lib"
962 with_lm_sensors="yes"
963 fi
964 fi
965 ],
966 [
967 if test "x$ac_system" = "xLinux"
968 then
969 with_lm_sensors="yes"
970 else
971 with_lm_sensors="no (Linux only library)"
972 fi
973 ])
974 if test "x$with_lm_sensors" = "xyes"
975 then
976 SAVE_CPPFLAGS="$CPPFLAGS"
977 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
979 # AC_CHECK_HEADERS(sensors/sensors.h,
980 # [
981 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
982 # ],
983 # [with_lm_sensors="no (sensors/sensors.h not found)"])
984 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
986 CPPFLAGS="$SAVE_CPPFLAGS"
987 fi
988 if test "x$with_lm_sensors" = "xyes"
989 then
990 SAVE_CPPFLAGS="$CPPFLAGS"
991 SAVE_LDFLAGS="$LDFLAGS"
992 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
993 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
995 AC_CHECK_LIB(sensors, sensors_init,
996 [
997 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
998 ],
999 [with_lm_sensors="no (libsensors not found)"])
1001 CPPFLAGS="$SAVE_CPPFLAGS"
1002 LDFLAGS="$SAVE_LDFLAGS"
1003 fi
1004 if test "x$with_lm_sensors" = "xyes"
1005 then
1006 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1007 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1008 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1009 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1010 fi
1011 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1013 with_mysql_config="mysql_config"
1014 with_mysql_cflags=""
1015 with_mysql_libs=""
1016 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1017 [
1018 if test "x$withval" = "xno"
1019 then
1020 with_libmysql="no"
1021 else if test "x$withval" = "xyes"
1022 then
1023 with_libmysql="yes"
1024 else
1025 if test -f "$withval" && test -x "$withval";
1026 then
1027 with_mysql_config="$withval"
1028 else if test -x "$withval/bin/mysql_config"
1029 then
1030 with_mysql_config="$withval/bin/mysql_config"
1031 fi; fi
1032 with_libmysql="yes"
1033 fi; fi
1034 ],
1035 [
1036 with_libmysql="yes"
1037 ])
1038 if test "x$with_libmysql" = "xyes"
1039 then
1040 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1041 mysql_config_status=$?
1043 if test $mysql_config_status -ne 0
1044 then
1045 with_libmysql="no"
1046 else
1047 SAVE_CFLAGS=$CFLAGS
1048 CFLAGS="$CFLAGS $with_mysql_cflags"
1050 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1052 CFLAGS="$SAVE_CFLAGS"
1053 fi
1054 fi
1055 if test "x$with_libmysql" = "xyes"
1056 then
1057 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1058 mysql_config_status=$?
1060 if test $mysql_config_status -ne 0
1061 then
1062 with_libmysql="no"
1063 else
1064 AC_CHECK_LIB(mysqlclient, mysql_init,
1065 [with_libmysql="yes"],
1066 [with_libmysql="no (symbol 'mysql_init' not found)"],
1067 [$with_mysql_libs])
1068 fi
1069 fi
1070 if test "x$with_libmysql" = "xyes"
1071 then
1072 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1073 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1074 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1075 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1076 fi
1077 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1079 with_own_liboconfig="no"
1080 liboconfig_LDFLAGS="$LDFLAGS"
1081 liboconfig_CPPFLAGS="$CPPFLAGS"
1082 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1083 [
1084 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1085 then
1086 if test -d "$withval/lib"
1087 then
1088 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1089 fi
1090 if test -d "$withval/include"
1091 then
1092 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1093 fi
1094 fi
1095 if test "x$withval" = "xno"
1096 then
1097 AC_MSG_ERROR("liboconfig is required")
1098 fi
1099 ],
1100 [
1101 with_liboconfig="yes"
1102 ])
1104 save_LDFLAGS="$LDFLAGS"
1105 save_CPPFLAGS="$CPPFLAGS"
1106 LDFLAGS="$liboconfig_LDFLAGS"
1107 CPPFLAGS="$liboconfig_CPPFLAGS"
1108 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1109 [
1110 with_liboconfig="yes"
1111 with_own_liboconfig="no"
1112 ],
1113 [
1114 with_liboconfig="yes"
1115 with_own_liboconfig="yes"
1116 LDFLAGS="$save_LDFLAGS"
1117 CPPFLAGS="$save_CPPFLAGS"
1118 ])
1120 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1121 if test "x$with_own_liboconfig" = "xyes"
1122 then
1123 with_liboconfig="yes (shipped version)"
1124 fi
1126 #with_liboping="yes"
1127 with_own_liboping="no"
1128 liboping_LDFLAGS="$LDFLAGS"
1129 liboping_CPPFLAGS="$CPPFLAGS"
1130 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1131 [
1132 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1133 then
1134 if test -d "$withval/lib"
1135 then
1136 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1137 fi
1138 if test -d "$withval/include"
1139 then
1140 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1141 fi
1142 fi
1143 if test "x$withval" = "xno"
1144 then
1145 with_liboping="no"
1146 with_own_liboping="no"
1147 else if test "x$withval" = "xyes"
1148 then
1149 with_liboping="yes"
1150 fi; fi
1151 ],
1152 [
1153 with_liboping="yes"
1154 ])
1156 if test "x$with_liboping" = "xyes"
1157 then
1158 save_LDFLAGS="$LDFLAGS"
1159 save_CPPFLAGS="$CPPFLAGS"
1160 LDFLAGS="$liboping_LDFLAGS"
1161 CPPFLAGS="$liboping_CPPFLAGS"
1162 AC_CHECK_LIB(oping, ping_construct,
1163 [
1164 with_liboping="yes"
1165 with_own_liboping="no"
1166 ],
1167 [
1168 with_liboping="yes"
1169 with_own_liboping="yes"
1170 LDFLAGS="$save_LDFLAGS"
1171 CPPFLAGS="$save_CPPFLAGS"
1172 ])
1173 fi
1174 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1175 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1177 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1178 [
1179 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1180 then
1181 LDFLAGS="$LDFLAGS -L$withval/lib"
1182 CPPFLAGS="$CPPFLAGS -I$withval/include"
1183 with_libpcap="yes"
1184 else
1185 with_libpcap="$withval"
1186 fi
1187 ],
1188 [
1189 with_libpcap="yes"
1190 ])
1191 if test "x$with_libpcap" = "xyes"
1192 then
1193 AC_CHECK_LIB(pcap, pcap_open_live,
1194 [
1195 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1196 ], [with_libpcap="no (libpcap not found)"])
1197 fi
1198 if test "x$with_libpcap" = "xyes"
1199 then
1200 AC_CHECK_HEADERS(pcap.h,
1201 [
1202 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1203 ], [with_libpcap="no (pcap.h not found)"])
1204 fi
1205 if test "x$with_libpcap" = "xyes"
1206 then
1207 collect_libpcap=1
1208 else
1209 collect_libpcap=0
1210 fi
1211 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1212 [Wether or not to use the pcap library])
1213 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1215 perl_interpreter="perl"
1216 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1217 [
1218 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1219 then
1220 LDFLAGS="$LDFLAGS -L$withval/lib"
1221 CPPFLAGS="$CPPFLAGS -I$withval/include"
1222 perl_interpreter="$withval/bin/perl"
1223 with_libperl="yes"
1224 else
1225 with_libperl="$withval"
1226 fi
1227 ],
1228 [
1229 with_libperl="yes"
1230 ])
1232 AC_SUBST(PERL, "$perl_interpreter")
1234 if test "x$with_libperl" = "xyes"
1235 then
1236 SAVE_CFLAGS=$CFLAGS
1237 SAVE_LDFLAGS=$LDFLAGS
1238 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1239 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1240 CFLAGS="$CFLAGS $PERL_CFLAGS"
1241 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1243 AC_CACHE_CHECK([for libperl],
1244 [have_libperl],
1245 AC_LINK_IFELSE(
1246 AC_LANG_PROGRAM(
1247 [[
1248 #include <EXTERN.h>
1249 #include <perl.h>
1250 #include <XSUB.h>
1251 ]],
1252 [[
1253 PerlInterpreter *perl = NULL;
1254 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1255 newSVpv ("Collectd::Plugin::FooBar", 24),
1256 Nullsv);
1257 ]]),
1258 [have_libperl="yes"],
1259 [have_libperl="no"]
1260 )
1261 )
1263 if test "x$have_libperl" = "xyes"
1264 then
1265 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1266 AC_SUBST(PERL_CFLAGS)
1267 AC_SUBST(PERL_LDFLAGS)
1268 else
1269 with_libperl="no"
1270 fi
1272 CFLAGS=$SAVE_CFLAGS
1273 LDFLAGS=$SAVE_LDFLAGS
1274 fi
1275 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1277 if test "x$with_libperl" = "xyes"
1278 then
1279 SAVE_CFLAGS=$CFLAGS
1280 SAVE_LDFLAGS=$LDFLAGS
1281 CFLAGS="$CFLAGS $PERL_CFLAGS"
1282 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1284 AC_CACHE_CHECK([if perl supports ithreads],
1285 [have_perl_ithreads],
1286 AC_LINK_IFELSE(
1287 AC_LANG_PROGRAM(
1288 [[
1289 #include <EXTERN.h>
1290 #include <perl.h>
1291 #include <XSUB.h>
1293 #if !defined(USE_ITHREADS)
1294 # error "Perl does not support ithreads!"
1295 #endif /* !defined(USE_ITHREADS) */
1296 ]],
1297 [[ ]]),
1298 [have_perl_ithreads="yes"],
1299 [have_perl_ithreads="no"]
1300 )
1301 )
1303 if test "x$have_perl_ithreads" = "xyes"
1304 then
1305 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1306 fi
1308 CFLAGS=$SAVE_CFLAGS
1309 LDFLAGS=$SAVE_LDFLAGS
1310 fi
1312 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1313 [
1314 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1315 then
1316 LDFLAGS="$LDFLAGS -L$withval/lib"
1317 CPPFLAGS="$CPPFLAGS -I$withval/include"
1318 with_libiptc="yes"
1319 else
1320 with_libiptc="$withval"
1321 fi
1322 ],
1323 [
1324 if test "x$ac_system" = "xLinux"
1325 then
1326 with_libiptc="yes"
1327 else
1328 with_libiptc="no (Linux only)"
1329 fi
1330 ])
1331 if test "x$with_libiptc" = "xyes"
1332 then
1333 AC_CHECK_LIB(iptc, iptc_init,
1334 [
1335 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1336 ], [with_libiptc="no (libiptc not found)"])
1337 fi
1338 if test "x$with_libiptc" = "xyes"
1339 then
1340 AC_CHECK_HEADERS(libiptc/libiptc.h,
1341 [
1342 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1343 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1344 fi
1345 if test "x$with_libiptc" = "xyes"
1346 then
1347 collect_libiptc=1
1348 else
1349 collect_libiptc=0
1350 fi
1351 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1353 with_snmp_config="net-snmp-config"
1354 with_snmp_cflags=""
1355 with_snmp_libs=""
1356 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1357 [
1358 if test "x$withval" = "xno"
1359 then
1360 with_libnetsnmp="no"
1361 else if test "x$withval" = "xyes"
1362 then
1363 with_libnetsnmp="yes"
1364 else
1365 if test -x "$withval"
1366 then
1367 with_snmp_config="$withval"
1368 with_libnetsnmp="yes"
1369 else
1370 with_snmp_config="$withval/bin/net-snmp-config"
1371 with_libnetsnmp="yes"
1372 fi
1373 fi; fi
1374 ],
1375 [with_libnetsnmp="yes"])
1376 if test "x$with_libnetsnmp" = "xyes"
1377 then
1378 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1379 snmp_config_status=$?
1381 if test $snmp_config_status -ne 0
1382 then
1383 with_libnetsnmp="no ($with_snmp_config failed)"
1384 else
1385 SAVE_CFLAGS=$CFLAGS
1386 CFLAGS="$CFLAGS $with_snmp_cflags"
1388 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1390 CFLAGS="$SAVE_CFLAGS"
1391 fi
1392 fi
1393 if test "x$with_libnetsnmp" = "xyes"
1394 then
1395 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1396 snmp_config_status=$?
1398 if test $snmp_config_status -ne 0
1399 then
1400 with_libnetsnmp="no ($with_snmp_config failed)"
1401 else
1402 AC_CHECK_LIB(netsnmp, init_snmp,
1403 [with_libnetsnmp="yes"],
1404 [with_libnetsnmp="no (libnetsnmp not found)"],
1405 [$with_snmp_libs])
1406 fi
1407 fi
1408 if test "x$with_libnetsnmp" = "xyes"
1409 then
1410 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1411 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1412 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1413 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1414 fi
1415 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1417 with_upsclient_config="libupsclient-config"
1418 with_upsclient_cflags=""
1419 with_upsclient_libs=""
1420 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1421 [
1422 if test "x$withval" = "xno"
1423 then
1424 with_libupsclient="no"
1425 else
1426 if test "x$withval" != "xyes"
1427 then
1428 if test -f "$withval" && test -x "$withval";
1429 then
1430 with_upsclient_config="$withval"
1431 else
1432 with_upsclient_config="$withval/bin/libupsclient-config"
1433 fi
1434 fi
1435 with_libupsclient="yes"
1436 fi
1437 ],
1438 [
1439 with_libupsclient="yes"
1440 ])
1441 if test "x$with_libupsclient" = "xyes"
1442 then
1443 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1444 upsclient_config_status=$?
1446 if test $upsclient_config_status -ne 0
1447 then
1448 with_libupsclient="no ($with_upsclient_config failed)"
1449 fi
1450 fi
1451 if test "x$with_libupsclient" = "xyes"
1452 then
1453 SAVE_CFLAGS="$CFLAGS"
1454 CFLAGS="$CFLAGS $with_upsclient_cflags"
1456 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1458 CFLAGS="$SAVE_CFLAGS"
1459 fi
1460 if test "x$with_libupsclient" = "xyes"
1461 then
1462 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1463 upsclient_config_status=$?
1465 if test $upsclient_config_status -ne 0
1466 then
1467 with_libupsclient="no ($with_upsclient_config failed)"
1468 fi
1469 fi
1470 if test "x$with_libupsclient" = "xyes"
1471 then
1472 AC_CHECK_LIB(upsclient, upscli_connect,
1473 [
1474 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1475 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1476 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1477 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1478 ],
1479 [
1480 with_libupsclient="no (symbol 'upscli_connect' not found)"
1481 ], [$with_upsclient_libs])
1482 fi
1483 if test "x$with_libupsclient" = "xyes"
1484 then
1485 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1486 [#include <stdlib.h>
1487 #include <stdio.h>
1488 #include <upsclient.h>])
1489 fi
1490 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1492 ### BEGIN of check for libxmms ###
1493 with_xmms_config="xmms-config"
1494 with_xmms_cflags=""
1495 with_xmms_libs=""
1496 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1497 [
1498 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1499 then
1500 if test -f "$withval" && test -x "$withval";
1501 then
1502 with_xmms_config="$withval"
1503 else if test -x "$withval/bin/xmms-config"
1504 then
1505 with_xmms_config="$withval/bin/xmms-config"
1506 fi; fi
1507 with_libxmms="yes"
1508 else if test "x$withval" = "xno"
1509 then
1510 with_libxmms="no"
1511 else
1512 with_libxmms="yes"
1513 fi; fi
1514 ],
1515 [
1516 with_libxmms="yes"
1517 ])
1518 if test "x$with_libxmms" = "xyes"
1519 then
1520 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1521 xmms_config_status=$?
1523 if test $xmms_config_status -ne 0
1524 then
1525 with_libxmms="no"
1526 fi
1527 fi
1528 if test "x$with_libxmms" = "xyes"
1529 then
1530 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1531 xmms_config_status=$?
1533 if test $xmms_config_status -ne 0
1534 then
1535 with_libxmms="no"
1536 fi
1537 fi
1538 if test "x$with_libxmms" = "xyes"
1539 then
1540 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1541 [
1542 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1543 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1544 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1545 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1546 ],
1547 [
1548 with_libxmms="no"
1549 ],
1550 [$with_xmms_libs])
1551 fi
1552 with_libxmms_numeric=0
1553 if test "x$with_libxmms" = "xyes"
1554 then
1555 with_libxmms_numeric=1
1556 fi
1557 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1558 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1559 ### END of check for libxmms ###
1561 with_libnetlink_cflags=""
1562 with_libnetlink_libs="-lnetlink"
1563 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1564 [
1565 echo "libnetlink: withval = $withval"
1566 if test "x$withval" = "xyes"
1567 then
1568 with_libnetlink="yes"
1569 else if test "x$withval" = "xno"
1570 then
1571 with_libnetlink="no"
1572 else
1573 if test -d "$withval/include"
1574 then
1575 with_libnetlink_cflags="-I$withval/include"
1576 with_libnetlink_libs="-L$withval/lib -lnetlink"
1577 with_libnetlink="yes"
1578 else
1579 AC_MSG_ERROR("no such directory: $withval/include")
1580 fi
1581 fi; fi
1582 ],
1583 [
1584 if test "x$ac_system" = "xLinux"
1585 then
1586 with_libnetlink="yes"
1587 else
1588 with_libnetlink="no (Linux only library)"
1589 fi
1590 ])
1591 if test "x$with_libnetlink" = "xyes"
1592 then
1593 SAVE_CFLAGS=$CFLAGS
1594 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1596 with_libnetlink="no (libnetlink.h not found)"
1598 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1599 [
1600 with_libnetlink="yes"
1601 break
1602 ], [],
1603 [#include <stdio.h>
1604 #include <sys/types.h>
1605 #include <asm/types.h>
1606 #include <sys/socket.h>
1607 #include <linux/netlink.h>
1608 #include <linux/rtnetlink.h>])
1609 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1610 [#include <stdio.h>
1611 #include <sys/types.h>
1612 #include <asm/types.h>
1613 #include <sys/socket.h>])
1615 AC_COMPILE_IFELSE(
1616 [#include <stdio.h>
1617 #include <sys/types.h>
1618 #include <asm/types.h>
1619 #include <sys/socket.h>
1620 #include <linux/netlink.h>
1621 #include <linux/rtnetlink.h>
1623 int main (void)
1624 {
1625 int retval = TCA_STATS2;
1626 return (retval);
1627 }],
1628 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1629 []);
1631 AC_COMPILE_IFELSE(
1632 [#include <stdio.h>
1633 #include <sys/types.h>
1634 #include <asm/types.h>
1635 #include <sys/socket.h>
1636 #include <linux/netlink.h>
1637 #include <linux/rtnetlink.h>
1639 int main (void)
1640 {
1641 int retval = TCA_STATS;
1642 return (retval);
1643 }],
1644 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1645 []);
1647 CFLAGS="$SAVE_CFLAGS"
1648 fi
1649 if test "x$with_libnetlink" = "xyes"
1650 then
1651 AC_CHECK_LIB(netlink, rtnl_open,
1652 [with_libnetlink="yes"],
1653 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1654 [$with_libnetlink_libs])
1655 fi
1656 if test "x$with_libnetlink" = "xyes"
1657 then
1658 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1659 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1660 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1661 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1662 fi
1663 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1665 dnl Check for libvirt and libxml2 libraries.
1666 with_libxml2="no (pkg-config isn't available)"
1667 with_libxml2_cflags=""
1668 with_libxml2_ldflags=""
1669 with_libvirt="no (pkg-config isn't available)"
1670 with_libvirt_cflags=""
1671 with_libvirt_ldflags=""
1672 PKG_PROG_PKG_CONFIG
1673 if test "x$PKG_CONFIG" != "x"
1674 then
1675 pkg-config --exists 'libxml-2.0' 2>/dev/null
1676 if test "$?" = "0"
1677 then
1678 with_libxml2="yes"
1679 else
1680 with_libxml2="no (pkg-config doesn't know library)"
1681 fi
1683 pkg-config --exists libvirt 2>/dev/null
1684 if test "$?" = "0"
1685 then
1686 with_libvirt="yes"
1687 else
1688 with_libvirt="no (pkg-config doesn't know library)"
1689 fi
1690 fi
1691 if test "x$with_libxml2" = "xyes"
1692 then
1693 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
1694 if test $? -ne 0
1695 then
1696 with_libxml2="no"
1697 fi
1698 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
1699 if test $? -ne 0
1700 then
1701 with_libxml2="no"
1702 fi
1703 fi
1704 if test "x$with_libxml2" = "xyes"
1705 then
1706 SAVE_CPPFLAGS="$CPPFLAGS"
1707 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
1709 AC_CHECK_HEADERS(libxml/parser.h, [],
1710 [with_libxml2="no (libxml/parser.h not found)"])
1712 CPPFLAGS="$SAVE_CPPFLAGS"
1713 fi
1714 if test "x$with_libxml2" = "xyes"
1715 then
1716 SAVE_CFLAGS="$CFLAGS"
1717 SAVE_LD_FLAGS="$LDFLAGS"
1719 CFLAGS="$CFLAGS $with_libxml2_cflags"
1720 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
1722 AC_CHECK_LIB(xml2, xmlXPathEval,
1723 [with_libxml2="yes"],
1724 [with_libxml2="no (symbol xmlXPathEval not found)"])
1726 CFLAGS="$SAVE_CFLAGS"
1727 LDFLAGS="$SAVE_LDFLAGS"
1728 fi
1729 dnl Add the right compiler flags and libraries.
1730 if test "x$with_libxml2" = "xyes"; then
1731 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
1732 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
1733 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
1734 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
1735 fi
1736 if test "x$with_libvirt" = "xyes"
1737 then
1738 with_libvirt_cflags="`pkg-config --cflags libvirt`"
1739 if test $? -ne 0
1740 then
1741 with_libvirt="no"
1742 fi
1743 with_libvirt_ldflags="`pkg-config --libs libvirt`"
1744 if test $? -ne 0
1745 then
1746 with_libvirt="no"
1747 fi
1748 fi
1749 if test "x$with_libvirt" = "xyes"
1750 then
1751 SAVE_CPPFLAGS="$CPPFLAGS"
1752 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
1754 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
1755 [with_libvirt="no (libvirt/libvirt.h not found)"])
1757 CPPFLAGS="$SAVE_CPPFLAGS"
1758 fi
1759 if test "x$with_libvirt" = "xyes"
1760 then
1761 SAVE_CFLAGS="$CFLAGS"
1762 SAVE_LD_FLAGS="$LDFLAGS"
1764 CFLAGS="$CFLAGS $with_libvirt_cflags"
1765 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
1767 AC_CHECK_LIB(virt, virDomainBlockStats,
1768 [with_libvirt="yes"],
1769 [with_libvirt="no (symbol virDomainBlockStats not found)"])
1771 CFLAGS="$SAVE_CFLAGS"
1772 LDFLAGS="$SAVE_LDFLAGS"
1773 fi
1774 dnl Add the right compiler flags and libraries.
1775 if test "x$with_libvirt" = "xyes"; then
1776 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
1777 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
1778 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
1779 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
1780 fi
1782 dnl End of check for libvirt and libxml2 libraries.
1784 # Check for enabled/disabled features
1785 #
1787 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1788 # ------------------------------------------------------------
1789 dnl
1790 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1791 dnl
1792 AC_DEFUN(
1793 [AC_COLLECTD],
1794 [
1795 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1796 m4_if(
1797 [$2],
1798 [enable],
1799 [dnl
1800 m4_define([EnDis],[disabled])dnl
1801 m4_define([YesNo],[no])dnl
1802 ],dnl
1803 [m4_if(
1804 [$2],
1805 [disable],
1806 [dnl
1807 m4_define([EnDis],[enabled])dnl
1808 m4_define([YesNo],[yes])dnl
1809 ],
1810 [dnl
1811 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1812 ]dnl
1813 )]dnl
1814 )dnl
1815 m4_if([$3], [feature], [],
1816 [m4_if(
1817 [$3], [module], [],
1818 [dnl
1819 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1820 ]dnl
1821 )]dnl
1822 )dnl
1823 AC_ARG_ENABLE(
1824 [$1],
1825 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1826 [],
1827 enable_$1='[YesNo]'dnl
1828 )# AC_ARG_ENABLE
1829 if test "x$enable_$1" = "xno"
1830 then
1831 collectd_$1=0
1832 else
1833 if test "x$enable_$1" = "xyes"
1834 then
1835 collectd_$1=1
1836 else
1837 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1838 collectd_$1=1
1839 enable_$1='yes'
1840 fi
1841 fi
1842 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1843 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1844 ]dnl
1845 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1847 # AC_PLUGIN(name, default, info)
1848 # ------------------------------------------------------------
1849 dnl
1850 AC_DEFUN(
1851 [AC_PLUGIN],
1852 [
1853 enable_plugin="no"
1854 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1855 [
1856 if test "x$enableval" = "xyes"
1857 then
1858 enable_plugin="yes"
1859 else
1860 enable_plugin="no"
1861 fi
1862 ],
1863 [
1864 if test "x$2" = "xyes"
1865 then
1866 enable_plugin="yes"
1867 else
1868 enable_plugin="no"
1869 fi
1870 ])
1871 if test "x$enable_plugin" = "xyes"
1872 then
1873 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1874 fi
1875 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1876 enable_$1="$enable_plugin"
1877 ]
1878 )# AC_PLUGIN(name, default, info)
1880 m4_divert_once([HELP_ENABLE], [
1881 collectd features:])
1882 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1883 AC_COLLECTD([debug], [enable], [feature], [debugging])
1884 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1885 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1887 plugin_battery="no"
1888 plugin_cpu="no"
1889 plugin_cpufreq="no"
1890 plugin_df="no"
1891 plugin_disk="no"
1892 plugin_entropy="no"
1893 plugin_interface="no"
1894 plugin_ipvs="no"
1895 plugin_irq="no"
1896 plugin_libvirt="no"
1897 plugin_load="no"
1898 plugin_memory="no"
1899 plugin_multimeter="no"
1900 plugin_nfs="no"
1901 plugin_perl="no"
1902 plugin_processes="no"
1903 plugin_serial="no"
1904 plugin_swap="no"
1905 plugin_tape="no"
1906 plugin_tcpconns="no"
1907 plugin_users="no"
1908 plugin_vserver="no"
1909 plugin_wireless="no"
1911 # Linux
1912 if test "x$ac_system" = "xLinux"
1913 then
1914 plugin_battery="yes"
1915 plugin_cpu="yes"
1916 plugin_cpufreq="yes"
1917 plugin_disk="yes"
1918 plugin_entropy="yes"
1919 plugin_interface="yes"
1920 plugin_irq="yes"
1921 plugin_load="yes"
1922 plugin_memory="yes"
1923 plugin_nfs="yes"
1924 plugin_processes="yes"
1925 plugin_serial="yes"
1926 plugin_swap="yes"
1927 plugin_tcpconns="yes"
1928 plugin_vserver="yes"
1929 plugin_wireless="yes"
1931 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1932 then
1933 plugin_ipvs="yes"
1934 fi
1935 fi
1937 # Mac OS X devices
1938 if test "x$with_libiokit" = "xyes"
1939 then
1940 plugin_battery="yes"
1941 plugin_disk="yes"
1942 fi
1944 # Solaris
1945 if test "x$with_devinfo$with_kstat" = "xyesyes"
1946 then
1947 plugin_cpu="yes"
1948 plugin_disk="yes"
1949 plugin_interface="yes"
1950 plugin_memory="yes"
1951 plugin_swap="yes"
1952 plugin_tape="yes"
1953 fi
1955 # libstatgrab
1956 if test "x$with_libstatgrab" = "xyes"
1957 then
1958 plugin_interface="yes"
1959 plugin_load="yes"
1960 plugin_memory="yes"
1961 plugin_swap="yes"
1962 fi
1964 if test "x$have_processor_info" = "xyes"
1965 then
1966 plugin_cpu="yes"
1967 fi
1968 if test "x$have_sysctlbyname" = "xyes"
1969 then
1970 plugin_cpu="yes"
1971 plugin_memory="yes"
1972 plugin_tcpconns="yes"
1973 fi
1975 if test "x$have_statfs" = "xyes"
1976 then
1977 plugin_df="yes"
1978 fi
1979 if test "x$have_statvfs" = "xyes"
1980 then
1981 plugin_df="yes"
1982 fi
1984 if test "x$have_getifaddrs" = "xyes"
1985 then
1986 plugin_interface="yes"
1987 fi
1989 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
1990 then
1991 plugin_libvirt="yes"
1992 fi
1994 if test "x$have_getloadavg" = "xyes"
1995 then
1996 plugin_load="yes"
1997 fi
1999 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
2000 then
2001 plugin_perl="yes"
2002 fi
2004 # Mac OS X memory interface
2005 if test "x$have_host_statistics" = "xyes"
2006 then
2007 plugin_memory="yes"
2008 fi
2010 if test "x$have_termios_h" = "xyes"
2011 then
2012 plugin_multimeter="yes"
2013 fi
2015 if test "x$have_thread_info" = "xyes"
2016 then
2017 plugin_processes="yes"
2018 fi
2020 if test "x$with_libkvm" = "xyes"
2021 then
2022 plugin_swap="yes"
2023 fi
2025 if test "x$have_getutent" = "xyes"
2026 then
2027 plugin_users="yes"
2028 fi
2029 if test "x$have_getutxent" = "xyes"
2030 then
2031 plugin_users="yes"
2032 fi
2034 # FIXME: sysctl for swap plugin
2036 m4_divert_once([HELP_ENABLE], [
2037 collectd plugins:])
2039 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2040 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2041 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2042 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2043 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2044 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2045 AC_PLUGIN([csv], [yes], [CSV output plugin])
2046 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2047 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2048 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2049 AC_PLUGIN([email], [yes], [EMail statistics])
2050 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2051 AC_PLUGIN([exec], [yes], [Execution of external programs])
2052 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2053 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2054 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2055 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2056 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2057 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2058 AC_PLUGIN([load], [$plugin_load], [System load])
2059 AC_PLUGIN([logfile], [yes], [File logging plugin])
2060 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2061 AC_PLUGIN([memcached], [yes], [memcached statistics])
2062 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2063 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2064 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2065 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2066 AC_PLUGIN([network], [yes], [Network communication plugin])
2067 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2068 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2069 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2070 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2071 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2072 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2073 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2074 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2075 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2076 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2077 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2078 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2079 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2080 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2081 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2082 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2083 AC_PLUGIN([users], [$plugin_users], [User statistics])
2084 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2085 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2086 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2087 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2089 dnl ip_vs.h
2090 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2091 then
2092 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2093 fi
2095 dnl Perl bindings
2096 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2097 [
2098 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2099 then
2100 PERL_BINDINGS_OPTIONS="$withval"
2101 with_perl_bindings="yes"
2102 else
2103 PERL_BINDINGS_OPTIONS=""
2104 with_perl_bindings="$withval"
2105 fi
2106 ],
2107 [
2108 PERL_BINDINGS_OPTIONS=""
2109 with_perl_bindings="yes"
2110 ])
2111 if test "x$with_perl_bindings" = "xyes"
2112 then
2113 PERL_BINDINGS="perl"
2114 else
2115 PERL_BINDINGS=""
2116 fi
2117 AC_SUBST(PERL_BINDINGS)
2118 AC_SUBST(PERL_BINDINGS_OPTIONS)
2120 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2122 if test "x$with_rrdtool" = "xyes" -a "x$librrd_threadsafe" != "xyes"
2123 then
2124 with_rrdtool="yes (warning: librrd is not thread-safe)"
2125 fi
2127 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
2128 then
2129 with_liboping="yes (shipped version)"
2130 fi
2132 if test "x$with_libperl" = "xyes"
2133 then
2134 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2135 else
2136 enable_perl="no (needs libperl)"
2137 fi
2139 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
2140 then
2141 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2142 fi
2144 cat <<EOF;
2146 Configuration:
2147 Libraries:
2148 libcurl . . . . . . $with_libcurl
2149 libiokit . . . . . $with_libiokit
2150 libiptc . . . . . . $with_libiptc
2151 libkstat . . . . . $with_kstat
2152 libkvm . . . . . . $with_libkvm
2153 libmysql . . . . . $with_libmysql
2154 libnetlink . . . . $with_libnetlink
2155 libnetsnmp . . . . $with_libnetsnmp
2156 liboconfig . . . . $with_liboconfig
2157 liboping . . . . . $with_liboping
2158 libpcap . . . . . . $with_libpcap
2159 libperl . . . . . . $with_libperl
2160 libpthread . . . . $with_libpthread
2161 librrd . . . . . . $with_rrdtool
2162 libsensors . . . . $with_lm_sensors
2163 libstatgrab . . . . $with_libstatgrab
2164 libupsclient . . . $with_libupsclient
2165 libvirt . . . . . . $with_libvirt
2166 libxml2 . . . . . . $with_libxml2
2167 libxmms . . . . . . $with_libxmms
2169 Features:
2170 daemon mode . . . . $enable_daemon
2171 debug . . . . . . . $enable_debug
2173 Bindings:
2174 perl . . . . . . . $with_perl_bindings
2176 Modules:
2177 apache . . . . . . $enable_apache
2178 apcups . . . . . . $enable_apcups
2179 apple_sensors . . . $enable_apple_sensors
2180 battery . . . . . . $enable_battery
2181 cpu . . . . . . . . $enable_cpu
2182 cpufreq . . . . . . $enable_cpufreq
2183 csv . . . . . . . . $enable_csv
2184 df . . . . . . . . $enable_df
2185 disk . . . . . . . $enable_disk
2186 dns . . . . . . . . $enable_dns
2187 email . . . . . . . $enable_email
2188 entropy . . . . . . $enable_entropy
2189 exec . . . . . . . $enable_exec
2190 hddtemp . . . . . . $enable_hddtemp
2191 interface . . . . . $enable_interface
2192 iptables . . . . . $enable_iptables
2193 ipvs . . . . . . . $enable_ipvs
2194 irq . . . . . . . . $enable_irq
2195 libvirt . . . . . . $enable_libvirt
2196 load . . . . . . . $enable_load
2197 logfile . . . . . . $enable_logfile
2198 mbmon . . . . . . . $enable_mbmon
2199 memcached . . . . . $enable_memcached
2200 memory . . . . . . $enable_memory
2201 multimeter . . . . $enable_multimeter
2202 mysql . . . . . . . $enable_mysql
2203 netlink . . . . . . $enable_netlink
2204 network . . . . . . $enable_network
2205 nfs . . . . . . . . $enable_nfs
2206 nginx . . . . . . . $enable_nginx
2207 ntpd . . . . . . . $enable_ntpd
2208 nut . . . . . . . . $enable_nut
2209 perl . . . . . . . $enable_perl
2210 ping . . . . . . . $enable_ping
2211 processes . . . . . $enable_processes
2212 rrdtool . . . . . . $enable_rrdtool
2213 sensors . . . . . . $enable_sensors
2214 serial . . . . . . $enable_serial
2215 snmp . . . . . . . $enable_snmp
2216 swap . . . . . . . $enable_swap
2217 syslog . . . . . . $enable_syslog
2218 tape . . . . . . . $enable_tape
2219 tcpconns . . . . . $enable_tcpconns
2220 unixsock . . . . . $enable_unixsock
2221 users . . . . . . . $enable_users
2222 uuid . . . . . . . $enable_uuid
2223 vserver . . . . . . $enable_vserver
2224 wireless . . . . . $enable_wireless
2225 xmms . . . . . . . $enable_xmms
2227 EOF