1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 4.0.0-rc9)
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 #
11 # Checks for programs.
12 #
13 AC_PROG_CC
14 AC_PROG_CPP
15 AC_PROG_INSTALL
16 AC_PROG_LN_S
17 AC_PROG_MAKE_SET
18 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
20 dnl configure libtool
21 AC_DISABLE_STATIC
22 AC_LIBLTDL_CONVENIENCE
23 AC_SUBST(LTDLINCL)
24 AC_SUBST(LIBLTDL)
25 AC_LIBTOOL_DLOPEN
26 AC_PROG_LIBTOOL
27 AC_PROG_LEX
28 AC_PROG_YACC
29 AC_CONFIG_SUBDIRS(libltdl)
31 #
32 # Checks for header files.
33 #
34 AC_HEADER_STDC
35 AC_HEADER_SYS_WAIT
36 AC_HEADER_DIRENT
37 AC_CHECK_HEADERS(stdint.h)
38 AC_CHECK_HEADERS(stdio.h)
39 AC_CHECK_HEADERS(errno.h)
40 AC_CHECK_HEADERS(math.h)
41 AC_CHECK_HEADERS(syslog.h)
42 AC_CHECK_HEADERS(fcntl.h)
43 AC_CHECK_HEADERS(signal.h)
44 AC_CHECK_HEADERS(assert.h)
45 AC_CHECK_HEADERS(sys/types.h)
46 AC_CHECK_HEADERS(sys/socket.h)
47 AC_CHECK_HEADERS(sys/select.h)
48 AC_CHECK_HEADERS(poll.h)
49 AC_CHECK_HEADERS(netdb.h)
50 AC_CHECK_HEADERS(arpa/inet.h)
51 AC_CHECK_HEADERS(sys/resource.h)
52 AC_CHECK_HEADERS(sys/param.h)
53 AC_CHECK_HEADERS(kstat.h)
55 # For ping library
56 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
57 [#if HAVE_STDINT_H
58 # include <stdint.h>
59 #endif
60 #if HAVE_SYS_TYPES_H
61 # include <sys/types.h>
62 #endif
63 ])
64 AC_CHECK_HEADERS(netinet/in.h, [], [],
65 [#if HAVE_STDINT_H
66 # include <stdint.h>
67 #endif
68 #if HAVE_SYS_TYPES_H
69 # include <sys/types.h>
70 #endif
71 #if HAVE_NETINET_IN_SYSTM_H
72 # include <netinet/in_systm.h>
73 #endif
74 ])
75 AC_CHECK_HEADERS(netinet/ip.h, [], [],
76 [#if HAVE_STDINT_H
77 # include <stdint.h>
78 #endif
79 #if HAVE_SYS_TYPES_H
80 # include <sys/types.h>
81 #endif
82 #if HAVE_NETINET_IN_SYSTM_H
83 # include <netinet/in_systm.h>
84 #endif
85 #if HAVE_NETINET_IN_H
86 # include <netinet/in.h>
87 #endif
88 ])
89 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
90 [#if HAVE_STDINT_H
91 # include <stdint.h>
92 #endif
93 #if HAVE_SYS_TYPES_H
94 # include <sys/types.h>
95 #endif
96 #if HAVE_NETINET_IN_SYSTM_H
97 # include <netinet/in_systm.h>
98 #endif
99 #if HAVE_NETINET_IN_H
100 # include <netinet/in.h>
101 #endif
102 #if HAVE_NETINET_IP_H
103 # include <netinet/ip.h>
104 #endif
105 ])
106 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
107 [#if HAVE_STDINT_H
108 # include <stdint.h>
109 #endif
110 #if HAVE_SYS_TYPES_H
111 # include <sys/types.h>
112 #endif
113 #if HAVE_NETINET_IN_SYSTM_H
114 # include <netinet/in_systm.h>
115 #endif
116 #if HAVE_NETINET_IN_H
117 # include <netinet/in.h>
118 #endif
119 #if HAVE_NETINET_IP_H
120 # include <netinet/ip.h>
121 #endif
122 ])
123 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
124 [#if HAVE_STDINT_H
125 # include <stdint.h>
126 #endif
127 #if HAVE_SYS_TYPES_H
128 # include <sys/types.h>
129 #endif
130 #if HAVE_NETINET_IN_SYSTM_H
131 # include <netinet/in_systm.h>
132 #endif
133 #if HAVE_NETINET_IN_H
134 # include <netinet/in.h>
135 #endif
136 ])
137 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
138 [#if HAVE_STDINT_H
139 # include <stdint.h>
140 #endif
141 #if HAVE_SYS_TYPES_H
142 # include <sys/types.h>
143 #endif
144 #if HAVE_NETINET_IN_SYSTM_H
145 # include <netinet/in_systm.h>
146 #endif
147 #if HAVE_NETINET_IN_H
148 # include <netinet/in.h>
149 #endif
150 #if HAVE_NETINET_IP6_H
151 # include <netinet/ip6.h>
152 #endif
153 ])
154 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
155 [#if HAVE_STDINT_H
156 # include <stdint.h>
157 #endif
158 #if HAVE_SYS_TYPES_H
159 # include <sys/types.h>
160 #endif
161 #if HAVE_NETINET_IN_SYSTM_H
162 # include <netinet/in_systm.h>
163 #endif
164 #if HAVE_NETINET_IN_H
165 # include <netinet/in.h>
166 #endif
167 #if HAVE_NETINET_IP_H
168 # include <netinet/ip.h>
169 #endif
170 ])
171 AC_CHECK_HEADERS(netinet/udp.h, [], [],
172 [#if HAVE_STDINT_H
173 # include <stdint.h>
174 #endif
175 #if HAVE_SYS_TYPES_H
176 # include <sys/types.h>
177 #endif
178 #if HAVE_NETINET_IN_SYSTM_H
179 # include <netinet/in_systm.h>
180 #endif
181 #if HAVE_NETINET_IN_H
182 # include <netinet/in.h>
183 #endif
184 #if HAVE_NETINET_IP_H
185 # include <netinet/ip.h>
186 #endif
187 ])
189 # For cpu modules
190 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
191 AC_CHECK_HEADERS(mach/mach_init.h)
192 AC_CHECK_HEADERS(mach/host_priv.h)
193 AC_CHECK_HEADERS(mach/mach_error.h)
194 AC_CHECK_HEADERS(mach/mach_host.h)
195 AC_CHECK_HEADERS(mach/mach_port.h)
196 AC_CHECK_HEADERS(mach/mach_types.h)
197 AC_CHECK_HEADERS(mach/message.h)
198 AC_CHECK_HEADERS(mach/processor_set.h)
199 AC_CHECK_HEADERS(mach/processor.h)
200 AC_CHECK_HEADERS(mach/processor_info.h)
201 AC_CHECK_HEADERS(mach/task.h)
202 AC_CHECK_HEADERS(mach/thread_act.h)
203 AC_CHECK_HEADERS(mach/vm_region.h)
204 AC_CHECK_HEADERS(mach/vm_map.h)
205 AC_CHECK_HEADERS(mach/vm_prot.h)
206 AC_CHECK_HEADERS(mach/vm_statistics.h)
207 AC_CHECK_HEADERS(mach/kern_return.h)
209 # For hddtemp module
210 AC_CHECK_HEADERS(linux/major.h)
211 AC_CHECK_HEADERS(libgen.h)
213 # For the apple_sensors module
214 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
215 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
216 AC_CHECK_HEADERS(IOKit/IOTypes.h)
218 # For the battery plugin
219 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
220 [
221 #if HAVE_IOKIT_IOKITLIB_H
222 # include <IOKit/IOKitLib.h>
223 #endif
224 #if HAVE_IOKIT_IOTYPES_H
225 # include <IOKit/IOTypes.h>
226 #endif
227 ])
228 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
230 # For the `disk' plugin
231 AC_CHECK_HEADERS(IOKit/IOBSD.h)
232 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
234 # For load module
235 AC_CHECK_HEADERS(sys/loadavg.h)
237 # For the processes plugin
238 AC_CHECK_HEADERS(linux/config.h)
240 # For the swap module
241 AC_CHECK_HEADERS(sys/swap.h)
243 # For users module
244 AC_CHECK_HEADERS(utmp.h)
245 AC_CHECK_HEADERS(utmpx.h)
247 # For interface plugin
248 AC_CHECK_HEADERS(ifaddrs.h)
249 AC_CHECK_HEADERS(net/if.h, [], [],
250 [
251 #if HAVE_SYS_TYPES_H
252 # include <sys/types.h>
253 #endif
254 #if HAVE_SYS_SOCKET_H
255 # include <sys/socket.h>
256 #endif
257 ])
258 AC_CHECK_HEADERS(linux/if.h, [], [],
259 [
260 #if HAVE_SYS_TYPES_H
261 # include <sys/types.h>
262 #endif
263 #if HAVE_SYS_SOCKET_H
264 # include <sys/socket.h>
265 #endif
266 ])
267 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
268 [
269 #if HAVE_SYS_TYPES_H
270 # include <sys/types.h>
271 #endif
272 #if HAVE_SYS_SOCKET_H
273 # include <sys/socket.h>
274 #endif
275 #if HAVE_LINUX_IF_H
276 # include <linux/if.h>
277 #endif
278 ])
280 # For apache plugin
281 AC_CHECK_HEADERS(curl/curl.h)
283 # For quota module
284 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
285 AC_CHECK_HEADERS(ctype.h)
286 AC_CHECK_HEADERS(limits.h)
287 AC_CHECK_HEADERS(sys/quota.h)
288 AC_CHECK_HEADERS(xfs/xqm.h)
290 # For mount interface
291 AC_CHECK_HEADERS(fs_info.h)
292 AC_CHECK_HEADERS(fshelp.h)
293 AC_CHECK_HEADERS(paths.h)
294 AC_CHECK_HEADERS(mntent.h)
295 AC_CHECK_HEADERS(mnttab.h)
296 AC_CHECK_HEADERS(sys/fstyp.h)
297 AC_CHECK_HEADERS(sys/fs_types.h)
298 AC_CHECK_HEADERS(sys/mntent.h)
299 AC_CHECK_HEADERS(sys/mnttab.h)
300 AC_CHECK_HEADERS(sys/mount.h)
301 AC_CHECK_HEADERS(sys/statfs.h)
302 AC_CHECK_HEADERS(sys/statvfs.h)
303 AC_CHECK_HEADERS(sys/vfs.h)
304 AC_CHECK_HEADERS(sys/vfstab.h)
306 # For the swap plugin, FreeBSD
307 AC_CHECK_HEADERS(kvm.h)
309 # For the email plugin
310 AC_CHECK_HEADERS(linux/un.h, [], [],
311 [
312 #if HAVE_SYS_SOCKET_H
313 # include <sys/socket.h>
314 #endif
315 ])
316 AC_CHECK_HEADERS(sys/un.h)
317 AC_CHECK_HEADERS(grp.h)
319 # For debugging interface (variable number of arguments)
320 AC_CHECK_HEADERS(stdarg.h)
322 # Regular expressions for the ignorelist.
323 AC_CHECK_HEADERS(regex.h)
325 # For the dns plugin
326 AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
328 AC_CHECK_HEADERS(net/if_arp.h, [], [],
329 [#if HAVE_SYS_SOCKET_H
330 # include <sys/socket.h>
331 #endif
332 ])
333 AC_CHECK_HEADERS(net/if_ppp.h)
334 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
335 [#if HAVE_STDINT_H
336 # include <stdint.h>
337 #endif
338 #if HAVE_SYS_TYPES_H
339 # include <sys/types.h>
340 #endif
341 #if HAVE_SYS_SOCKET_H
342 # include <sys/socket.h>
343 #endif
344 #if HAVE_NET_IF_H
345 # include <net/if.h>
346 #endif
347 #if HAVE_NETINET_IN_H
348 # include <netinet/in.h>
349 #endif
350 ])
352 # For the multimeter plugin
353 AC_CHECK_HEADERS(termios.h)
354 AC_CHECK_HEADERS(sys/ioctl.h)
356 #
357 # Checking for libraries
358 #
359 AC_CHECK_LIB(m, ext)
361 #
362 # Checks for typedefs, structures, and compiler characteristics.
363 #
364 AC_C_CONST
365 AC_TYPE_PID_T
366 AC_TYPE_SIZE_T
367 AC_TYPE_UID_T
368 AC_HEADER_TIME
370 #
371 # Checks for library functions.
372 #
373 AC_PROG_GCC_TRADITIONAL
374 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
375 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
376 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
377 AC_CHECK_FUNCS(strncasecmp strcasecmp)
378 AC_CHECK_FUNCS(openlog syslog closelog)
380 socket_needs_socket="no"
381 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
382 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
384 nanosleep_needs_rt="no"
385 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
386 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
388 # Regular expressions for the ignorelist.
389 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
391 # For cpu module
392 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
394 # For df module
395 AC_CHECK_FUNCS(statfs statvfs)
397 # For load module
398 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
400 # For the `processes' plugin
401 AC_CHECK_FUNCS(thread_info)
403 # For users module
404 AC_CHECK_FUNCS(getutent getutxent)
406 # For quota module
407 AC_CHECK_FUNCS(quotactl)
408 AC_CHECK_FUNCS(getgrgid getpwuid)
410 # For interface module
411 AC_CHECK_FUNCS(getifaddrs)
413 # Check for NAN
414 nan_type="none"
415 if test "x$nan_type" = "xnone"; then
416 AC_CACHE_CHECK([whether NAN is defined by default],
417 [have_nan_default],
418 AC_COMPILE_IFELSE(
419 AC_LANG_PROGRAM(
420 [[
421 #include <stdlib.h>
422 #include <math.h>
423 static float foo = NAN;
424 ]],
425 [[
426 if (isnan (foo))
427 return 0;
428 else
429 return 1;
430 ]]),
431 [have_nan_default="yes"],
432 [have_nan_default="no"]
433 )
434 )
435 if test "x$have_nan_default" = "xyes"
436 then
437 nan_type="default"
438 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
439 [Define if NAN is defined by default and can initialize static variables.])
440 fi
441 fi
442 if test "x$nan_type" = "xnone"; then
443 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
444 [have_nan_isoc],
445 AC_COMPILE_IFELSE(
446 AC_LANG_PROGRAM(
447 [[
448 #include <stdlib.h>
449 #define __USE_ISOC99 1
450 #include <math.h>
451 static float foo = NAN;
452 ]],
453 [[
454 if (isnan (foo))
455 return 0;
456 else
457 return 1;
458 ]]),
459 [have_nan_isoc="yes"],
460 [have_nan_isoc="no"]
461 )
462 )
463 if test "x$have_nan_isoc" = "xyes"
464 then
465 nan_type="isoc99"
466 AC_DEFINE(NAN_STATIC_ISOC, 1,
467 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
468 fi
469 fi
470 if test "x$nan_type" = "xnone"; then
471 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
472 [have_nan_zero],
473 AC_RUN_IFELSE(
474 AC_LANG_PROGRAM(
475 [[
476 #include <stdlib.h>
477 #include <math.h>
478 #ifdef NAN
479 # undef NAN
480 #endif
481 #define NAN (0.0 / 0.0)
482 #ifndef isnan
483 # define isnan(f) ((f) != (f))
484 #endif
485 static float foo = NAN;
486 ]],
487 [[
488 if (isnan (foo))
489 return 0;
490 else
491 return 1;
492 ]]),
493 [have_nan_zero="yes"],
494 [have_nan_zero="no"]
495 )
496 )
497 if test "x$have_nan_zero" = "xyes"
498 then
499 nan_type="zero"
500 AC_DEFINE(NAN_ZERO_ZERO, 1,
501 [Define if NAN can be defined as (0.0 / 0.0)])
502 fi
503 fi
504 if test "x$nan_type" = "xnone"; then
505 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
506 fi
508 # For mount interface
509 #AC_CHECK_FUNCS(getfsent getvfsent)
511 have_getfsstat="no"
512 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
513 have_getvfsstat="no"
514 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
515 have_listmntent="no"
516 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
518 have_getmntent="no"
519 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
520 if test "x$have_getmntent" = "xno"; then
521 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
522 fi
523 if test "x$have_getmntent" = "xno"; then
524 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
525 fi
526 if test "x$have_getmntent" = "xno"; then
527 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
528 fi
530 if test "x$have_getmntent" = "xc"; then
531 AC_CACHE_CHECK([whether getmntent takes one argument],
532 [have_one_getmntent],
533 AC_COMPILE_IFELSE(
534 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
535 #include <mntent.h>
536 #include "$srcdir/src/utils_mount.h"]],
537 [[
538 FILE *fh;
539 struct mntent *me;
540 fh = setmntent ("/etc/mtab", "r");
541 me = getmntent (fh);
542 ]]
543 ),
544 [have_one_getmntent="yes"],
545 [have_one_getmntent="no"]
546 )
547 )
548 AC_CACHE_CHECK([whether getmntent takes two arguments],
549 [have_two_getmntent],
550 AC_COMPILE_IFELSE(
551 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
552 #include <sys/mnttab.h>
553 #include "$srcdir/src/utils_mount.h"]],
554 [[
555 FILE *fh;
556 struct mnttab mt;
557 int status;
558 fh = fopen ("/etc/mnttab", "r");
559 status = getmntent (fh, &mt);
560 ]]
561 ),
562 [have_two_getmntent="yes"],
563 [have_two_getmntent="no"]
564 )
565 )
566 fi
568 # Check for different versions of `getmntent' here..
570 if test "x$have_getmntent" = "xc"; then
571 if test "x$have_one_getmntent" = "xyes"; then
572 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
573 [Define if the function getmntent exists and takes one argument.])
574 fi
575 if test "x$have_two_getmntent" = "xyes"; then
576 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
577 [Define if the function getmntent exists and takes two arguments.])
578 fi
579 fi
580 if test "x$have_getmntent" = "xsun"; then
581 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
582 [Define if the function getmntent exists. It's the version from libsun.])
583 fi
584 if test "x$have_getmntent" = "xseq"; then
585 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
586 [Define if the function getmntent exists. It's the version from libseq.])
587 fi
588 if test "x$have_getmntent" = "xgen"; then
589 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
590 [Define if the function getmntent exists. It's the version from libgen.])
591 fi
593 # Check for structures
594 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
595 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
596 [],
597 [
598 #include <sys/types.h>
599 #include <sys/socket.h>
600 #include <net/if.h>
601 ])
602 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
603 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
604 [],
605 [
606 #include <sys/types.h>
607 #include <sys/socket.h>
608 #include <linux/if.h>
609 #include <linux/netdevice.h>
610 ])
612 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
613 [#if HAVE_STDINT_H
614 # include <stdint.h>
615 #endif
616 #if HAVE_SYS_TYPES_H
617 # include <sys/types.h>
618 #endif
619 #if HAVE_NETINET_IN_SYSTM_H
620 # include <netinet/in_systm.h>
621 #endif
622 #if HAVE_NETINET_IN_H
623 # include <netinet/in.h>
624 #endif
625 #if HAVE_NETINET_IP_H
626 # include <netinet/ip.h>
627 #endif
628 #if HAVE_NETINET_UDP_H
629 # include <netinet/udp.h>
630 #endif
631 ])
632 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
633 [#if HAVE_STDINT_H
634 # include <stdint.h>
635 #endif
636 #if HAVE_SYS_TYPES_H
637 # include <sys/types.h>
638 #endif
639 #if HAVE_NETINET_IN_SYSTM_H
640 # include <netinet/in_systm.h>
641 #endif
642 #if HAVE_NETINET_IN_H
643 # include <netinet/in.h>
644 #endif
645 #if HAVE_NETINET_IP_H
646 # include <netinet/ip.h>
647 #endif
648 #if HAVE_NETINET_UDP_H
649 # include <netinet/udp.h>
650 #endif
651 ])
653 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
654 [],
655 [],
656 [
657 #if HAVE_KSTAT_H
658 # include <kstat.h>
659 #endif
660 ])
662 AC_MSG_CHECKING([for kernel type ($host_os)])
663 case $host_os in
664 *linux*)
665 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
666 ac_system="Linux"
667 ;;
668 *solaris*)
669 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
670 ac_system="Solaris"
671 ;;
672 *)
673 ac_system="unknown"
674 esac
675 AC_MSG_RESULT([$ac_system])
677 with_libresolv="yes"
678 AC_CHECK_LIB(resolv, res_search,
679 [
680 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
681 ],
682 [with_libresolv="no"])
683 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
686 m4_divert_once([HELP_WITH], [
687 collectd additional packages:])
689 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
690 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
691 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
692 then
693 LDFLAGS="$LDFLAGS -L$withval/lib"
694 CPPFLAGS="$CPPFLAGS -I$withval/include"
695 with_rrdtool="yes"
696 fi
697 ], [with_rrdtool="yes"])
698 if test "x$with_rrdtool" = "xyes"
699 then
700 AC_CHECK_LIB(rrd, rrd_update,
701 [
702 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
703 ],
704 [with_rrdtool="no (librrd not found)"], [-lm])
705 fi
706 if test "x$with_rrdtool" = "xyes"
707 then
708 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
709 fi
710 if test "x$with_rrdtool" = "xyes"
711 then
712 collect_rrdtool=1
713 else
714 collect_rrdtool=0
715 fi
716 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
717 [Wether or not to use rrdtool library])
718 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
720 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
721 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
722 then
723 LDFLAGS="$LDFLAGS -L$withval/lib"
724 CPPFLAGS="$CPPFLAGS -I$withval/include"
725 with_libpthread="yes"
726 else
727 if test "x$withval" = "xno"
728 then
729 with_libpthread="no (disabled)"
730 fi
731 fi
732 ], [with_libpthread="yes"])
733 if test "x$with_libpthread" = "xyes"
734 then
735 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
736 fi
737 if test "x$with_libpthread" = "xyes"
738 then
739 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
740 fi
741 if test "x$with_libpthread" = "xyes"
742 then
743 collect_pthread=1
744 else
745 collect_pthread=0
746 fi
747 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
748 [Wether or not to use pthread (POSIX threads) library])
749 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
751 if test "$ac_system" = "Solaris"
752 then
753 with_kstat="yes"
754 with_devinfo="yes"
755 else
756 with_kstat="no (Solaris only)"
757 with_devinfo="no (Solaris only)"
758 fi
760 if test "x$with_kstat" = "xyes"
761 then
762 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
763 fi
764 if test "x$with_kstat" = "xyes"
765 then
766 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
767 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
768 fi
769 if test "x$with_kstat" = "xyes"
770 then
771 AC_DEFINE(HAVE_LIBKSTAT, 1,
772 [Define to 1 if you have the 'kstat' library (-lkstat)])
773 fi
774 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
775 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
777 ### BEGIN of check for libcurl ###
778 with_curl_config="curl-config"
779 with_curl_prefix=0
780 with_curl_libs=""
781 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
782 [
783 if test "x$withval" != "xno" -a "x$withval" != "xyes"
784 then
785 if test -x "$withval/bin/curl-config"
786 then
787 with_curl_config="$withval/bin/curl-config"
788 with_curl_prefix=1
789 fi
790 fi
791 if test "x$withval" = "xno"
792 then
793 with_libcurl="no"
794 else
795 with_libcurl="yes"
796 fi
797 ],
798 [
799 with_libcurl="yes"
800 ])
801 if test "x$with_libcurl" = "xyes"
802 then
803 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
804 curl_config_status=$?
806 if test $curl_config_status -ne 0
807 then
808 with_libcurl="no"
809 else
810 AC_CHECK_LIB(curl, curl_easy_init,
811 [
812 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
813 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
814 ],
815 [
816 with_libcurl="no"
817 ],
818 [$with_curl_libs])
819 fi
820 fi
821 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
822 then
823 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
824 curl_config_status=$?
826 if test $curl_config_status -ne 0
827 then
828 with_libcurl="no"
829 else
830 if test -d "$with_curl_prefix/include"
831 then
832 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
833 fi
834 fi
835 fi
837 with_libcurl_numeric=0
838 if test "x$with_libcurl" = "xyes"
839 then
840 with_libcurl_numeric=1
841 fi
842 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
843 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
844 ### END of check for libcurl ###
846 with_libiokit="no"
847 collectd_libiokit=0
848 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
849 [
850 with_libiokit="yes"
851 collectd_libiokit=1
852 ],
853 [
854 with_libiokit="no"
855 collectd_libiokit=0
856 ])
857 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
858 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
860 with_libstatgrab="yes"
861 with_libdevstat="no"
862 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
863 [
864 if test "x$withval" != "xno" -a "x$withval" != "xyes"
865 then
866 LDFLAGS="$LDFLAGS -L$withval/lib"
867 CPPFLAGS="$CPPFLAGS -I$withval/include"
868 with_libstatgrab="yes"
869 fi
870 ],
871 [
872 if test "x$ac_system" == "xunknown"
873 then
874 with_libstatgrab="yes"
875 else
876 with_libstatgrab="no"
877 fi
878 ])
879 if test "x$with_libstatgrab" = "xyes"
880 then
881 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
882 fi
883 if test "x$with_libstatgrab" = "xyes"
884 then
885 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
886 fi
887 if test "x$with_libstatgrab" = "xyes"
888 then
889 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
890 fi
891 if test "x$with_libstatgrab" = "xyes"
892 then
893 collect_libstatgrab=1
894 else
895 collect_libstatgrab=0
896 fi
897 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
898 [Wether or not to use statgrab library])
899 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
900 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
902 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
903 if test "x$with_libkvm" = "xyes"
904 then
905 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
906 fi
907 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
909 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
910 [
911 if test "x$withval" != "xno" && test "x$withval" != "xyes"
912 then
913 LDFLAGS="$LDFLAGS -L$withval/lib"
914 CPPFLAGS="$CPPFLAGS -I$withval/include"
915 with_lm_sensors="yes"
916 fi
917 ],
918 [
919 if test "x$ac_system" = "xLinux"
920 then
921 with_lm_sensors="yes"
922 else
923 with_lm_sensors="no"
924 fi
925 ])
926 if test "x$with_lm_sensors" = "xyes"
927 then
928 AC_CHECK_LIB(sensors, sensors_init,
929 [
930 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
931 ],
932 [with_lm_sensors="no (libsensors not found)"])
933 fi
934 if test "x$with_lm_sensors" = "xyes"
935 then
936 AC_CHECK_HEADERS(sensors/sensors.h,
937 [
938 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
939 ],
940 [with_lm_sensors="no (sensors/sensors.h not found)"])
941 fi
942 if test "x$with_lm_sensors" = "xyes"
943 then
944 collect_lm_sensors=1
945 else
946 collect_lm_sensors=0
947 fi
948 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
949 [Wether or not to use sensors library])
950 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
952 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
953 [
954 if test "x$withval" != "xno" && test "x$withval" != "xyes"
955 then
956 LDFLAGS="$LDFLAGS -L$withval/lib"
957 CPPFLAGS="$CPPFLAGS -I$withval/include"
958 with_libmysql="yes"
959 fi
960 ],
961 [
962 with_libmysql="yes"
963 ])
964 if test "x$with_libmysql" = "xyes"
965 then
966 AC_CHECK_LIB(mysqlclient, mysql_init,
967 [
968 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
969 ], [with_libmysql="no (libmysql not found)"])
970 fi
971 if test "x$with_libmysql" = "xyes"
972 then
973 AC_CHECK_HEADERS(mysql/mysql.h,
974 [
975 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
976 ], [with_libmysql="no (mysql/mysql.h not found)"])
977 fi
978 if test "x$with_libmysql" = "xyes"
979 then
980 collect_libmysql=1
981 else
982 collect_libmysql=0
983 fi
984 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
985 [Wether or not to use mysql library])
986 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
988 with_own_liboconfig="no"
989 liboconfig_LDFLAGS="$LDFLAGS"
990 liboconfig_CPPFLAGS="$CPPFLAGS"
991 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
992 [
993 if test "x$withval" != "xno" && test "x$withval" != "xyes"
994 then
995 if test -d "$withval/lib"
996 then
997 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
998 fi
999 if test -d "$withval/include"
1000 then
1001 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1002 fi
1003 fi
1004 if test "x$withval" = "xno"
1005 then
1006 AC_MSG_ERROR("liboconfig is required")
1007 fi
1008 ],
1009 [
1010 with_liboconfig="yes"
1011 ])
1013 save_LDFLAGS="$LDFLAGS"
1014 save_CPPFLAGS="$CPPFLAGS"
1015 LDFLAGS="$liboconfig_LDFLAGS"
1016 CPPFLAGS="$liboconfig_CPPFLAGS"
1017 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1018 [
1019 with_liboconfig="yes"
1020 with_own_liboconfig="no"
1021 ],
1022 [
1023 with_liboconfig="yes"
1024 with_own_liboconfig="yes"
1025 LDFLAGS="$save_LDFLAGS"
1026 CPPFLAGS="$save_CPPFLAGS"
1027 ])
1029 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1030 if test "x$with_own_liboconfig" = "xyes"
1031 then
1032 with_liboconfig="yes (shipped version)"
1033 fi
1035 #with_liboping="yes"
1036 with_own_liboping="no"
1037 liboping_LDFLAGS="$LDFLAGS"
1038 liboping_CPPFLAGS="$CPPFLAGS"
1039 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1040 [
1041 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1042 then
1043 if test -d "$withval/lib"
1044 then
1045 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1046 fi
1047 if test -d "$withval/include"
1048 then
1049 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1050 fi
1051 fi
1052 if test "x$withval" = "xno"
1053 then
1054 with_liboping="no"
1055 with_own_liboping="no"
1056 fi
1057 ],
1058 [
1059 #753
1060 with_liboping="yes"
1061 ])
1063 if test "x$with_liboping" = "xyes"
1064 then
1065 save_LDFLAGS="$LDFLAGS"
1066 save_CPPFLAGS="$CPPFLAGS"
1067 LDFLAGS="$liboping_LDFLAGS"
1068 CPPFLAGS="$liboping_CPPFLAGS"
1069 AC_CHECK_LIB(oping, ping_construct,
1070 [
1071 with_liboping="yes"
1072 with_own_liboping="no"
1073 ],
1074 [
1075 with_liboping="yes"
1076 with_own_liboping="yes"
1077 LDFLAGS="$save_LDFLAGS"
1078 CPPFLAGS="$save_CPPFLAGS"
1079 ])
1080 fi
1081 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1082 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1083 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1084 then
1085 with_liboping="yes (shipped version)"
1086 fi
1088 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1089 [
1090 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1091 then
1092 LDFLAGS="$LDFLAGS -L$withval/lib"
1093 CPPFLAGS="$CPPFLAGS -I$withval/include"
1094 with_libpcap="yes"
1095 fi
1096 ],
1097 [
1098 with_libpcap="yes"
1099 ])
1100 if test "x$with_libpcap" = "xyes"
1101 then
1102 AC_CHECK_LIB(pcap, pcap_open_live,
1103 [
1104 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1105 ], [with_libpcap="no (libpcap not found)"])
1106 fi
1107 if test "x$with_libpcap" = "xyes"
1108 then
1109 AC_CHECK_HEADERS(pcap.h,
1110 [
1111 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1112 ], [with_libpcap="no (pcap.h not found)"])
1113 fi
1114 if test "x$with_libpcap" = "xyes"
1115 then
1116 collect_libpcap=1
1117 else
1118 collect_libpcap=0
1119 fi
1120 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1121 [Wether or not to use the pcap library])
1122 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1124 perl_interpreter="perl"
1125 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1126 [
1127 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1128 then
1129 LDFLAGS="$LDFLAGS -L$withval/lib"
1130 CPPFLAGS="$CPPFLAGS -I$withval/include"
1131 perl_interpreter="$withval/bin/perl"
1132 with_libperl="yes"
1133 fi
1134 ],
1135 [
1136 with_libperl="yes"
1137 ])
1138 if test "x$with_libperl" = "xyes"
1139 then
1140 SAVE_CFLAGS=$CFLAGS
1141 SAVE_LDFLAGS=$LDFLAGS
1142 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1143 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1144 CFLAGS="$CFLAGS $PERL_CFLAGS"
1145 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1147 AC_CACHE_CHECK([for libperl],
1148 [have_libperl],
1149 AC_LINK_IFELSE(
1150 AC_LANG_PROGRAM(
1151 [[
1152 #include <EXTERN.h>
1153 #include <perl.h>
1154 #include <XSUB.h>
1155 ]],
1156 [[
1157 PerlInterpreter *perl = NULL;
1158 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1159 newSVpv ("Collectd::Plugin::FooBar", 24),
1160 Nullsv);
1161 ]]),
1162 [have_libperl="yes"],
1163 [have_libperl="no"]
1164 )
1165 )
1167 if test "x$have_libperl" = "xyes"
1168 then
1169 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1170 AC_SUBST(PERL_CFLAGS)
1171 AC_SUBST(PERL_LDFLAGS)
1172 else
1173 with_libperl="no"
1174 fi
1176 CFLAGS=$SAVE_CFLAGS
1177 LDFLAGS=$SAVE_LDFLAGS
1178 fi
1179 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1181 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1182 [
1183 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1184 then
1185 LDFLAGS="$LDFLAGS -L$withval/lib"
1186 CPPFLAGS="$CPPFLAGS -I$withval/include"
1187 with_libiptc="yes"
1188 fi
1189 ],
1190 [
1191 if test "x$ac_system" = "xLinux"
1192 then
1193 with_libiptc="yes"
1194 else
1195 with_libiptc="no (Linux only)"
1196 fi
1197 ])
1198 if test "x$with_libiptc" = "xyes"
1199 then
1200 AC_CHECK_LIB(iptc, iptc_init,
1201 [
1202 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1203 ], [with_libiptc="no (libiptc not found)"])
1204 fi
1205 if test "x$with_libiptc" = "xyes"
1206 then
1207 AC_CHECK_HEADERS(libiptc/libiptc.h,
1208 [
1209 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1210 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1211 fi
1212 if test "x$with_libiptc" = "xyes"
1213 then
1214 collect_libiptc=1
1215 else
1216 collect_libiptc=0
1217 fi
1218 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1220 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1221 [
1222 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1223 then
1224 LDFLAGS="$LDFLAGS -L$withval/lib"
1225 CPPFLAGS="$CPPFLAGS -I$withval/include"
1226 with_libupsclient="yes"
1227 fi
1228 ],
1229 [
1230 with_libupsclient="yes"
1231 ])
1232 if test "x$with_libupsclient" = "xyes"
1233 then
1234 AC_CHECK_LIB(upsclient, upscli_connect,
1235 [
1236 AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
1237 ], [with_libupsclient="no (libupsclient not found)"])
1238 fi
1239 if test "x$with_libupsclient" = "xyes"
1240 then
1241 AC_CHECK_HEADERS(upsclient.h,
1242 [
1243 AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the <upsclient.h> header file.])
1244 ], [with_libupsclient="no (upsclient.h not found)"])
1245 fi
1246 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1248 # Check for enabled/disabled features
1249 #
1251 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1252 # ------------------------------------------------------------
1253 dnl
1254 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1255 dnl
1256 AC_DEFUN(
1257 [AC_COLLECTD],
1258 [
1259 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1260 m4_if(
1261 [$2],
1262 [enable],
1263 [dnl
1264 m4_define([EnDis],[disabled])dnl
1265 m4_define([YesNo],[no])dnl
1266 ],dnl
1267 [m4_if(
1268 [$2],
1269 [disable],
1270 [dnl
1271 m4_define([EnDis],[enabled])dnl
1272 m4_define([YesNo],[yes])dnl
1273 ],
1274 [dnl
1275 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1276 ]dnl
1277 )]dnl
1278 )dnl
1279 m4_if([$3], [feature], [],
1280 [m4_if(
1281 [$3], [module], [],
1282 [dnl
1283 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1284 ]dnl
1285 )]dnl
1286 )dnl
1287 AC_ARG_ENABLE(
1288 [$1],
1289 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1290 [],
1291 enable_$1='[YesNo]'dnl
1292 )# AC_ARG_ENABLE
1293 if test "x$enable_$1" = "xno"
1294 then
1295 collectd_$1=0
1296 else
1297 if test "x$enable_$1" = "xyes"
1298 then
1299 collectd_$1=1
1300 else
1301 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1302 collectd_$1=1
1303 enable_$1='yes'
1304 fi
1305 fi
1306 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1307 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1308 ]dnl
1309 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1311 m4_divert_once([HELP_ENABLE], [
1312 collectd features:])
1313 AC_COLLECTD([debug], [enable], [feature], [debugging])
1314 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1315 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1317 m4_divert_once([HELP_ENABLE], [
1318 collectd modules:])
1319 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
1320 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
1321 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1322 AC_COLLECTD([battery], [disable], [module], [battery statistics])
1323 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
1324 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1325 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
1326 AC_COLLECTD([csv], [disable], [module], [csv output plugin])
1327 AC_COLLECTD([df], [disable], [module], [df statistics])
1328 AC_COLLECTD([dns], [disable], [module], [dns statistics])
1329 AC_COLLECTD([email], [disable], [module], [email statistics])
1330 AC_COLLECTD([entropy], [disable], [module], [entropy statistics])
1331 AC_COLLECTD([exec], [disable], [module], [exec of external programs])
1332 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
1333 AC_COLLECTD([interface], [disable], [module], [interface statistics])
1334 AC_COLLECTD([iptables], [disable], [module], [IPtables statistics])
1335 AC_COLLECTD([irq], [disable], [module], [irq statistics])
1336 AC_COLLECTD([load], [disable], [module], [system load statistics])
1337 AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
1338 AC_COLLECTD([memory], [disable], [module], [memory statistics])
1339 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1340 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
1341 AC_COLLECTD([network], [disable], [module], [network functionality])
1342 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
1343 AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
1344 AC_COLLECTD([nut], [disable], [module], [network UPS tools statistics])
1345 AC_COLLECTD([perl], [disable], [module], [embedded perl interpreter])
1346 AC_COLLECTD([ping], [disable], [module], [ping statistics])
1347 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1348 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1349 AC_COLLECTD([serial], [disable], [module], [serial statistics])
1350 AC_COLLECTD([logfile], [disable], [module], [logfile log facility])
1351 AC_COLLECTD([swap], [disable], [module], [swap statistics])
1352 AC_COLLECTD([syslog], [disable], [module], [syslog log facility])
1353 AC_COLLECTD([tape], [disable], [module], [tape statistics])
1354 AC_COLLECTD([unixsock], [disable], [module], [UNIX socket plugin])
1355 AC_COLLECTD([users], [disable], [module], [user count statistics])
1356 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
1357 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
1359 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
1361 if test "x$with_libperl" = "xyes"
1362 then
1363 with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)"
1364 else
1365 enable_perl="no (needs libperl)"
1366 fi
1368 cat <<EOF;
1370 Configuration:
1371 Libraries:
1372 libcurl . . . . . . $with_libcurl
1373 libiokit . . . . . $with_libiokit
1374 libiptc . . . . . . $with_libiptc
1375 libkstat . . . . . $with_kstat
1376 libmysql . . . . . $with_libmysql
1377 liboconfig . . . . $with_liboconfig
1378 liboping . . . . . $with_liboping
1379 libpcap . . . . . . $with_libpcap
1380 libperl . . . . . . $with_libperl
1381 libpthread . . . . $with_libpthread
1382 librrd . . . . . . $with_rrdtool
1383 libsensors . . . . $with_lm_sensors
1384 libstatgrab . . . . $with_libstatgrab
1385 libupsclient . . . $with_libupsclient
1387 Features:
1388 daemon mode . . . . $enable_daemon
1389 debug . . . . . . . $enable_debug
1391 Modules:
1392 apache . . . . . . $enable_apache
1393 apcups . . . . . . $enable_apcups
1394 apple_sensors . . . $enable_apple_sensors
1395 battery . . . . . . $enable_battery
1396 cpu . . . . . . . . $enable_cpu
1397 cpufreq . . . . . . $enable_cpufreq
1398 csv . . . . . . . . $enable_csv
1399 df . . . . . . . . $enable_df
1400 disk . . . . . . . $enable_disk
1401 dns . . . . . . . . $enable_dns
1402 email . . . . . . . $enable_email
1403 entropy . . . . . . $enable_entropy
1404 exec . . . . . . . $enable_exec
1405 hddtemp . . . . . . $enable_hddtemp
1406 interface . . . . . $enable_interface
1407 iptables . . . . . $enable_iptables
1408 irq . . . . . . . . $enable_irq
1409 load . . . . . . . $enable_load
1410 logfile . . . . . . $enable_logfile
1411 mbmon . . . . . . . $enable_mbmon
1412 memory . . . . . . $enable_memory
1413 multimeter . . . . $enable_multimeter
1414 mysql . . . . . . . $enable_mysql
1415 network . . . . . . $enable_network
1416 nfs . . . . . . . . $enable_nfs
1417 ntpd . . . . . . . $enable_ntpd
1418 nut . . . . . . . . $enable_nut
1419 perl . . . . . . . $enable_perl
1420 ping . . . . . . . $enable_ping
1421 processes . . . . . $enable_processes
1422 sensors . . . . . . $enable_sensors
1423 serial . . . . . . $enable_serial
1424 swap . . . . . . . $enable_swap
1425 syslog . . . . . . $enable_syslog
1426 tape . . . . . . . $enable_tape
1427 unixsock . . . . . $enable_unixsock
1428 users . . . . . . . $enable_users
1429 vserver . . . . . . $enable_vserver
1430 wireless . . . . . $enable_wireless
1432 EOF