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