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