db344978d38a27dff2adecdc2f06f4c281176a16
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
6 AC_LANG(C)
8 AC_PREFIX_DEFAULT("/opt/collectd")
10 AC_SYS_LARGEFILE
12 #
13 # Checks for programs.
14 #
15 AC_PROG_CC
16 AC_PROG_CPP
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
19 AC_PROG_MAKE_SET
20 AM_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 AC_MSG_CHECKING([for kernel type ($host_os)])
34 case $host_os in
35 *linux*)
36 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
37 ac_system="Linux"
38 ;;
39 *solaris*)
40 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
41 ac_system="Solaris"
42 ;;
43 *darwin*)
44 ac_system="Darwin"
45 ;;
46 *)
47 ac_system="unknown"
48 esac
49 AC_MSG_RESULT([$ac_system])
51 #
52 # Checks for header files.
53 #
54 AC_HEADER_STDC
55 AC_HEADER_SYS_WAIT
56 AC_HEADER_DIRENT
58 AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h)
60 # For ping library
61 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
62 [#if HAVE_STDINT_H
63 # include <stdint.h>
64 #endif
65 #if HAVE_SYS_TYPES_H
66 # include <sys/types.h>
67 #endif
68 ])
69 AC_CHECK_HEADERS(netinet/in.h, [], [],
70 [#if HAVE_STDINT_H
71 # include <stdint.h>
72 #endif
73 #if HAVE_SYS_TYPES_H
74 # include <sys/types.h>
75 #endif
76 #if HAVE_NETINET_IN_SYSTM_H
77 # include <netinet/in_systm.h>
78 #endif
79 ])
80 AC_CHECK_HEADERS(netinet/ip.h, [], [],
81 [#if HAVE_STDINT_H
82 # include <stdint.h>
83 #endif
84 #if HAVE_SYS_TYPES_H
85 # include <sys/types.h>
86 #endif
87 #if HAVE_NETINET_IN_SYSTM_H
88 # include <netinet/in_systm.h>
89 #endif
90 #if HAVE_NETINET_IN_H
91 # include <netinet/in.h>
92 #endif
93 ])
94 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
95 [#if HAVE_STDINT_H
96 # include <stdint.h>
97 #endif
98 #if HAVE_SYS_TYPES_H
99 # include <sys/types.h>
100 #endif
101 #if HAVE_NETINET_IN_SYSTM_H
102 # include <netinet/in_systm.h>
103 #endif
104 #if HAVE_NETINET_IN_H
105 # include <netinet/in.h>
106 #endif
107 #if HAVE_NETINET_IP_H
108 # include <netinet/ip.h>
109 #endif
110 ])
111 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
112 [#if HAVE_STDINT_H
113 # include <stdint.h>
114 #endif
115 #if HAVE_SYS_TYPES_H
116 # include <sys/types.h>
117 #endif
118 #if HAVE_NETINET_IN_SYSTM_H
119 # include <netinet/in_systm.h>
120 #endif
121 #if HAVE_NETINET_IN_H
122 # include <netinet/in.h>
123 #endif
124 #if HAVE_NETINET_IP_H
125 # include <netinet/ip.h>
126 #endif
127 ])
128 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
129 [#if HAVE_STDINT_H
130 # include <stdint.h>
131 #endif
132 #if HAVE_SYS_TYPES_H
133 # include <sys/types.h>
134 #endif
135 #if HAVE_NETINET_IN_SYSTM_H
136 # include <netinet/in_systm.h>
137 #endif
138 #if HAVE_NETINET_IN_H
139 # include <netinet/in.h>
140 #endif
141 ])
142 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
143 [#if HAVE_STDINT_H
144 # include <stdint.h>
145 #endif
146 #if HAVE_SYS_TYPES_H
147 # include <sys/types.h>
148 #endif
149 #if HAVE_NETINET_IN_SYSTM_H
150 # include <netinet/in_systm.h>
151 #endif
152 #if HAVE_NETINET_IN_H
153 # include <netinet/in.h>
154 #endif
155 #if HAVE_NETINET_IP6_H
156 # include <netinet/ip6.h>
157 #endif
158 ])
159 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
160 [#if HAVE_STDINT_H
161 # include <stdint.h>
162 #endif
163 #if HAVE_SYS_TYPES_H
164 # include <sys/types.h>
165 #endif
166 #if HAVE_NETINET_IN_SYSTM_H
167 # include <netinet/in_systm.h>
168 #endif
169 #if HAVE_NETINET_IN_H
170 # include <netinet/in.h>
171 #endif
172 #if HAVE_NETINET_IP_H
173 # include <netinet/ip.h>
174 #endif
175 ])
176 AC_CHECK_HEADERS(netinet/udp.h, [], [],
177 [#if HAVE_STDINT_H
178 # include <stdint.h>
179 #endif
180 #if HAVE_SYS_TYPES_H
181 # include <sys/types.h>
182 #endif
183 #if HAVE_NETINET_IN_SYSTM_H
184 # include <netinet/in_systm.h>
185 #endif
186 #if HAVE_NETINET_IN_H
187 # include <netinet/in.h>
188 #endif
189 #if HAVE_NETINET_IP_H
190 # include <netinet/ip.h>
191 #endif
192 ])
194 # For cpu modules
195 AC_CHECK_HEADERS(sys/dkstat.h)
196 if test "x$ac_system" = "xDarwin"
197 then
198 AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h)
199 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
200 fi
201 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
202 [
203 #if HAVE_SYS_TYPES_H
204 # include <sys/types.h>
205 #endif
206 #if HAVE_SYS_PARAM_H
207 # include <sys/param.h>
208 #endif
209 ])
211 # For hddtemp module
212 AC_CHECK_HEADERS(linux/major.h libgen.h)
214 # For the battery plugin
215 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
216 [
217 #if HAVE_IOKIT_IOKITLIB_H
218 # include <IOKit/IOKitLib.h>
219 #endif
220 #if HAVE_IOKIT_IOTYPES_H
221 # include <IOKit/IOTypes.h>
222 #endif
223 ])
225 # For the swap module
226 AC_CHECK_HEADERS(sys/swap.h, [], [],
227 [
228 #if HAVE_SYS_TYPES_H
229 # include <sys/types.h>
230 #endif
231 #if HAVE_SYS_PARAM_H
232 # include <sys/param.h>
233 #endif
234 ])
236 # For load module
237 # For the processes plugin
238 # For users module
239 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
241 # For interface plugin
242 AC_CHECK_HEADERS(ifaddrs.h)
243 AC_CHECK_HEADERS(net/if.h, [], [],
244 [
245 #if HAVE_SYS_TYPES_H
246 # include <sys/types.h>
247 #endif
248 #if HAVE_SYS_SOCKET_H
249 # include <sys/socket.h>
250 #endif
251 ])
252 AC_CHECK_HEADERS(linux/if.h, [], [],
253 [
254 #if HAVE_SYS_TYPES_H
255 # include <sys/types.h>
256 #endif
257 #if HAVE_SYS_SOCKET_H
258 # include <sys/socket.h>
259 #endif
260 ])
261 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
262 [
263 #if HAVE_SYS_TYPES_H
264 # include <sys/types.h>
265 #endif
266 #if HAVE_SYS_SOCKET_H
267 # include <sys/socket.h>
268 #endif
269 #if HAVE_LINUX_IF_H
270 # include <linux/if.h>
271 #endif
272 ])
274 # For ipvs module
275 have_net_ip_vs_h="no"
276 have_ip_vs_h="no"
277 if test "x$ac_system" = "xLinux"
278 then
279 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
280 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
281 fi
283 # For quota module
284 AC_CHECK_HEADERS(sys/ucred.h, [], [],
285 [
286 #if HAVE_SYS_TYPES_H
287 # include <sys/types.h>
288 #endif
289 #if HAVE_SYS_PARAM_H
290 # include <sys/param.h>
291 #endif
292 ])
294 # For mount interface
295 AC_CHECK_HEADERS(sys/mount.h, [], [],
296 [
297 #if HAVE_SYS_TYPES_H
298 # include <sys/types.h>
299 #endif
300 #if HAVE_SYS_PARAM_H
301 # include <sys/param.h>
302 #endif
303 ])
305 # For the email plugin
306 AC_CHECK_HEADERS(linux/un.h, [], [],
307 [
308 #if HAVE_SYS_SOCKET_H
309 # include <sys/socket.h>
310 #endif
311 ])
313 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h sys/quota.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h)
315 # For the dns plugin
316 AC_CHECK_HEADERS(arpa/nameser.h)
317 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
318 [
319 #if HAVE_ARPA_NAMESER_H
320 # include <arpa/nameser.h>
321 #endif
322 ])
324 AC_CHECK_HEADERS(net/if_arp.h, [], [],
325 [#if HAVE_SYS_SOCKET_H
326 # include <sys/socket.h>
327 #endif
328 ])
329 AC_CHECK_HEADERS(net/ppp_defs.h)
330 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
331 [#if HAVE_NET_PPP_DEFS_H
332 # include <net/ppp_defs.h>
333 #endif
334 ])
335 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
336 [#if HAVE_STDINT_H
337 # include <stdint.h>
338 #endif
339 #if HAVE_SYS_TYPES_H
340 # include <sys/types.h>
341 #endif
342 #if HAVE_SYS_SOCKET_H
343 # include <sys/socket.h>
344 #endif
345 #if HAVE_NET_IF_H
346 # include <net/if.h>
347 #endif
348 #if HAVE_NETINET_IN_H
349 # include <netinet/in.h>
350 #endif
351 ])
353 # For the multimeter plugin
354 have_termios_h="no"
355 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
357 #
358 # Checks for typedefs, structures, and compiler characteristics.
359 #
360 AC_C_CONST
361 AC_TYPE_PID_T
362 AC_TYPE_SIZE_T
363 AC_TYPE_UID_T
364 AC_HEADER_TIME
366 #
367 # Checks for library functions.
368 #
369 AC_PROG_GCC_TRADITIONAL
370 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
372 AC_FUNC_STRERROR_R
374 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
376 socket_needs_socket="no"
377 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
378 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
380 nanosleep_needs_rt="no"
381 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
382 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
384 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
385 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
386 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
387 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
388 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
389 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
390 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
391 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
392 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
393 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
395 # For load module
396 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
398 # Check for NAN
399 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
400 [
401 if test "x$withval" = "xno"; then
402 nan_type="none"
403 else if test "x$withval" = "xyes"; then
404 nan_type="zero"
405 else
406 nan_type="$withval"
407 fi; fi
408 ],
409 [nan_type="none"])
410 if test "x$nan_type" = "xnone"; then
411 AC_CACHE_CHECK([whether NAN is defined by default],
412 [have_nan_default],
413 AC_COMPILE_IFELSE(
414 AC_LANG_PROGRAM(
415 [[
416 #include <stdlib.h>
417 #include <math.h>
418 static float foo = NAN;
419 ]],
420 [[
421 if (isnan (foo))
422 return 0;
423 else
424 return 1;
425 ]]),
426 [have_nan_default="yes"],
427 [have_nan_default="no"]
428 )
429 )
430 if test "x$have_nan_default" = "xyes"
431 then
432 nan_type="default"
433 fi
434 fi
435 if test "x$nan_type" = "xnone"; then
436 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
437 [have_nan_isoc],
438 AC_COMPILE_IFELSE(
439 AC_LANG_PROGRAM(
440 [[
441 #include <stdlib.h>
442 #define __USE_ISOC99 1
443 #include <math.h>
444 static float foo = NAN;
445 ]],
446 [[
447 if (isnan (foo))
448 return 0;
449 else
450 return 1;
451 ]]),
452 [have_nan_isoc="yes"],
453 [have_nan_isoc="no"]
454 )
455 )
456 if test "x$have_nan_isoc" = "xyes"
457 then
458 nan_type="isoc99"
459 fi
460 fi
461 if test "x$nan_type" = "xnone"; then
462 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
463 [have_nan_zero],
464 AC_RUN_IFELSE(
465 AC_LANG_PROGRAM(
466 [[
467 #include <stdlib.h>
468 #include <math.h>
469 #ifdef NAN
470 # undef NAN
471 #endif
472 #define NAN (0.0 / 0.0)
473 #ifndef isnan
474 # define isnan(f) ((f) != (f))
475 #endif
476 static float foo = NAN;
477 ]],
478 [[
479 if (isnan (foo))
480 return 0;
481 else
482 return 1;
483 ]]),
484 [have_nan_zero="yes"],
485 [have_nan_zero="no"]
486 )
487 )
488 if test "x$have_nan_zero" = "xyes"
489 then
490 nan_type="zero"
491 fi
492 fi
494 if test "x$nan_type" = "xdefault"; then
495 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
496 [Define if NAN is defined by default and can initialize static variables.])
497 else if test "x$nan_type" = "xisoc99"; then
498 AC_DEFINE(NAN_STATIC_ISOC, 1,
499 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
500 else if test "x$nan_type" = "xzero"; then
501 AC_DEFINE(NAN_ZERO_ZERO, 1,
502 [Define if NAN can be defined as (0.0 / 0.0)])
503 else
504 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
505 fi; fi; fi
507 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
508 [
509 if test "x$withval" = "xnothing"; then
510 fp_layout_type="nothing"
511 else if test "x$withval" = "xendianflip"; then
512 fp_layout_type="endianflip"
513 else if test "x$withval" = "xintswap"; then
514 fp_layout_type="intswap"
515 else
516 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
517 fi; fi; fi
518 ],
519 [fp_layout_type="unknown"])
521 if test "x$fp_layout_type" = "xunknown"; then
522 AC_CACHE_CHECK([if doubles are stored in x86 representation],
523 [fp_layout_need_nothing],
524 AC_RUN_IFELSE(
525 AC_LANG_PROGRAM(
526 [[[[
527 #include <stdlib.h>
528 #include <stdio.h>
529 #include <stdint.h>
530 #include <string.h>
531 ]]]],
532 [[[[
533 uint64_t i0;
534 uint64_t i1;
535 uint8_t c[8];
536 double d;
538 d = 8.642135e130;
539 memcpy ((void *) &i0, (void *) &d, 8);
541 i1 = i0;
542 memcpy ((void *) c, (void *) &i1, 8);
544 if ((c[0] == 0x2f) && (c[1] == 0x25)
545 && (c[2] == 0xc0) && (c[3] == 0xc7)
546 && (c[4] == 0x43) && (c[5] == 0x2b)
547 && (c[6] == 0x1f) && (c[7] == 0x5b))
548 return (0);
549 else
550 return (1);
551 ]]]]),
552 [fp_layout_need_nothing="yes"],
553 [fp_layout_need_nothing="no"]
554 )
555 )
556 if test "x$fp_layout_need_nothing" = "xyes"; then
557 fp_layout_type="nothing"
558 fi
559 fi
560 if test "x$fp_layout_type" = "xunknown"; then
561 AC_CACHE_CHECK([if endianflip converts to x86 representation],
562 [fp_layout_need_endianflip],
563 AC_RUN_IFELSE(
564 AC_LANG_PROGRAM(
565 [[[[
566 #include <stdlib.h>
567 #include <stdio.h>
568 #include <stdint.h>
569 #include <string.h>
570 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
571 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
572 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
573 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
574 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
575 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
576 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
577 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
578 ]]]],
579 [[[[
580 uint64_t i0;
581 uint64_t i1;
582 uint8_t c[8];
583 double d;
585 d = 8.642135e130;
586 memcpy ((void *) &i0, (void *) &d, 8);
588 i1 = endianflip (i0);
589 memcpy ((void *) c, (void *) &i1, 8);
591 if ((c[0] == 0x2f) && (c[1] == 0x25)
592 && (c[2] == 0xc0) && (c[3] == 0xc7)
593 && (c[4] == 0x43) && (c[5] == 0x2b)
594 && (c[6] == 0x1f) && (c[7] == 0x5b))
595 return (0);
596 else
597 return (1);
598 ]]]]),
599 [fp_layout_need_endianflip="yes"],
600 [fp_layout_need_endianflip="no"]
601 )
602 )
603 if test "x$fp_layout_need_endianflip" = "xyes"; then
604 fp_layout_type="endianflip"
605 fi
606 fi
607 if test "x$fp_layout_type" = "xunknown"; then
608 AC_CACHE_CHECK([if intswap converts to x86 representation],
609 [fp_layout_need_intswap],
610 AC_RUN_IFELSE(
611 AC_LANG_PROGRAM(
612 [[[[
613 #include <stdlib.h>
614 #include <stdio.h>
615 #include <stdint.h>
616 #include <string.h>
617 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
618 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
619 ]]]],
620 [[[[
621 uint64_t i0;
622 uint64_t i1;
623 uint8_t c[8];
624 double d;
626 d = 8.642135e130;
627 memcpy ((void *) &i0, (void *) &d, 8);
629 i1 = intswap (i0);
630 memcpy ((void *) c, (void *) &i1, 8);
632 if ((c[0] == 0x2f) && (c[1] == 0x25)
633 && (c[2] == 0xc0) && (c[3] == 0xc7)
634 && (c[4] == 0x43) && (c[5] == 0x2b)
635 && (c[6] == 0x1f) && (c[7] == 0x5b))
636 return (0);
637 else
638 return (1);
639 ]]]]),
640 [fp_layout_need_intswap="yes"],
641 [fp_layout_need_intswap="no"]
642 )
643 )
644 if test "x$fp_layout_need_intswap" = "xyes"; then
645 fp_layout_type="intswap"
646 fi
647 fi
649 if test "x$fp_layout_type" = "xnothing"; then
650 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
651 [Define if doubles are stored in x86 representation.])
652 else if test "x$fp_layout_type" = "xendianflip"; then
653 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
654 [Define if endianflip is needed to convert to x86 representation.])
655 else if test "x$fp_layout_type" = "xintswap"; then
656 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
657 [Define if intswap is needed to convert to x86 representation.])
658 else
659 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
660 fi; fi; fi
662 have_getfsstat="no"
663 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
664 have_getvfsstat="no"
665 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
666 have_listmntent="no"
667 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
669 have_getmntent="no"
670 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
671 if test "x$have_getmntent" = "xno"; then
672 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
673 fi
674 if test "x$have_getmntent" = "xno"; then
675 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
676 fi
677 if test "x$have_getmntent" = "xno"; then
678 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
679 fi
681 if test "x$have_getmntent" = "xc"; then
682 AC_CACHE_CHECK([whether getmntent takes one argument],
683 [have_one_getmntent],
684 AC_COMPILE_IFELSE(
685 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
686 #include <mntent.h>
687 #include "$srcdir/src/utils_mount.h"]],
688 [[
689 FILE *fh;
690 struct mntent *me;
691 fh = setmntent ("/etc/mtab", "r");
692 me = getmntent (fh);
693 ]]
694 ),
695 [have_one_getmntent="yes"],
696 [have_one_getmntent="no"]
697 )
698 )
699 AC_CACHE_CHECK([whether getmntent takes two arguments],
700 [have_two_getmntent],
701 AC_COMPILE_IFELSE(
702 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
703 #include <sys/mnttab.h>
704 #include "$srcdir/src/utils_mount.h"]],
705 [[
706 FILE *fh;
707 struct mnttab mt;
708 int status;
709 fh = fopen ("/etc/mnttab", "r");
710 status = getmntent (fh, &mt);
711 ]]
712 ),
713 [have_two_getmntent="yes"],
714 [have_two_getmntent="no"]
715 )
716 )
717 fi
719 # Check for different versions of `getmntent' here..
721 if test "x$have_getmntent" = "xc"; then
722 if test "x$have_one_getmntent" = "xyes"; then
723 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
724 [Define if the function getmntent exists and takes one argument.])
725 fi
726 if test "x$have_two_getmntent" = "xyes"; then
727 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
728 [Define if the function getmntent exists and takes two arguments.])
729 fi
730 fi
731 if test "x$have_getmntent" = "xsun"; then
732 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
733 [Define if the function getmntent exists. It's the version from libsun.])
734 fi
735 if test "x$have_getmntent" = "xseq"; then
736 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
737 [Define if the function getmntent exists. It's the version from libseq.])
738 fi
739 if test "x$have_getmntent" = "xgen"; then
740 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
741 [Define if the function getmntent exists. It's the version from libgen.])
742 fi
744 # Check for structures
745 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
746 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
747 [],
748 [
749 #include <sys/types.h>
750 #include <sys/socket.h>
751 #include <net/if.h>
752 ])
753 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
754 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
755 [],
756 [
757 #include <sys/types.h>
758 #include <sys/socket.h>
759 #include <linux/if.h>
760 #include <linux/netdevice.h>
761 ])
763 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
764 [#if HAVE_STDINT_H
765 # include <stdint.h>
766 #endif
767 #if HAVE_SYS_TYPES_H
768 # include <sys/types.h>
769 #endif
770 #if HAVE_NETINET_IN_SYSTM_H
771 # include <netinet/in_systm.h>
772 #endif
773 #if HAVE_NETINET_IN_H
774 # include <netinet/in.h>
775 #endif
776 #if HAVE_NETINET_IP_H
777 # include <netinet/ip.h>
778 #endif
779 #if HAVE_NETINET_UDP_H
780 # include <netinet/udp.h>
781 #endif
782 ])
783 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
784 [#if HAVE_STDINT_H
785 # include <stdint.h>
786 #endif
787 #if HAVE_SYS_TYPES_H
788 # include <sys/types.h>
789 #endif
790 #if HAVE_NETINET_IN_SYSTM_H
791 # include <netinet/in_systm.h>
792 #endif
793 #if HAVE_NETINET_IN_H
794 # include <netinet/in.h>
795 #endif
796 #if HAVE_NETINET_IP_H
797 # include <netinet/ip.h>
798 #endif
799 #if HAVE_NETINET_UDP_H
800 # include <netinet/udp.h>
801 #endif
802 ])
804 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
805 [],
806 [],
807 [
808 #if HAVE_KSTAT_H
809 # include <kstat.h>
810 #endif
811 ])
813 with_libresolv="yes"
814 AC_CHECK_LIB(resolv, res_search,
815 [
816 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
817 ],
818 [with_libresolv="no"])
819 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
822 m4_divert_once([HELP_WITH], [
823 collectd additional packages:])
825 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
826 librrd_cflags=""
827 librrd_ldflags=""
828 librrd_threadsafe="yes"
829 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
830 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
831 then
832 librrd_cflags="-I$withval/include"
833 librrd_ldflags="-L$withval/lib"
834 with_rrdtool="yes"
835 fi
836 ], [with_rrdtool="yes"])
837 if test "x$with_rrdtool" = "xyes"
838 then
839 SAVE_CPPFLAGS="$CPPFLAGS"
840 SAVE_LDFLAGS="$LDFLAGS"
842 CPPFLAGS="$CPPFLAGS $librrd_cflags"
843 LDFLAGS="$LDFLAGS $librrd_ldflags"
845 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
847 CPPFLAGS="$SAVE_CPPFLAGS"
848 LDFLAGS="$SAVE_LDFLAGS"
849 fi
850 if test "x$with_rrdtool" = "xyes"
851 then
852 SAVE_CPPFLAGS="$CPPFLAGS"
853 SAVE_LDFLAGS="$LDFLAGS"
855 CPPFLAGS="$CPPFLAGS $librrd_cflags"
856 LDFLAGS="$LDFLAGS $librrd_ldflags"
858 AC_CHECK_LIB(rrd_th, rrd_update_r,
859 [with_rrdtool="yes"
860 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
861 ],
862 [librrd_threadsafe="no"
863 AC_CHECK_LIB(rrd, rrd_update,
864 [with_rrdtool="yes"
865 librrd_ldflags="$librrd_ldflags -lrrd -lm"
866 ],
867 [with_rrdtool="no (symbol 'rrd_update' not found)"],
868 [-lm])
869 ],
870 [-lm])
872 CPPFLAGS="$SAVE_CPPFLAGS"
873 LDFLAGS="$SAVE_LDFLAGS"
874 fi
875 if test "x$with_rrdtool" = "xyes"
876 then
877 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
878 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
879 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
880 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
881 fi
882 if test "x$librrd_threadsafe" = "xyes"
883 then
884 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
885 fi
887 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
888 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
889 then
890 LDFLAGS="$LDFLAGS -L$withval/lib"
891 CPPFLAGS="$CPPFLAGS -I$withval/include"
892 with_libpthread="yes"
893 else
894 if test "x$withval" = "xno"
895 then
896 with_libpthread="no (disabled)"
897 fi
898 fi
899 ], [with_libpthread="yes"])
900 if test "x$with_libpthread" = "xyes"
901 then
902 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
903 fi
904 if test "x$with_libpthread" = "xyes"
905 then
906 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
907 fi
908 if test "x$with_libpthread" = "xyes"
909 then
910 collect_pthread=1
911 else
912 collect_pthread=0
913 fi
914 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
915 [Wether or not to use pthread (POSIX threads) library])
916 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
918 if test "x$ac_system" = "xSolaris"
919 then
920 with_kstat="yes"
921 with_devinfo="yes"
922 else
923 with_kstat="no (Solaris only)"
924 with_devinfo="no (Solaris only)"
925 fi
927 if test "x$with_kstat" = "xyes"
928 then
929 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
930 fi
931 if test "x$with_kstat" = "xyes"
932 then
933 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
934 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
935 fi
936 if test "x$with_kstat" = "xyes"
937 then
938 AC_DEFINE(HAVE_LIBKSTAT, 1,
939 [Define to 1 if you have the 'kstat' library (-lkstat)])
940 fi
941 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
942 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
944 ### BEGIN of check for libcurl ###
945 with_curl_config="curl-config"
946 with_curl_cflags=""
947 with_curl_libs=""
948 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
949 [
950 if test "x$withval" = "xno"
951 then
952 with_libcurl="no"
953 else if test "x$withval" = "xyes"
954 then
955 with_libcurl="yes"
956 else
957 if test -f "$withval" && test -x "$withval"
958 then
959 with_curl_config="$withval"
960 with_libcurl="yes"
961 else if test -x "$withval/bin/curl-config"
962 then
963 with_curl_config="$withval/bin/curl-config"
964 with_libcurl="yes"
965 fi; fi
966 with_libcurl="yes"
967 fi; fi
968 ],
969 [
970 with_libcurl="yes"
971 ])
972 if test "x$with_libcurl" = "xyes"
973 then
974 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
975 curl_config_status=$?
977 if test $curl_config_status -ne 0
978 then
979 with_libcurl="no ($with_curl_config failed)"
980 else
981 SAVE_CPPFLAGS="$CPPFLAGS"
982 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
984 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
986 CPPFLAGS="$SAVE_CPPFLAGS"
987 fi
988 fi
989 if test "x$with_libcurl" = "xyes"
990 then
991 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
992 curl_config_status=$?
994 if test $curl_config_status -ne 0
995 then
996 with_libcurl="no ($with_curl_config failed)"
997 else
998 AC_CHECK_LIB(curl, curl_easy_init,
999 [with_libcurl="yes"],
1000 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1001 [$with_curl_libs])
1002 fi
1003 fi
1004 if test "x$with_libcurl" = "xyes"
1005 then
1006 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1007 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1008 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1009 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1010 fi
1011 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1012 ### END of check for libcurl ###
1014 with_libiokit="no"
1015 collectd_libiokit=0
1016 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1017 [
1018 with_libiokit="yes"
1019 collectd_libiokit=1
1020 ],
1021 [
1022 with_libiokit="no"
1023 collectd_libiokit=0
1024 ])
1025 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
1026 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1028 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1029 [
1030 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1031 then
1032 LDFLAGS="$LDFLAGS -L$withval/lib"
1033 CPPFLAGS="$CPPFLAGS -I$withval/include"
1034 with_libstatgrab="yes"
1035 fi
1036 ],
1037 [
1038 if test "x$ac_system" == "xunknown"
1039 then
1040 with_libstatgrab="yes"
1041 else
1042 with_libstatgrab="no"
1043 fi
1044 ])
1045 if test "x$with_libstatgrab" = "xyes"
1046 then
1047 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
1048 fi
1049 if test "x$with_libstatgrab" = "xyes"
1050 then
1051 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
1052 fi
1053 if test "x$with_libstatgrab" = "xyes"
1054 then
1055 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
1056 fi
1057 if test "x$with_libstatgrab" = "xyes"
1058 then
1059 collect_libstatgrab=1
1060 else
1061 collect_libstatgrab=0
1062 fi
1063 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
1064 [Wether or not to use statgrab library])
1065 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1066 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
1068 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
1069 if test "x$with_libkvm" = "xyes"
1070 then
1071 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
1072 fi
1073 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
1075 with_sensors_cflags=""
1076 with_sensors_ldflags=""
1077 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1078 [
1079 if test "x$withval" = "xno"
1080 then
1081 with_lm_sensors="no"
1082 else
1083 with_lm_sensors="yes"
1084 if test "x$withval" != "xyes"
1085 then
1086 with_sensors_cflags="-I$withval/include"
1087 with_sensors_ldflags="-L$withval/lib"
1088 with_lm_sensors="yes"
1089 fi
1090 fi
1091 ],
1092 [
1093 if test "x$ac_system" = "xLinux"
1094 then
1095 with_lm_sensors="yes"
1096 else
1097 with_lm_sensors="no (Linux only library)"
1098 fi
1099 ])
1100 if test "x$with_lm_sensors" = "xyes"
1101 then
1102 SAVE_CPPFLAGS="$CPPFLAGS"
1103 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1105 # AC_CHECK_HEADERS(sensors/sensors.h,
1106 # [
1107 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1108 # ],
1109 # [with_lm_sensors="no (sensors/sensors.h not found)"])
1110 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1112 CPPFLAGS="$SAVE_CPPFLAGS"
1113 fi
1114 if test "x$with_lm_sensors" = "xyes"
1115 then
1116 SAVE_CPPFLAGS="$CPPFLAGS"
1117 SAVE_LDFLAGS="$LDFLAGS"
1118 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1119 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1121 AC_CHECK_LIB(sensors, sensors_init,
1122 [
1123 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1124 ],
1125 [with_lm_sensors="no (libsensors not found)"])
1127 CPPFLAGS="$SAVE_CPPFLAGS"
1128 LDFLAGS="$SAVE_LDFLAGS"
1129 fi
1130 if test "x$with_lm_sensors" = "xyes"
1131 then
1132 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1133 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1134 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1135 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1136 fi
1137 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1139 with_mysql_config="mysql_config"
1140 with_mysql_cflags=""
1141 with_mysql_libs=""
1142 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1143 [
1144 if test "x$withval" = "xno"
1145 then
1146 with_libmysql="no"
1147 else if test "x$withval" = "xyes"
1148 then
1149 with_libmysql="yes"
1150 else
1151 if test -f "$withval" && test -x "$withval";
1152 then
1153 with_mysql_config="$withval"
1154 else if test -x "$withval/bin/mysql_config"
1155 then
1156 with_mysql_config="$withval/bin/mysql_config"
1157 fi; fi
1158 with_libmysql="yes"
1159 fi; fi
1160 ],
1161 [
1162 with_libmysql="yes"
1163 ])
1164 if test "x$with_libmysql" = "xyes"
1165 then
1166 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1167 mysql_config_status=$?
1169 if test $mysql_config_status -ne 0
1170 then
1171 with_libmysql="no"
1172 else
1173 SAVE_CPPFLAGS="$CPPFLAGS"
1174 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1176 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1178 CPPFLAGS="$SAVE_CPPFLAGS"
1179 fi
1180 fi
1181 if test "x$with_libmysql" = "xyes"
1182 then
1183 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1184 mysql_config_status=$?
1186 if test $mysql_config_status -ne 0
1187 then
1188 with_libmysql="no"
1189 else
1190 AC_CHECK_LIB(mysqlclient, mysql_init,
1191 [with_libmysql="yes"],
1192 [with_libmysql="no (symbol 'mysql_init' not found)"],
1193 [$with_mysql_libs])
1194 fi
1195 fi
1196 if test "x$with_libmysql" = "xyes"
1197 then
1198 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1199 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1200 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1201 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1202 fi
1203 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1205 with_own_liboconfig="no"
1206 liboconfig_LDFLAGS="$LDFLAGS"
1207 liboconfig_CPPFLAGS="$CPPFLAGS"
1208 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1209 [
1210 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1211 then
1212 if test -d "$withval/lib"
1213 then
1214 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1215 fi
1216 if test -d "$withval/include"
1217 then
1218 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1219 fi
1220 fi
1221 if test "x$withval" = "xno"
1222 then
1223 AC_MSG_ERROR("liboconfig is required")
1224 fi
1225 ],
1226 [
1227 with_liboconfig="yes"
1228 ])
1230 save_LDFLAGS="$LDFLAGS"
1231 save_CPPFLAGS="$CPPFLAGS"
1232 LDFLAGS="$liboconfig_LDFLAGS"
1233 CPPFLAGS="$liboconfig_CPPFLAGS"
1234 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1235 [
1236 with_liboconfig="yes"
1237 with_own_liboconfig="no"
1238 ],
1239 [
1240 with_liboconfig="yes"
1241 with_own_liboconfig="yes"
1242 LDFLAGS="$save_LDFLAGS"
1243 CPPFLAGS="$save_CPPFLAGS"
1244 ])
1246 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1247 if test "x$with_own_liboconfig" = "xyes"
1248 then
1249 with_liboconfig="yes (shipped version)"
1250 fi
1252 #with_liboping="yes"
1253 with_own_liboping="no"
1254 liboping_LDFLAGS="$LDFLAGS"
1255 liboping_CPPFLAGS="$CPPFLAGS"
1256 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1257 [
1258 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1259 then
1260 if test -d "$withval/lib"
1261 then
1262 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1263 fi
1264 if test -d "$withval/include"
1265 then
1266 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1267 fi
1268 fi
1269 if test "x$withval" = "xno"
1270 then
1271 with_liboping="no"
1272 with_own_liboping="no"
1273 fi
1274 ],
1275 [
1276 #753
1277 with_liboping="yes"
1278 ])
1280 if test "x$with_liboping" = "xyes"
1281 then
1282 save_LDFLAGS="$LDFLAGS"
1283 save_CPPFLAGS="$CPPFLAGS"
1284 LDFLAGS="$liboping_LDFLAGS"
1285 CPPFLAGS="$liboping_CPPFLAGS"
1286 AC_CHECK_LIB(oping, ping_construct,
1287 [
1288 with_liboping="yes"
1289 with_own_liboping="no"
1290 ],
1291 [
1292 with_liboping="yes"
1293 with_own_liboping="yes"
1294 LDFLAGS="$save_LDFLAGS"
1295 CPPFLAGS="$save_CPPFLAGS"
1296 ])
1297 fi
1298 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1299 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1301 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1302 [
1303 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1304 then
1305 LDFLAGS="$LDFLAGS -L$withval/lib"
1306 CPPFLAGS="$CPPFLAGS -I$withval/include"
1307 with_libpcap="yes"
1308 fi
1309 ],
1310 [
1311 with_libpcap="yes"
1312 ])
1313 if test "x$with_libpcap" = "xyes"
1314 then
1315 AC_CHECK_LIB(pcap, pcap_open_live,
1316 [
1317 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1318 ], [with_libpcap="no (libpcap not found)"])
1319 fi
1320 if test "x$with_libpcap" = "xyes"
1321 then
1322 AC_CHECK_HEADERS(pcap.h,
1323 [
1324 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1325 ], [with_libpcap="no (pcap.h not found)"])
1326 fi
1327 if test "x$with_libpcap" = "xyes"
1328 then
1329 collect_libpcap=1
1330 else
1331 collect_libpcap=0
1332 fi
1333 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1334 [Wether or not to use the pcap library])
1335 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1337 perl_interpreter="perl"
1338 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1339 [
1340 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1341 then
1342 LDFLAGS="$LDFLAGS -L$withval/lib"
1343 CPPFLAGS="$CPPFLAGS -I$withval/include"
1344 perl_interpreter="$withval/bin/perl"
1345 with_libperl="yes"
1346 fi
1347 ],
1348 [
1349 with_libperl="yes"
1350 ])
1352 AC_SUBST(PERL, "$perl_interpreter")
1354 if test "x$with_libperl" = "xyes"
1355 then
1356 SAVE_CFLAGS=$CFLAGS
1357 SAVE_LDFLAGS=$LDFLAGS
1358 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1359 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1360 CFLAGS="$CFLAGS $PERL_CFLAGS"
1361 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1363 AC_CACHE_CHECK([for libperl],
1364 [have_libperl],
1365 AC_LINK_IFELSE(
1366 AC_LANG_PROGRAM(
1367 [[
1368 #include <EXTERN.h>
1369 #include <perl.h>
1370 #include <XSUB.h>
1371 ]],
1372 [[
1373 PerlInterpreter *perl = NULL;
1374 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1375 newSVpv ("Collectd::Plugin::FooBar", 24),
1376 Nullsv);
1377 ]]),
1378 [have_libperl="yes"],
1379 [have_libperl="no"]
1380 )
1381 )
1383 if test "x$have_libperl" = "xyes"
1384 then
1385 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1386 AC_SUBST(PERL_CFLAGS)
1387 AC_SUBST(PERL_LDFLAGS)
1388 else
1389 with_libperl="no"
1390 fi
1392 CFLAGS=$SAVE_CFLAGS
1393 LDFLAGS=$SAVE_LDFLAGS
1394 fi
1395 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1397 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1398 [
1399 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1400 then
1401 LDFLAGS="$LDFLAGS -L$withval/lib"
1402 CPPFLAGS="$CPPFLAGS -I$withval/include"
1403 with_libiptc="yes"
1404 fi
1405 ],
1406 [
1407 if test "x$ac_system" = "xLinux"
1408 then
1409 with_libiptc="yes"
1410 else
1411 with_libiptc="no (Linux only)"
1412 fi
1413 ])
1414 if test "x$with_libiptc" = "xyes"
1415 then
1416 AC_CHECK_LIB(iptc, iptc_init,
1417 [
1418 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1419 ], [with_libiptc="no (libiptc not found)"])
1420 fi
1421 if test "x$with_libiptc" = "xyes"
1422 then
1423 AC_CHECK_HEADERS(libiptc/libiptc.h,
1424 [
1425 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1426 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1427 fi
1428 if test "x$with_libiptc" = "xyes"
1429 then
1430 collect_libiptc=1
1431 else
1432 collect_libiptc=0
1433 fi
1434 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1436 with_snmp_config="net-snmp-config"
1437 with_snmp_cflags=""
1438 with_snmp_libs=""
1439 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1440 [
1441 if test "x$withval" = "xno"
1442 then
1443 with_libnetsnmp="no"
1444 else if test "x$withval" = "xyes"
1445 then
1446 with_libnetsnmp="yes"
1447 else
1448 if test -x "$withval"
1449 then
1450 with_snmp_config="$withval"
1451 with_libnetsnmp="yes"
1452 else
1453 with_snmp_config="$withval/bin/net-snmp-config"
1454 with_libnetsnmp="yes"
1455 fi
1456 fi; fi
1457 ],
1458 [with_libnetsnmp="yes"])
1459 if test "x$with_libnetsnmp" = "xyes"
1460 then
1461 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1462 snmp_config_status=$?
1464 if test $snmp_config_status -ne 0
1465 then
1466 with_libnetsnmp="no ($with_snmp_config failed)"
1467 else
1468 SAVE_CPPFLAGS="$CPPFLAGS"
1469 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1471 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1473 CPPFLAGS="$SAVE_CPPFLAGS"
1474 fi
1475 fi
1476 if test "x$with_libnetsnmp" = "xyes"
1477 then
1478 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1479 snmp_config_status=$?
1481 if test $snmp_config_status -ne 0
1482 then
1483 with_libnetsnmp="no ($with_snmp_config failed)"
1484 else
1485 AC_CHECK_LIB(netsnmp, init_snmp,
1486 [with_libnetsnmp="yes"],
1487 [with_libnetsnmp="no (libnetsnmp not found)"],
1488 [$with_snmp_libs])
1489 fi
1490 fi
1491 if test "x$with_libnetsnmp" = "xyes"
1492 then
1493 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1494 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1495 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1496 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1497 fi
1498 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1500 with_upsclient_config="libupsclient-config"
1501 with_upsclient_cflags=""
1502 with_upsclient_libs=""
1503 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1504 [
1505 if test "x$withval" = "xno"
1506 then
1507 with_libupsclient="no"
1508 else
1509 if test "x$withval" != "xyes"
1510 then
1511 if test -f "$withval" && test -x "$withval";
1512 then
1513 with_upsclient_config="$withval"
1514 else
1515 with_upsclient_config="$withval/bin/libupsclient-config"
1516 fi
1517 fi
1518 with_libupsclient="yes"
1519 fi
1520 ],
1521 [
1522 with_libupsclient="yes"
1523 ])
1524 if test "x$with_libupsclient" = "xyes"
1525 then
1526 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1527 upsclient_config_status=$?
1529 if test $upsclient_config_status -ne 0
1530 then
1531 with_libupsclient="no ($with_upsclient_config failed)"
1532 fi
1533 fi
1534 if test "x$with_libupsclient" = "xyes"
1535 then
1536 SAVE_CPPFLAGS="$CPPFLAGS"
1537 CPPFLAGS="$CPPFLAGS $with_upsclient_cflags"
1539 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1541 CPPFLAGS="$SAVE_CPPFLAGS"
1542 fi
1543 if test "x$with_libupsclient" = "xyes"
1544 then
1545 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1546 upsclient_config_status=$?
1548 if test $upsclient_config_status -ne 0
1549 then
1550 with_libupsclient="no ($with_upsclient_config failed)"
1551 fi
1552 fi
1553 if test "x$with_libupsclient" = "xyes"
1554 then
1555 AC_CHECK_LIB(upsclient, upscli_connect,
1556 [
1557 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1558 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1559 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1560 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1561 ],
1562 [
1563 with_libupsclient="no (symbol 'upscli_connect' not found)"
1564 ], [$with_upsclient_libs])
1565 fi
1566 if test "x$with_libupsclient" = "xyes"
1567 then
1568 SAVE_CPPFLAGS="$CPPFLAGS"
1569 CPPFLAGS="$CPPFLAGS $with_upsclient_cflags"
1571 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1572 [#include <stdlib.h>
1573 #include <stdio.h>
1574 #include <upsclient.h>])
1576 CPPFLAGS="$SAVE_CPPFLAGS"
1577 fi
1578 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1580 ### BEGIN of check for libxmms ###
1581 with_xmms_config="xmms-config"
1582 with_xmms_cflags=""
1583 with_xmms_libs=""
1584 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1585 [
1586 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1587 then
1588 if test -f "$withval" && test -x "$withval";
1589 then
1590 with_xmms_config="$withval"
1591 else if test -x "$withval/bin/xmms-config"
1592 then
1593 with_xmms_config="$withval/bin/xmms-config"
1594 fi; fi
1595 with_libxmms="yes"
1596 else if test "x$withval" = "xno"
1597 then
1598 with_libxmms="no"
1599 else
1600 with_libxmms="yes"
1601 fi; fi
1602 ],
1603 [
1604 with_libxmms="yes"
1605 ])
1606 if test "x$with_libxmms" = "xyes"
1607 then
1608 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1609 xmms_config_status=$?
1611 if test $xmms_config_status -ne 0
1612 then
1613 with_libxmms="no"
1614 fi
1615 fi
1616 if test "x$with_libxmms" = "xyes"
1617 then
1618 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1619 xmms_config_status=$?
1621 if test $xmms_config_status -ne 0
1622 then
1623 with_libxmms="no"
1624 fi
1625 fi
1626 if test "x$with_libxmms" = "xyes"
1627 then
1628 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1629 [
1630 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1631 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1632 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1633 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1634 ],
1635 [
1636 with_libxmms="no"
1637 ],
1638 [$with_xmms_libs])
1639 fi
1640 with_libxmms_numeric=0
1641 if test "x$with_libxmms" = "xyes"
1642 then
1643 with_libxmms_numeric=1
1644 fi
1645 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1646 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1647 ### END of check for libxmms ###
1649 with_libnetlink_cflags=""
1650 with_libnetlink_libs="-lnetlink"
1651 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1652 [
1653 echo "libnetlink: withval = $withval"
1654 if test "x$withval" = "xyes"
1655 then
1656 with_libnetlink="yes"
1657 else if test "x$withval" = "xno"
1658 then
1659 with_libnetlink="no"
1660 else
1661 if test -d "$withval/include"
1662 then
1663 with_libnetlink_cflags="-I$withval/include"
1664 with_libnetlink_libs="-L$withval/lib -lnetlink"
1665 with_libnetlink="yes"
1666 else
1667 AC_MSG_ERROR("no such directory: $withval/include")
1668 fi
1669 fi; fi
1670 ],
1671 [
1672 if test "x$ac_system" = "xLinux"
1673 then
1674 with_libnetlink="yes"
1675 else
1676 with_libnetlink="no (Linux only library)"
1677 fi
1678 ])
1679 if test "x$with_libnetlink" = "xyes"
1680 then
1681 SAVE_CFLAGS=$CFLAGS
1682 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1684 with_libnetlink="no (libnetlink.h not found)"
1686 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1687 [
1688 with_libnetlink="yes"
1689 break
1690 ], [],
1691 [#include <stdio.h>
1692 #include <sys/types.h>
1693 #include <asm/types.h>
1694 #include <sys/socket.h>
1695 #include <linux/netlink.h>
1696 #include <linux/rtnetlink.h>])
1697 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1698 [#include <stdio.h>
1699 #include <sys/types.h>
1700 #include <asm/types.h>
1701 #include <sys/socket.h>])
1703 AC_COMPILE_IFELSE(
1704 [#include <stdio.h>
1705 #include <sys/types.h>
1706 #include <asm/types.h>
1707 #include <sys/socket.h>
1708 #include <linux/netlink.h>
1709 #include <linux/rtnetlink.h>
1711 int main (void)
1712 {
1713 int retval = TCA_STATS2;
1714 return (retval);
1715 }],
1716 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1717 []);
1719 AC_COMPILE_IFELSE(
1720 [#include <stdio.h>
1721 #include <sys/types.h>
1722 #include <asm/types.h>
1723 #include <sys/socket.h>
1724 #include <linux/netlink.h>
1725 #include <linux/rtnetlink.h>
1727 int main (void)
1728 {
1729 int retval = TCA_STATS;
1730 return (retval);
1731 }],
1732 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1733 []);
1735 CFLAGS="$SAVE_CFLAGS"
1736 fi
1737 if test "x$with_libnetlink" = "xyes"
1738 then
1739 AC_CHECK_LIB(netlink, rtnl_open,
1740 [with_libnetlink="yes"],
1741 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1742 [$with_libnetlink_libs])
1743 fi
1744 if test "x$with_libnetlink" = "xyes"
1745 then
1746 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1747 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1748 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1749 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1750 fi
1751 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1753 # Check for enabled/disabled features
1754 #
1756 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1757 # ------------------------------------------------------------
1758 dnl
1759 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1760 dnl
1761 AC_DEFUN(
1762 [AC_COLLECTD],
1763 [
1764 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1765 m4_if(
1766 [$2],
1767 [enable],
1768 [dnl
1769 m4_define([EnDis],[disabled])dnl
1770 m4_define([YesNo],[no])dnl
1771 ],dnl
1772 [m4_if(
1773 [$2],
1774 [disable],
1775 [dnl
1776 m4_define([EnDis],[enabled])dnl
1777 m4_define([YesNo],[yes])dnl
1778 ],
1779 [dnl
1780 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1781 ]dnl
1782 )]dnl
1783 )dnl
1784 m4_if([$3], [feature], [],
1785 [m4_if(
1786 [$3], [module], [],
1787 [dnl
1788 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1789 ]dnl
1790 )]dnl
1791 )dnl
1792 AC_ARG_ENABLE(
1793 [$1],
1794 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1795 [],
1796 enable_$1='[YesNo]'dnl
1797 )# AC_ARG_ENABLE
1798 if test "x$enable_$1" = "xno"
1799 then
1800 collectd_$1=0
1801 else
1802 if test "x$enable_$1" = "xyes"
1803 then
1804 collectd_$1=1
1805 else
1806 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1807 collectd_$1=1
1808 enable_$1='yes'
1809 fi
1810 fi
1811 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1812 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1813 ]dnl
1814 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1816 # AC_PLUGIN(name, default, info)
1817 # ------------------------------------------------------------
1818 dnl
1819 AC_DEFUN(
1820 [AC_PLUGIN],
1821 [
1822 enable_plugin="no"
1823 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1824 [
1825 if test "x$enableval" = "xyes"
1826 then
1827 enable_plugin="yes"
1828 else
1829 enable_plugin="no"
1830 fi
1831 ],
1832 [
1833 if test "x$2" = "xyes"
1834 then
1835 enable_plugin="yes"
1836 else
1837 enable_plugin="no"
1838 fi
1839 ])
1840 if test "x$enable_plugin" = "xyes"
1841 then
1842 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1843 fi
1844 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1845 enable_$1="$enable_plugin"
1846 ]
1847 )# AC_PLUGIN(name, default, info)
1849 m4_divert_once([HELP_ENABLE], [
1850 collectd features:])
1851 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1852 AC_COLLECTD([debug], [enable], [feature], [debugging])
1853 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1854 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1856 plugin_battery="no"
1857 plugin_cpu="no"
1858 plugin_cpufreq="no"
1859 plugin_df="no"
1860 plugin_disk="no"
1861 plugin_entropy="no"
1862 plugin_interface="no"
1863 plugin_ipvs="no"
1864 plugin_irq="no"
1865 plugin_load="no"
1866 plugin_memory="no"
1867 plugin_multimeter="no"
1868 plugin_nfs="no"
1869 plugin_processes="no"
1870 plugin_serial="no"
1871 plugin_swap="no"
1872 plugin_tape="no"
1873 plugin_tcpconns="no"
1874 plugin_users="no"
1875 plugin_vserver="no"
1876 plugin_wireless="no"
1878 # Linux
1879 if test "x$ac_system" = "xLinux"
1880 then
1881 plugin_battery="yes"
1882 plugin_cpu="yes"
1883 plugin_cpufreq="yes"
1884 plugin_disk="yes"
1885 plugin_entropy="yes"
1886 plugin_interface="yes"
1887 plugin_irq="yes"
1888 plugin_load="yes"
1889 plugin_memory="yes"
1890 plugin_nfs="yes"
1891 plugin_processes="yes"
1892 plugin_serial="yes"
1893 plugin_swap="yes"
1894 plugin_tcpconns="yes"
1895 plugin_vserver="yes"
1896 plugin_wireless="yes"
1898 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1899 then
1900 plugin_ipvs="yes"
1901 fi
1902 fi
1904 # Mac OS X devices
1905 if test "x$with_libiokit" = "xyes"
1906 then
1907 plugin_battery="yes"
1908 plugin_disk="yes"
1909 fi
1911 # Solaris
1912 if test "x$with_devinfo$with_kstat" = "xyesyes"
1913 then
1914 plugin_cpu="yes"
1915 plugin_disk="yes"
1916 plugin_interface="yes"
1917 plugin_memory="yes"
1918 plugin_swap="yes"
1919 plugin_tape="yes"
1920 fi
1922 # libstatgrab
1923 if test "x$with_libstatgrab" = "xyes"
1924 then
1925 plugin_interface="yes"
1926 plugin_load="yes"
1927 plugin_memory="yes"
1928 plugin_swap="yes"
1929 fi
1931 if test "x$have_processor_info" = "xyes"
1932 then
1933 plugin_cpu="yes"
1934 fi
1935 if test "x$have_sysctlbyname" = "xyes"
1936 then
1937 plugin_cpu="yes"
1938 plugin_memory="yes"
1939 plugin_tcpconns="yes"
1940 fi
1942 if test "x$have_statfs" = "xyes"
1943 then
1944 plugin_df="yes"
1945 fi
1946 if test "x$have_statvfs" = "xyes"
1947 then
1948 plugin_df="yes"
1949 fi
1951 if test "x$have_getifaddrs" = "xyes"
1952 then
1953 plugin_interface="yes"
1954 fi
1956 if test "x$have_getloadavg" = "xyes"
1957 then
1958 plugin_load="yes"
1959 fi
1961 # Mac OS X memory interface
1962 if test "x$have_host_statistics" = "xyes"
1963 then
1964 plugin_memory="yes"
1965 fi
1967 if test "x$have_termios_h" = "xyes"
1968 then
1969 plugin_multimeter="yes"
1970 fi
1972 if test "x$have_thread_info" = "xyes"
1973 then
1974 plugin_processes="yes"
1975 fi
1977 if test "x$with_libkvm" = "xyes"
1978 then
1979 plugin_swap="yes"
1980 fi
1982 if test "x$have_getutent" = "xyes"
1983 then
1984 plugin_users="yes"
1985 fi
1986 if test "x$have_getutxent" = "xyes"
1987 then
1988 plugin_users="yes"
1989 fi
1991 # FIXME: sysctl for swap plugin
1993 m4_divert_once([HELP_ENABLE], [
1994 collectd plugins:])
1996 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
1997 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
1998 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
1999 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2000 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2001 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2002 AC_PLUGIN([csv], [yes], [CSV output plugin])
2003 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2004 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2005 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2006 AC_PLUGIN([email], [yes], [EMail statistics])
2007 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2008 AC_PLUGIN([exec], [yes], [Execution of external programs])
2009 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2010 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2011 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2012 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2013 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2014 AC_PLUGIN([load], [$plugin_load], [System load])
2015 AC_PLUGIN([logfile], [yes], [File logging plugin])
2016 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2017 AC_PLUGIN([memcached], [yes], [memcached statistics])
2018 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2019 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2020 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2021 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2022 AC_PLUGIN([network], [yes], [Network communication plugin])
2023 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2024 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2025 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2026 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2027 AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
2028 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2029 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2030 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2031 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2032 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2033 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2034 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2035 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2036 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2037 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2038 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2039 AC_PLUGIN([users], [$plugin_users], [User statistics])
2040 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2041 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2042 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2044 dnl ip_vs.h
2045 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2046 then
2047 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2048 fi
2050 dnl Perl bindings
2051 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2052 [
2053 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2054 then
2055 PERL_BINDINGS_OPTIONS="$withval"
2056 with_perl_bindings="yes"
2057 else
2058 PERL_BINDINGS_OPTIONS=""
2059 with_perl_bindings="$withval"
2060 fi
2061 ],
2062 [
2063 PERL_BINDINGS_OPTIONS=""
2064 with_perl_bindings="yes"
2065 ])
2066 if test "x$with_perl_bindings" = "xyes"
2067 then
2068 PERL_BINDINGS="perl"
2069 else
2070 PERL_BINDINGS=""
2071 fi
2072 AC_SUBST(PERL_BINDINGS)
2073 AC_SUBST(PERL_BINDINGS_OPTIONS)
2075 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2077 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
2078 then
2079 with_liboping="yes (shipped version)"
2080 fi
2082 if test "x$with_libperl" = "xyes"
2083 then
2084 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2085 else
2086 enable_perl="no (needs libperl)"
2087 fi
2089 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
2090 then
2091 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2092 fi
2094 cat <<EOF;
2096 Configuration:
2097 Libraries:
2098 libcurl . . . . . . $with_libcurl
2099 libiokit . . . . . $with_libiokit
2100 libiptc . . . . . . $with_libiptc
2101 libkstat . . . . . $with_kstat
2102 libkvm . . . . . . $with_libkvm
2103 libmysql . . . . . $with_libmysql
2104 libnetlink . . . . $with_libnetlink
2105 libnetsnmp . . . . $with_libnetsnmp
2106 liboconfig . . . . $with_liboconfig
2107 liboping . . . . . $with_liboping
2108 libpcap . . . . . . $with_libpcap
2109 libperl . . . . . . $with_libperl
2110 libpthread . . . . $with_libpthread
2111 librrd . . . . . . $with_rrdtool
2112 libsensors . . . . $with_lm_sensors
2113 libstatgrab . . . . $with_libstatgrab
2114 libupsclient . . . $with_libupsclient
2115 libxmms . . . . . . $with_libxmms
2117 Features:
2118 daemon mode . . . . $enable_daemon
2119 debug . . . . . . . $enable_debug
2121 Bindings:
2122 perl . . . . . . . $with_perl_bindings
2124 Modules:
2125 apache . . . . . . $enable_apache
2126 apcups . . . . . . $enable_apcups
2127 apple_sensors . . . $enable_apple_sensors
2128 battery . . . . . . $enable_battery
2129 cpu . . . . . . . . $enable_cpu
2130 cpufreq . . . . . . $enable_cpufreq
2131 csv . . . . . . . . $enable_csv
2132 df . . . . . . . . $enable_df
2133 disk . . . . . . . $enable_disk
2134 dns . . . . . . . . $enable_dns
2135 email . . . . . . . $enable_email
2136 entropy . . . . . . $enable_entropy
2137 exec . . . . . . . $enable_exec
2138 hddtemp . . . . . . $enable_hddtemp
2139 interface . . . . . $enable_interface
2140 iptables . . . . . $enable_iptables
2141 ipvs . . . . . . . $enable_ipvs
2142 irq . . . . . . . . $enable_irq
2143 load . . . . . . . $enable_load
2144 logfile . . . . . . $enable_logfile
2145 mbmon . . . . . . . $enable_mbmon
2146 memcached . . . . . $enable_memcached
2147 memory . . . . . . $enable_memory
2148 multimeter . . . . $enable_multimeter
2149 mysql . . . . . . . $enable_mysql
2150 netlink . . . . . . $enable_netlink
2151 network . . . . . . $enable_network
2152 nfs . . . . . . . . $enable_nfs
2153 nginx . . . . . . . $enable_nginx
2154 ntpd . . . . . . . $enable_ntpd
2155 nut . . . . . . . . $enable_nut
2156 perl . . . . . . . $enable_perl
2157 ping . . . . . . . $enable_ping
2158 processes . . . . . $enable_processes
2159 rrdtool . . . . . . $enable_rrdtool
2160 sensors . . . . . . $enable_sensors
2161 serial . . . . . . $enable_serial
2162 snmp . . . . . . . $enable_snmp
2163 swap . . . . . . . $enable_swap
2164 syslog . . . . . . $enable_syslog
2165 tape . . . . . . . $enable_tape
2166 tcpconns . . . . . $enable_tcpconns
2167 unixsock . . . . . $enable_unixsock
2168 users . . . . . . . $enable_users
2169 vserver . . . . . . $enable_vserver
2170 wireless . . . . . $enable_wireless
2171 xmms . . . . . . . $enable_xmms
2173 EOF