1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
6 AC_LANG(C)
8 AC_PREFIX_DEFAULT("/opt/collectd")
10 AC_SYS_LARGEFILE
12 #
13 # Checks for programs.
14 #
15 AC_PROG_CC
16 AC_PROG_CPP
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
19 AC_PROG_MAKE_SET
20 AM_PROG_CC_C_O
21 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
23 dnl configure libtool
24 AC_DISABLE_STATIC
25 AC_LIBLTDL_CONVENIENCE
26 AC_SUBST(LTDLINCL)
27 AC_SUBST(LIBLTDL)
28 AC_LIBTOOL_DLOPEN
29 AC_PROG_LIBTOOL
30 AC_PROG_LEX
31 AC_PROG_YACC
32 PKG_PROG_PKG_CONFIG
33 AC_CONFIG_SUBDIRS(libltdl)
35 AC_MSG_CHECKING([for kernel type ($host_os)])
36 case $host_os in
37 *linux*)
38 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
39 ac_system="Linux"
40 ;;
41 *solaris*)
42 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
43 ac_system="Solaris"
44 ;;
45 *darwin*)
46 ac_system="Darwin"
47 ;;
48 *)
49 ac_system="unknown"
50 esac
51 AC_MSG_RESULT([$ac_system])
53 if test "x$ac_system" = "xLinux"
54 then
55 AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
56 if test -z "$KERNEL_DIR"
57 then
58 KERNEL_DIR="/lib/modules/`uname -r`/source"
59 fi
61 KERNEL_CFLAGS="-I$KERNEL_DIR/include"
62 AC_SUBST(KERNEL_CFLAGS)
63 fi
65 #
66 # Checks for header files.
67 #
68 AC_HEADER_STDC
69 AC_HEADER_SYS_WAIT
70 AC_HEADER_DIRENT
72 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 sys/isa_defs.h)
74 # For ping library
75 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
76 [#if HAVE_STDINT_H
77 # include <stdint.h>
78 #endif
79 #if HAVE_SYS_TYPES_H
80 # include <sys/types.h>
81 #endif
82 ])
83 AC_CHECK_HEADERS(netinet/in.h, [], [],
84 [#if HAVE_STDINT_H
85 # include <stdint.h>
86 #endif
87 #if HAVE_SYS_TYPES_H
88 # include <sys/types.h>
89 #endif
90 #if HAVE_NETINET_IN_SYSTM_H
91 # include <netinet/in_systm.h>
92 #endif
93 ])
94 AC_CHECK_HEADERS(netinet/ip.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 ])
108 AC_CHECK_HEADERS(netinet/ip_icmp.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/ip_var.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 #if HAVE_NETINET_IP_H
139 # include <netinet/ip.h>
140 #endif
141 ])
142 AC_CHECK_HEADERS(netinet/ip6.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 ])
156 AC_CHECK_HEADERS(netinet/icmp6.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_IP6_H
170 # include <netinet/ip6.h>
171 #endif
172 ])
173 AC_CHECK_HEADERS(netinet/tcp.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 ])
190 AC_CHECK_HEADERS(netinet/udp.h, [], [],
191 [#if HAVE_STDINT_H
192 # include <stdint.h>
193 #endif
194 #if HAVE_SYS_TYPES_H
195 # include <sys/types.h>
196 #endif
197 #if HAVE_NETINET_IN_SYSTM_H
198 # include <netinet/in_systm.h>
199 #endif
200 #if HAVE_NETINET_IN_H
201 # include <netinet/in.h>
202 #endif
203 #if HAVE_NETINET_IP_H
204 # include <netinet/ip.h>
205 #endif
206 ])
208 # For cpu modules
209 AC_CHECK_HEADERS(sys/dkstat.h)
210 if test "x$ac_system" = "xDarwin"
211 then
212 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)
213 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
214 fi
215 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
216 [
217 #if HAVE_SYS_TYPES_H
218 # include <sys/types.h>
219 #endif
220 #if HAVE_SYS_PARAM_H
221 # include <sys/param.h>
222 #endif
223 ])
225 # For hddtemp module
226 AC_CHECK_HEADERS(linux/major.h libgen.h)
228 # For the battery plugin
229 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
230 [
231 #if HAVE_IOKIT_IOKITLIB_H
232 # include <IOKit/IOKitLib.h>
233 #endif
234 #if HAVE_IOKIT_IOTYPES_H
235 # include <IOKit/IOTypes.h>
236 #endif
237 ])
239 # For the swap module
240 AC_CHECK_HEADERS(sys/swap.h, [], [],
241 [
242 #if HAVE_SYS_TYPES_H
243 # include <sys/types.h>
244 #endif
245 #if HAVE_SYS_PARAM_H
246 # include <sys/param.h>
247 #endif
248 ])
250 # For load module
251 # For the processes plugin
252 # For users module
253 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
255 # For interface plugin
256 AC_CHECK_HEADERS(ifaddrs.h)
257 AC_CHECK_HEADERS(net/if.h, [], [],
258 [
259 #if HAVE_SYS_TYPES_H
260 # include <sys/types.h>
261 #endif
262 #if HAVE_SYS_SOCKET_H
263 # include <sys/socket.h>
264 #endif
265 ])
266 AC_CHECK_HEADERS(linux/if.h, [], [],
267 [
268 #if HAVE_SYS_TYPES_H
269 # include <sys/types.h>
270 #endif
271 #if HAVE_SYS_SOCKET_H
272 # include <sys/socket.h>
273 #endif
274 ])
275 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
276 [
277 #if HAVE_SYS_TYPES_H
278 # include <sys/types.h>
279 #endif
280 #if HAVE_SYS_SOCKET_H
281 # include <sys/socket.h>
282 #endif
283 #if HAVE_LINUX_IF_H
284 # include <linux/if.h>
285 #endif
286 ])
288 # For ipvs module
289 have_net_ip_vs_h="no"
290 have_ip_vs_h="no"
291 if test "x$ac_system" = "xLinux"
292 then
293 SAVE_CFLAGS=$CFLAGS
294 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
296 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
297 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
299 CFLAGS=$SAVE_CFLAGS
300 fi
302 # For quota module
303 AC_CHECK_HEADERS(sys/ucred.h, [], [],
304 [
305 #if HAVE_SYS_TYPES_H
306 # include <sys/types.h>
307 #endif
308 #if HAVE_SYS_PARAM_H
309 # include <sys/param.h>
310 #endif
311 ])
313 # For mount interface
314 AC_CHECK_HEADERS(sys/mount.h, [], [],
315 [
316 #if HAVE_SYS_TYPES_H
317 # include <sys/types.h>
318 #endif
319 #if HAVE_SYS_PARAM_H
320 # include <sys/param.h>
321 #endif
322 ])
324 # For the email plugin
325 AC_CHECK_HEADERS(linux/un.h, [], [],
326 [
327 #if HAVE_SYS_SOCKET_H
328 # include <sys/socket.h>
329 #endif
330 ])
332 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 wordexp.h)
334 # For the dns plugin
335 AC_CHECK_HEADERS(arpa/nameser.h)
336 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
337 [
338 #if HAVE_ARPA_NAMESER_H
339 # include <arpa/nameser.h>
340 #endif
341 ])
343 AC_CHECK_HEADERS(net/if_arp.h, [], [],
344 [#if HAVE_SYS_SOCKET_H
345 # include <sys/socket.h>
346 #endif
347 ])
348 AC_CHECK_HEADERS(net/ppp_defs.h)
349 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
350 [#if HAVE_NET_PPP_DEFS_H
351 # include <net/ppp_defs.h>
352 #endif
353 ])
354 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
355 [#if HAVE_STDINT_H
356 # include <stdint.h>
357 #endif
358 #if HAVE_SYS_TYPES_H
359 # include <sys/types.h>
360 #endif
361 #if HAVE_SYS_SOCKET_H
362 # include <sys/socket.h>
363 #endif
364 #if HAVE_NET_IF_H
365 # include <net/if.h>
366 #endif
367 #if HAVE_NETINET_IN_H
368 # include <netinet/in.h>
369 #endif
370 ])
372 # For the multimeter plugin
373 have_termios_h="no"
374 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
376 #
377 # Checks for typedefs, structures, and compiler characteristics.
378 #
379 AC_C_CONST
380 AC_TYPE_PID_T
381 AC_TYPE_SIZE_T
382 AC_TYPE_UID_T
383 AC_HEADER_TIME
385 #
386 # Checks for library functions.
387 #
388 AC_PROG_GCC_TRADITIONAL
389 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
391 AC_FUNC_STRERROR_R
393 AC_CACHE_CHECK([for strtok_r],
394 [have_strtok_r_default],
395 AC_LINK_IFELSE(
396 AC_LANG_PROGRAM(
397 [[[[
398 #include <stdlib.h>
399 #include <stdio.h>
400 #include <string.h>
401 ]]]],
402 [[[[
403 char buffer[] = "foo,bar,baz";
404 char *token;
405 char *dummy;
406 char *saveptr;
408 dummy = buffer;
409 saveptr = NULL;
410 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
411 {
412 dummy = NULL;
413 printf ("token = %s;\n", token);
414 }
415 ]]]]),
416 [have_strtok_r_default="yes"],
417 [have_strtok_r_default="no"]
418 )
419 )
421 if test "x$have_strtok_r_default" = "xno"
422 then
423 SAVE_CFLAGS="$CFLAGS"
424 CFLAGS="$CFLAGS -D_REENTRANT=1"
426 AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
427 [have_strtok_r_reentrant],
428 AC_LINK_IFELSE(
429 AC_LANG_PROGRAM(
430 [[[[
431 #include <stdlib.h>
432 #include <stdio.h>
433 #include <string.h>
434 ]]]],
435 [[[[
436 char buffer[] = "foo,bar,baz";
437 char *token;
438 char *dummy;
439 char *saveptr;
441 dummy = buffer;
442 saveptr = NULL;
443 while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
444 {
445 dummy = NULL;
446 printf ("token = %s;\n", token);
447 }
448 ]]]]),
449 [have_strtok_r_reentrant="yes"],
450 [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
451 )
452 )
453 fi
455 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
457 socket_needs_socket="no"
458 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
459 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
461 nanosleep_needs_rt="no"
462 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
463 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
465 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
466 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
467 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
468 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
469 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
470 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
471 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
472 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
473 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
474 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
476 # For load module
477 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
479 # Check for NAN
480 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
481 [
482 if test "x$withval" = "xno"; then
483 nan_type="none"
484 else if test "x$withval" = "xyes"; then
485 nan_type="zero"
486 else
487 nan_type="$withval"
488 fi; fi
489 ],
490 [nan_type="none"])
491 if test "x$nan_type" = "xnone"; then
492 AC_CACHE_CHECK([whether NAN is defined by default],
493 [have_nan_default],
494 AC_COMPILE_IFELSE(
495 AC_LANG_PROGRAM(
496 [[
497 #include <stdlib.h>
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_default="yes"],
508 [have_nan_default="no"]
509 )
510 )
511 if test "x$have_nan_default" = "xyes"
512 then
513 nan_type="default"
514 fi
515 fi
516 if test "x$nan_type" = "xnone"; then
517 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
518 [have_nan_isoc],
519 AC_COMPILE_IFELSE(
520 AC_LANG_PROGRAM(
521 [[
522 #include <stdlib.h>
523 #define __USE_ISOC99 1
524 #include <math.h>
525 static float foo = NAN;
526 ]],
527 [[
528 if (isnan (foo))
529 return 0;
530 else
531 return 1;
532 ]]),
533 [have_nan_isoc="yes"],
534 [have_nan_isoc="no"]
535 )
536 )
537 if test "x$have_nan_isoc" = "xyes"
538 then
539 nan_type="isoc99"
540 fi
541 fi
542 if test "x$nan_type" = "xnone"; then
543 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
544 [have_nan_zero],
545 AC_RUN_IFELSE(
546 AC_LANG_PROGRAM(
547 [[
548 #include <stdlib.h>
549 #include <math.h>
550 #ifdef NAN
551 # undef NAN
552 #endif
553 #define NAN (0.0 / 0.0)
554 #ifndef isnan
555 # define isnan(f) ((f) != (f))
556 #endif
557 static float foo = NAN;
558 ]],
559 [[
560 if (isnan (foo))
561 return 0;
562 else
563 return 1;
564 ]]),
565 [have_nan_zero="yes"],
566 [have_nan_zero="no"]
567 )
568 )
569 if test "x$have_nan_zero" = "xyes"
570 then
571 nan_type="zero"
572 fi
573 fi
575 if test "x$nan_type" = "xdefault"; then
576 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
577 [Define if NAN is defined by default and can initialize static variables.])
578 else if test "x$nan_type" = "xisoc99"; then
579 AC_DEFINE(NAN_STATIC_ISOC, 1,
580 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
581 else if test "x$nan_type" = "xzero"; then
582 AC_DEFINE(NAN_ZERO_ZERO, 1,
583 [Define if NAN can be defined as (0.0 / 0.0)])
584 else
585 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
586 fi; fi; fi
588 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
589 [
590 if test "x$withval" = "xnothing"; then
591 fp_layout_type="nothing"
592 else if test "x$withval" = "xendianflip"; then
593 fp_layout_type="endianflip"
594 else if test "x$withval" = "xintswap"; then
595 fp_layout_type="intswap"
596 else
597 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
598 fi; fi; fi
599 ],
600 [fp_layout_type="unknown"])
602 if test "x$fp_layout_type" = "xunknown"; then
603 AC_CACHE_CHECK([if doubles are stored in x86 representation],
604 [fp_layout_need_nothing],
605 AC_RUN_IFELSE(
606 AC_LANG_PROGRAM(
607 [[[[
608 #include <stdlib.h>
609 #include <stdio.h>
610 #include <stdint.h>
611 #include <string.h>
612 ]]]],
613 [[[[
614 uint64_t i0;
615 uint64_t i1;
616 uint8_t c[8];
617 double d;
619 d = 8.642135e130;
620 memcpy ((void *) &i0, (void *) &d, 8);
622 i1 = i0;
623 memcpy ((void *) c, (void *) &i1, 8);
625 if ((c[0] == 0x2f) && (c[1] == 0x25)
626 && (c[2] == 0xc0) && (c[3] == 0xc7)
627 && (c[4] == 0x43) && (c[5] == 0x2b)
628 && (c[6] == 0x1f) && (c[7] == 0x5b))
629 return (0);
630 else
631 return (1);
632 ]]]]),
633 [fp_layout_need_nothing="yes"],
634 [fp_layout_need_nothing="no"]
635 )
636 )
637 if test "x$fp_layout_need_nothing" = "xyes"; then
638 fp_layout_type="nothing"
639 fi
640 fi
641 if test "x$fp_layout_type" = "xunknown"; then
642 AC_CACHE_CHECK([if endianflip converts to x86 representation],
643 [fp_layout_need_endianflip],
644 AC_RUN_IFELSE(
645 AC_LANG_PROGRAM(
646 [[[[
647 #include <stdlib.h>
648 #include <stdio.h>
649 #include <stdint.h>
650 #include <string.h>
651 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
652 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
653 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
654 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
655 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
656 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
657 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
658 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
659 ]]]],
660 [[[[
661 uint64_t i0;
662 uint64_t i1;
663 uint8_t c[8];
664 double d;
666 d = 8.642135e130;
667 memcpy ((void *) &i0, (void *) &d, 8);
669 i1 = endianflip (i0);
670 memcpy ((void *) c, (void *) &i1, 8);
672 if ((c[0] == 0x2f) && (c[1] == 0x25)
673 && (c[2] == 0xc0) && (c[3] == 0xc7)
674 && (c[4] == 0x43) && (c[5] == 0x2b)
675 && (c[6] == 0x1f) && (c[7] == 0x5b))
676 return (0);
677 else
678 return (1);
679 ]]]]),
680 [fp_layout_need_endianflip="yes"],
681 [fp_layout_need_endianflip="no"]
682 )
683 )
684 if test "x$fp_layout_need_endianflip" = "xyes"; then
685 fp_layout_type="endianflip"
686 fi
687 fi
688 if test "x$fp_layout_type" = "xunknown"; then
689 AC_CACHE_CHECK([if intswap converts to x86 representation],
690 [fp_layout_need_intswap],
691 AC_RUN_IFELSE(
692 AC_LANG_PROGRAM(
693 [[[[
694 #include <stdlib.h>
695 #include <stdio.h>
696 #include <stdint.h>
697 #include <string.h>
698 #define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
699 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
700 ]]]],
701 [[[[
702 uint64_t i0;
703 uint64_t i1;
704 uint8_t c[8];
705 double d;
707 d = 8.642135e130;
708 memcpy ((void *) &i0, (void *) &d, 8);
710 i1 = intswap (i0);
711 memcpy ((void *) c, (void *) &i1, 8);
713 if ((c[0] == 0x2f) && (c[1] == 0x25)
714 && (c[2] == 0xc0) && (c[3] == 0xc7)
715 && (c[4] == 0x43) && (c[5] == 0x2b)
716 && (c[6] == 0x1f) && (c[7] == 0x5b))
717 return (0);
718 else
719 return (1);
720 ]]]]),
721 [fp_layout_need_intswap="yes"],
722 [fp_layout_need_intswap="no"]
723 )
724 )
725 if test "x$fp_layout_need_intswap" = "xyes"; then
726 fp_layout_type="intswap"
727 fi
728 fi
730 if test "x$fp_layout_type" = "xnothing"; then
731 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
732 [Define if doubles are stored in x86 representation.])
733 else if test "x$fp_layout_type" = "xendianflip"; then
734 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
735 [Define if endianflip is needed to convert to x86 representation.])
736 else if test "x$fp_layout_type" = "xintswap"; then
737 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
738 [Define if intswap is needed to convert to x86 representation.])
739 else
740 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
741 fi; fi; fi
743 have_getfsstat="no"
744 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
745 have_getvfsstat="no"
746 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
747 have_listmntent="no"
748 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
750 have_getmntent="no"
751 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
752 if test "x$have_getmntent" = "xno"; then
753 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
754 fi
755 if test "x$have_getmntent" = "xno"; then
756 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
757 fi
758 if test "x$have_getmntent" = "xno"; then
759 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
760 fi
762 if test "x$have_getmntent" = "xc"; then
763 AC_CACHE_CHECK([whether getmntent takes one argument],
764 [have_one_getmntent],
765 AC_COMPILE_IFELSE(
766 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
767 #include <mntent.h>
768 #include "$srcdir/src/utils_mount.h"]],
769 [[
770 FILE *fh;
771 struct mntent *me;
772 fh = setmntent ("/etc/mtab", "r");
773 me = getmntent (fh);
774 ]]
775 ),
776 [have_one_getmntent="yes"],
777 [have_one_getmntent="no"]
778 )
779 )
780 AC_CACHE_CHECK([whether getmntent takes two arguments],
781 [have_two_getmntent],
782 AC_COMPILE_IFELSE(
783 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
784 #include <sys/mnttab.h>
785 #include "$srcdir/src/utils_mount.h"]],
786 [[
787 FILE *fh;
788 struct mnttab mt;
789 int status;
790 fh = fopen ("/etc/mnttab", "r");
791 status = getmntent (fh, &mt);
792 ]]
793 ),
794 [have_two_getmntent="yes"],
795 [have_two_getmntent="no"]
796 )
797 )
798 fi
800 # Check for different versions of `getmntent' here..
802 if test "x$have_getmntent" = "xc"; then
803 if test "x$have_one_getmntent" = "xyes"; then
804 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
805 [Define if the function getmntent exists and takes one argument.])
806 fi
807 if test "x$have_two_getmntent" = "xyes"; then
808 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
809 [Define if the function getmntent exists and takes two arguments.])
810 fi
811 fi
812 if test "x$have_getmntent" = "xsun"; then
813 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
814 [Define if the function getmntent exists. It's the version from libsun.])
815 fi
816 if test "x$have_getmntent" = "xseq"; then
817 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
818 [Define if the function getmntent exists. It's the version from libseq.])
819 fi
820 if test "x$have_getmntent" = "xgen"; then
821 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
822 [Define if the function getmntent exists. It's the version from libgen.])
823 fi
825 # Check for structures
826 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
827 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
828 [],
829 [
830 #include <sys/types.h>
831 #include <sys/socket.h>
832 #include <net/if.h>
833 ])
834 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
835 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
836 [],
837 [
838 #include <sys/types.h>
839 #include <sys/socket.h>
840 #include <linux/if.h>
841 #include <linux/netdevice.h>
842 ])
844 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
845 [#if HAVE_STDINT_H
846 # include <stdint.h>
847 #endif
848 #if HAVE_SYS_TYPES_H
849 # include <sys/types.h>
850 #endif
851 #if HAVE_NETINET_IN_SYSTM_H
852 # include <netinet/in_systm.h>
853 #endif
854 #if HAVE_NETINET_IN_H
855 # include <netinet/in.h>
856 #endif
857 #if HAVE_NETINET_IP_H
858 # include <netinet/ip.h>
859 #endif
860 #if HAVE_NETINET_UDP_H
861 # include <netinet/udp.h>
862 #endif
863 ])
864 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
865 [#if HAVE_STDINT_H
866 # include <stdint.h>
867 #endif
868 #if HAVE_SYS_TYPES_H
869 # include <sys/types.h>
870 #endif
871 #if HAVE_NETINET_IN_SYSTM_H
872 # include <netinet/in_systm.h>
873 #endif
874 #if HAVE_NETINET_IN_H
875 # include <netinet/in.h>
876 #endif
877 #if HAVE_NETINET_IP_H
878 # include <netinet/ip.h>
879 #endif
880 #if HAVE_NETINET_UDP_H
881 # include <netinet/udp.h>
882 #endif
883 ])
885 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
886 [],
887 [],
888 [
889 #if HAVE_KSTAT_H
890 # include <kstat.h>
891 #endif
892 ])
894 #
895 # Checks for libraries begin here
896 #
897 with_libresolv="yes"
898 AC_CHECK_LIB(resolv, res_search,
899 [
900 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
901 ],
902 [with_libresolv="no"])
903 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
905 dnl Check for HAL (hardware abstraction library)
906 with_libhal="yes"
907 AC_CHECK_LIB(hal,libhal_device_property_exists,
908 [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
909 [with_libhal="no"])
910 if test "x$with_libhal" = "xyes"; then
911 if test "x$PKG_CONFIG" != "x"; then
912 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
913 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
914 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
915 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
916 fi
917 fi
919 m4_divert_once([HELP_WITH], [
920 collectd additional packages:])
922 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
923 librrd_cflags=""
924 librrd_ldflags=""
925 librrd_threadsafe="yes"
926 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
927 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
928 then
929 librrd_cflags="-I$withval/include"
930 librrd_ldflags="-L$withval/lib"
931 with_rrdtool="yes"
932 else
933 with_rrdtool="$withval"
934 fi
935 ], [with_rrdtool="yes"])
936 if test "x$with_rrdtool" = "xyes"
937 then
938 SAVE_CPPFLAGS="$CPPFLAGS"
939 SAVE_LDFLAGS="$LDFLAGS"
941 CPPFLAGS="$CPPFLAGS $librrd_cflags"
942 LDFLAGS="$LDFLAGS $librrd_ldflags"
944 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
946 CPPFLAGS="$SAVE_CPPFLAGS"
947 LDFLAGS="$SAVE_LDFLAGS"
948 fi
949 if test "x$with_rrdtool" = "xyes"
950 then
951 SAVE_CPPFLAGS="$CPPFLAGS"
952 SAVE_LDFLAGS="$LDFLAGS"
954 CPPFLAGS="$CPPFLAGS $librrd_cflags"
955 LDFLAGS="$LDFLAGS $librrd_ldflags"
957 AC_CHECK_LIB(rrd_th, rrd_update_r,
958 [with_rrdtool="yes"
959 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
960 ],
961 [librrd_threadsafe="no"
962 AC_CHECK_LIB(rrd, rrd_update,
963 [with_rrdtool="yes"
964 librrd_ldflags="$librrd_ldflags -lrrd -lm"
965 ],
966 [with_rrdtool="no (symbol 'rrd_update' not found)"],
967 [-lm])
968 ],
969 [-lm])
971 CPPFLAGS="$SAVE_CPPFLAGS"
972 LDFLAGS="$SAVE_LDFLAGS"
973 fi
974 if test "x$with_rrdtool" = "xyes"
975 then
976 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
977 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
978 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
979 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
980 fi
981 if test "x$librrd_threadsafe" = "xyes"
982 then
983 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
984 fi
986 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
987 [ if test "x$withval" != "xno" \
988 && test "x$withval" != "xyes"
989 then
990 LDFLAGS="$LDFLAGS -L$withval/lib"
991 CPPFLAGS="$CPPFLAGS -I$withval/include"
992 with_libpthread="yes"
993 else
994 if test "x$withval" = "xno"
995 then
996 with_libpthread="no (disabled)"
997 fi
998 fi
999 ], [with_libpthread="yes"])
1000 if test "x$with_libpthread" = "xyes"
1001 then
1002 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
1003 fi
1004 if test "x$with_libpthread" = "xyes"
1005 then
1006 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
1007 fi
1008 if test "x$with_libpthread" = "xyes"
1009 then
1010 collect_pthread=1
1011 else
1012 collect_pthread=0
1013 fi
1014 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
1015 [Wether or not to use pthread (POSIX threads) library])
1016 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
1018 if test "x$ac_system" = "xSolaris"
1019 then
1020 with_kstat="yes"
1021 with_devinfo="yes"
1022 else
1023 with_kstat="no (Solaris only)"
1024 with_devinfo="no (Solaris only)"
1025 fi
1027 if test "x$with_kstat" = "xyes"
1028 then
1029 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1030 fi
1031 if test "x$with_kstat" = "xyes"
1032 then
1033 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1034 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1035 fi
1036 if test "x$with_kstat" = "xyes"
1037 then
1038 AC_DEFINE(HAVE_LIBKSTAT, 1,
1039 [Define to 1 if you have the 'kstat' library (-lkstat)])
1040 fi
1041 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1042 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1044 ### BEGIN of check for libcurl ###
1045 with_curl_config="curl-config"
1046 with_curl_cflags=""
1047 with_curl_libs=""
1048 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1049 [
1050 if test "x$withval" = "xno"
1051 then
1052 with_libcurl="no"
1053 else if test "x$withval" = "xyes"
1054 then
1055 with_libcurl="yes"
1056 else
1057 if test -f "$withval" && test -x "$withval"
1058 then
1059 with_curl_config="$withval"
1060 with_libcurl="yes"
1061 else if test -x "$withval/bin/curl-config"
1062 then
1063 with_curl_config="$withval/bin/curl-config"
1064 with_libcurl="yes"
1065 fi; fi
1066 with_libcurl="yes"
1067 fi; fi
1068 ],
1069 [
1070 with_libcurl="yes"
1071 ])
1072 if test "x$with_libcurl" = "xyes"
1073 then
1074 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1075 curl_config_status=$?
1077 if test $curl_config_status -ne 0
1078 then
1079 with_libcurl="no ($with_curl_config failed)"
1080 else
1081 SAVE_CPPFLAGS="$CPPFLAGS"
1082 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1084 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1086 CPPFLAGS="$SAVE_CPPFLAGS"
1087 fi
1088 fi
1089 if test "x$with_libcurl" = "xyes"
1090 then
1091 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1092 curl_config_status=$?
1094 if test $curl_config_status -ne 0
1095 then
1096 with_libcurl="no ($with_curl_config failed)"
1097 else
1098 AC_CHECK_LIB(curl, curl_easy_init,
1099 [with_libcurl="yes"],
1100 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1101 [$with_curl_libs])
1102 fi
1103 fi
1104 if test "x$with_libcurl" = "xyes"
1105 then
1106 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1107 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1108 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1109 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1110 fi
1111 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1112 ### END of check for libcurl ###
1114 with_libiokit="no"
1115 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1116 [
1117 with_libiokit="yes"
1118 ],
1119 [
1120 with_libiokit="no"
1121 ])
1122 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1124 with_libstatgrab_cflags=""
1125 with_libstatgrab_ldflags=""
1126 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
1127 [
1128 if test "x$withval" != "xno" \
1129 && test "x$withval" != "xyes"
1130 then
1131 with_libstatgrab_cflags="-I$withval/include"
1132 with_libstatgrab_ldflags="-L$withval/lib"
1133 with_libstatgrab="yes"
1134 else
1135 with_libstatgrab="$withval"
1136 fi
1137 ],
1138 [
1139 if test "x$ac_system" = "xunknown"
1140 then
1141 with_libstatgrab="yes"
1142 else
1143 with_libstatgrab="no"
1144 fi
1145 ])
1146 with_libstatgrab_pkg_config="yes"
1147 if test "x$with_libstatgrab" = "xyes" \
1148 && test "x$PKG_CONFIG" != "x"
1149 then
1150 AC_MSG_CHECKING([pkg-config for libstatgrab])
1151 temp_result="found"
1152 $PKG_CONFIG --exists libstatgrab 2>/dev/null
1153 if test "$?" != "0"
1154 then
1155 with_libstatgrab_pkg_config="no"
1156 temp_result="not found"
1157 fi
1158 AC_MSG_RESULT([$temp_result])
1159 else
1160 AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
1161 with_libstatgrab_pkg_config="no"
1162 with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
1163 fi
1165 if test "x$with_libstatgrab" = "xyes" \
1166 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1167 && test "x$with_libstatgrab_cflags" = "x"
1168 then
1169 AC_MSG_CHECKING([for libstatgrab CFLAGS])
1170 temp_result="`$PKG_CONFIG --cflags libstatgrab`"
1171 if test "$?" = "0"
1172 then
1173 with_libstatgrab_cflags="$temp_result"
1174 else
1175 with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
1176 temp_result="$PKG_CONFIG --cflags libstatgrab failed"
1177 fi
1178 AC_MSG_RESULT([$temp_result])
1179 fi
1181 if test "x$with_libstatgrab" = "xyes" \
1182 && test "x$with_libstatgrab_pkg_config" = "xyes" \
1183 && test "x$with_libstatgrab_ldflags" = "x"
1184 then
1185 AC_MSG_CHECKING([for libstatgrab LDFLAGS])
1186 temp_result="`$PKG_CONFIG --libs libstatgrab`"
1187 if test "$?" = "0"
1188 then
1189 with_libstatgrab_ldflags="$temp_result"
1190 else
1191 with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
1192 temp_result="$PKG_CONFIG --libs libstatgrab failed"
1193 fi
1194 AC_MSG_RESULT([$temp_result])
1195 fi
1197 if test "x$with_libstatgrab" = "xyes"
1198 then
1199 SAVE_CPPFLAGS="$CPPFLAGS"
1200 CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
1202 AC_CHECK_HEADERS(statgrab.h,
1203 [with_libstatgrab="yes"],
1204 [with_libstatgrab="no (statgrab.h not found)"])
1206 CPPFLAGS="$SAVE_CPPFLAGS"
1207 fi
1209 if test "x$with_libstatgrab" = "xyes"
1210 then
1211 SAVE_CFLAGS="$CFLAGS"
1212 SAVE_LDFLAGS="$LDFLAGS"
1214 CFLAGS="$CFLAGS $with_libstatgrab_cflags"
1215 LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
1217 AC_CHECK_LIB(statgrab, sg_init,
1218 [with_libstatgrab="yes"],
1219 [with_libstatgrab="no (symbol sg_init not found)"])
1221 CFLAGS="$SAVE_CFLAGS"
1222 LDFLAGS="$SAVE_LDFLAGS"
1223 fi
1225 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
1226 if test "x$with_libstatgrab" = "xyes"
1227 then
1228 AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
1229 BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
1230 BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
1231 AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
1232 AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
1233 fi
1235 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
1236 if test "x$with_libkvm" = "xyes"
1237 then
1238 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
1239 fi
1240 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
1242 with_sensors_cflags=""
1243 with_sensors_ldflags=""
1244 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
1245 [
1246 if test "x$withval" = "xno"
1247 then
1248 with_lm_sensors="no"
1249 else
1250 with_lm_sensors="yes"
1251 if test "x$withval" != "xyes"
1252 then
1253 with_sensors_cflags="-I$withval/include"
1254 with_sensors_ldflags="-L$withval/lib"
1255 with_lm_sensors="yes"
1256 fi
1257 fi
1258 ],
1259 [
1260 if test "x$ac_system" = "xLinux"
1261 then
1262 with_lm_sensors="yes"
1263 else
1264 with_lm_sensors="no (Linux only library)"
1265 fi
1266 ])
1267 if test "x$with_lm_sensors" = "xyes"
1268 then
1269 SAVE_CPPFLAGS="$CPPFLAGS"
1270 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1272 # AC_CHECK_HEADERS(sensors/sensors.h,
1273 # [
1274 # AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1275 # ],
1276 # [with_lm_sensors="no (sensors/sensors.h not found)"])
1277 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1279 CPPFLAGS="$SAVE_CPPFLAGS"
1280 fi
1281 if test "x$with_lm_sensors" = "xyes"
1282 then
1283 SAVE_CPPFLAGS="$CPPFLAGS"
1284 SAVE_LDFLAGS="$LDFLAGS"
1285 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1286 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1288 AC_CHECK_LIB(sensors, sensors_init,
1289 [
1290 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
1291 ],
1292 [with_lm_sensors="no (libsensors not found)"])
1294 CPPFLAGS="$SAVE_CPPFLAGS"
1295 LDFLAGS="$SAVE_LDFLAGS"
1296 fi
1297 if test "x$with_lm_sensors" = "xyes"
1298 then
1299 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1300 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1301 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1302 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
1303 fi
1304 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
1306 with_mysql_config="mysql_config"
1307 with_mysql_cflags=""
1308 with_mysql_libs=""
1309 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1310 [
1311 if test "x$withval" = "xno"
1312 then
1313 with_libmysql="no"
1314 else if test "x$withval" = "xyes"
1315 then
1316 with_libmysql="yes"
1317 else
1318 if test -f "$withval" && test -x "$withval";
1319 then
1320 with_mysql_config="$withval"
1321 else if test -x "$withval/bin/mysql_config"
1322 then
1323 with_mysql_config="$withval/bin/mysql_config"
1324 fi; fi
1325 with_libmysql="yes"
1326 fi; fi
1327 ],
1328 [
1329 with_libmysql="yes"
1330 ])
1331 if test "x$with_libmysql" = "xyes"
1332 then
1333 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1334 mysql_config_status=$?
1336 if test $mysql_config_status -ne 0
1337 then
1338 with_libmysql="no"
1339 else
1340 SAVE_CPPFLAGS="$CPPFLAGS"
1341 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1343 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1345 CPPFLAGS="$SAVE_CPPFLAGS"
1346 fi
1347 fi
1348 if test "x$with_libmysql" = "xyes"
1349 then
1350 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1351 mysql_config_status=$?
1353 if test $mysql_config_status -ne 0
1354 then
1355 with_libmysql="no"
1356 else
1357 AC_CHECK_LIB(mysqlclient, mysql_init,
1358 [with_libmysql="yes"],
1359 [with_libmysql="no (symbol 'mysql_init' not found)"],
1360 [$with_mysql_libs])
1361 fi
1362 fi
1363 if test "x$with_libmysql" = "xyes"
1364 then
1365 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1366 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1367 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1368 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1369 fi
1370 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1372 with_own_liboconfig="no"
1373 liboconfig_LDFLAGS="$LDFLAGS"
1374 liboconfig_CPPFLAGS="$CPPFLAGS"
1375 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1376 [
1377 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1378 then
1379 if test -d "$withval/lib"
1380 then
1381 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1382 fi
1383 if test -d "$withval/include"
1384 then
1385 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1386 fi
1387 fi
1388 if test "x$withval" = "xno"
1389 then
1390 AC_MSG_ERROR("liboconfig is required")
1391 fi
1392 ],
1393 [
1394 with_liboconfig="yes"
1395 ])
1397 save_LDFLAGS="$LDFLAGS"
1398 save_CPPFLAGS="$CPPFLAGS"
1399 LDFLAGS="$liboconfig_LDFLAGS"
1400 CPPFLAGS="$liboconfig_CPPFLAGS"
1401 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1402 [
1403 with_liboconfig="yes"
1404 with_own_liboconfig="no"
1405 ],
1406 [
1407 with_liboconfig="yes"
1408 with_own_liboconfig="yes"
1409 LDFLAGS="$save_LDFLAGS"
1410 CPPFLAGS="$save_CPPFLAGS"
1411 ])
1413 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1414 if test "x$with_own_liboconfig" = "xyes"
1415 then
1416 with_liboconfig="yes (shipped version)"
1417 fi
1419 #with_liboping="yes"
1420 with_own_liboping="no"
1421 liboping_LDFLAGS="$LDFLAGS"
1422 liboping_CPPFLAGS="$CPPFLAGS"
1423 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1424 [
1425 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1426 then
1427 if test -d "$withval/lib"
1428 then
1429 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1430 fi
1431 if test -d "$withval/include"
1432 then
1433 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1434 fi
1435 fi
1436 if test "x$withval" = "xno"
1437 then
1438 with_liboping="no"
1439 with_own_liboping="no"
1440 else if test "x$withval" = "xyes"
1441 then
1442 with_liboping="yes"
1443 fi; fi
1444 ],
1445 [
1446 with_liboping="yes"
1447 ])
1449 if test "x$with_liboping" = "xyes"
1450 then
1451 save_LDFLAGS="$LDFLAGS"
1452 save_CPPFLAGS="$CPPFLAGS"
1453 LDFLAGS="$liboping_LDFLAGS"
1454 CPPFLAGS="$liboping_CPPFLAGS"
1455 AC_CHECK_LIB(oping, ping_construct,
1456 [
1457 with_liboping="yes"
1458 with_own_liboping="no"
1459 ],
1460 [
1461 with_liboping="yes"
1462 with_own_liboping="yes"
1463 LDFLAGS="$save_LDFLAGS"
1464 CPPFLAGS="$save_CPPFLAGS"
1465 ])
1466 fi
1467 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1468 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1470 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1471 [
1472 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1473 then
1474 LDFLAGS="$LDFLAGS -L$withval/lib"
1475 CPPFLAGS="$CPPFLAGS -I$withval/include"
1476 with_libpcap="yes"
1477 else
1478 with_libpcap="$withval"
1479 fi
1480 ],
1481 [
1482 with_libpcap="yes"
1483 ])
1484 if test "x$with_libpcap" = "xyes"
1485 then
1486 AC_CHECK_LIB(pcap, pcap_open_live,
1487 [
1488 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1489 ], [with_libpcap="no (libpcap not found)"])
1490 fi
1491 if test "x$with_libpcap" = "xyes"
1492 then
1493 AC_CHECK_HEADERS(pcap.h,
1494 [
1495 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1496 ], [with_libpcap="no (pcap.h not found)"])
1497 fi
1498 if test "x$with_libpcap" = "xyes"
1499 then
1500 collect_libpcap=1
1501 else
1502 collect_libpcap=0
1503 fi
1504 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1505 [Wether or not to use the pcap library])
1506 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1508 perl_interpreter="perl"
1509 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1510 [
1511 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1512 then
1513 LDFLAGS="$LDFLAGS -L$withval/lib"
1514 CPPFLAGS="$CPPFLAGS -I$withval/include"
1515 perl_interpreter="$withval/bin/perl"
1516 with_libperl="yes"
1517 else
1518 with_libperl="$withval"
1519 fi
1520 ],
1521 [
1522 with_libperl="yes"
1523 ])
1525 AC_MSG_CHECKING([for perl])
1526 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
1527 if test -x "$perl_interpreter"
1528 then
1529 AC_MSG_RESULT([yes])
1530 else
1531 perl_interpreter=""
1532 AC_MSG_RESULT([no])
1533 fi
1535 AC_SUBST(PERL, "$perl_interpreter")
1537 if test "x$with_libperl" = "xyes" \
1538 && test -n "$perl_interpreter"
1539 then
1540 SAVE_CFLAGS=$CFLAGS
1541 SAVE_LDFLAGS=$LDFLAGS
1542 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1543 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1544 CFLAGS="$CFLAGS $PERL_CFLAGS"
1545 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1547 AC_CACHE_CHECK([for libperl],
1548 [have_libperl],
1549 AC_LINK_IFELSE(
1550 AC_LANG_PROGRAM(
1551 [[
1552 #include <EXTERN.h>
1553 #include <perl.h>
1554 #include <XSUB.h>
1555 ]],
1556 [[
1557 PerlInterpreter *perl = NULL;
1558 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1559 newSVpv ("Collectd::Plugin::FooBar", 24),
1560 Nullsv);
1561 ]]),
1562 [have_libperl="yes"],
1563 [have_libperl="no"]
1564 )
1565 )
1567 if test "x$have_libperl" = "xyes"
1568 then
1569 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1570 AC_SUBST(PERL_CFLAGS)
1571 AC_SUBST(PERL_LDFLAGS)
1572 else
1573 with_libperl="no"
1574 fi
1576 CFLAGS=$SAVE_CFLAGS
1577 LDFLAGS=$SAVE_LDFLAGS
1578 else if test -z "$perl_interpreter"; then
1579 with_libperl="no (no perl interpreter found)"
1580 have_libperl="no"
1581 fi; fi
1582 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1584 if test "x$with_libperl" = "xyes"
1585 then
1586 SAVE_CFLAGS=$CFLAGS
1587 SAVE_LDFLAGS=$LDFLAGS
1588 CFLAGS="$CFLAGS $PERL_CFLAGS"
1589 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1591 AC_CACHE_CHECK([if perl supports ithreads],
1592 [have_perl_ithreads],
1593 AC_LINK_IFELSE(
1594 AC_LANG_PROGRAM(
1595 [[
1596 #include <EXTERN.h>
1597 #include <perl.h>
1598 #include <XSUB.h>
1600 #if !defined(USE_ITHREADS)
1601 # error "Perl does not support ithreads!"
1602 #endif /* !defined(USE_ITHREADS) */
1603 ]],
1604 [[ ]]),
1605 [have_perl_ithreads="yes"],
1606 [have_perl_ithreads="no"]
1607 )
1608 )
1610 if test "x$have_perl_ithreads" = "xyes"
1611 then
1612 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
1613 fi
1615 CFLAGS=$SAVE_CFLAGS
1616 LDFLAGS=$SAVE_LDFLAGS
1617 fi
1619 with_own_libiptc="no"
1620 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1621 [
1622 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1623 then
1624 LDFLAGS="$LDFLAGS -L$withval/lib"
1625 CPPFLAGS="$CPPFLAGS -I$withval/include"
1626 with_libiptc="yes"
1627 else
1628 with_libiptc="$withval"
1629 fi
1630 ],
1631 [
1632 if test "x$ac_system" = "xLinux"
1633 then
1634 with_libiptc="yes"
1635 else
1636 with_libiptc="no (Linux only)"
1637 fi
1638 ])
1639 if test "x$with_libiptc" = "xyes"
1640 then
1641 AC_CHECK_LIB(iptc, iptc_init,
1642 [
1643 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1644 ],
1645 [
1646 with_libiptc="yes"
1647 with_own_libiptc="yes"
1648 ])
1649 fi
1650 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1651 then
1652 AC_CHECK_HEADERS(libiptc/libiptc.h,
1653 [
1654 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1655 ],
1656 [
1657 with_libiptc="yes"
1658 with_own_libiptc="yes"
1659 ])
1660 fi
1661 if test "x$with_libiptc" = "xyes"
1662 then
1663 SAVE_CFLAGS=$CFLAGS
1664 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1666 AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1667 [
1668 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1669 with_own_libiptc="no"
1670 ],
1671 [
1672 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1673 ])
1675 CFLAGS=$SAVE_CFLAGS
1676 fi
1677 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1678 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1679 if test "x$with_own_libiptc" = "xyes"
1680 then
1681 AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1682 fi
1684 with_snmp_config="net-snmp-config"
1685 with_snmp_cflags=""
1686 with_snmp_libs=""
1687 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1688 [
1689 if test "x$withval" = "xno"
1690 then
1691 with_libnetsnmp="no"
1692 else if test "x$withval" = "xyes"
1693 then
1694 with_libnetsnmp="yes"
1695 else
1696 if test -x "$withval"
1697 then
1698 with_snmp_config="$withval"
1699 with_libnetsnmp="yes"
1700 else
1701 with_snmp_config="$withval/bin/net-snmp-config"
1702 with_libnetsnmp="yes"
1703 fi
1704 fi; fi
1705 ],
1706 [with_libnetsnmp="yes"])
1707 if test "x$with_libnetsnmp" = "xyes"
1708 then
1709 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1710 snmp_config_status=$?
1712 if test $snmp_config_status -ne 0
1713 then
1714 with_libnetsnmp="no ($with_snmp_config failed)"
1715 else
1716 SAVE_CPPFLAGS="$CPPFLAGS"
1717 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1719 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1721 CPPFLAGS="$SAVE_CPPFLAGS"
1722 fi
1723 fi
1724 if test "x$with_libnetsnmp" = "xyes"
1725 then
1726 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1727 snmp_config_status=$?
1729 if test $snmp_config_status -ne 0
1730 then
1731 with_libnetsnmp="no ($with_snmp_config failed)"
1732 else
1733 AC_CHECK_LIB(netsnmp, init_snmp,
1734 [with_libnetsnmp="yes"],
1735 [with_libnetsnmp="no (libnetsnmp not found)"],
1736 [$with_snmp_libs])
1737 fi
1738 fi
1739 if test "x$with_libnetsnmp" = "xyes"
1740 then
1741 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1742 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1743 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1744 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1745 fi
1746 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1748 with_libupsclient="no (pkg-config isn't available)"
1749 with_libupsclient_cflags=""
1750 with_libupsclient_libs=""
1751 if test "x$PKG_CONFIG" != "x"
1752 then
1753 pkg-config --exists 'libupsclient' 2>/dev/null
1754 if test "$?" = "0"
1755 then
1756 with_libupsclient="yes"
1757 else
1758 with_libupsclient="no (pkg-config doesn't know library)"
1759 fi
1760 fi
1761 if test "x$with_libupsclient" = "xyes"
1762 then
1763 with_libupsclient_cflags="`pkg-config --cflags 'libupsclient'`"
1764 if test $? -ne 0
1765 then
1766 with_libupsclient="no"
1767 fi
1768 with_libupsclient_libs="`pkg-config --libs 'libupsclient'`"
1769 if test $? -ne 0
1770 then
1771 with_libupsclient="no"
1772 fi
1773 fi
1774 if test "x$with_libupsclient" = "xyes"
1775 then
1776 SAVE_CPPFLAGS="$CPPFLAGS"
1777 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1779 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1781 CPPFLAGS="$SAVE_CPPFLAGS"
1782 fi
1783 if test "x$with_libupsclient" = "xyes"
1784 then
1785 SAVE_CPPFLAGS="$CPPFLAGS"
1786 SAVE_LDFLAGS="$LDFLAGS"
1788 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1789 LDFLAGS="$LDFLAGS $with_libupsclient_libs"
1791 AC_CHECK_LIB(upsclient, upscli_connect,
1792 [with_libupsclient="yes"],
1793 [with_libupsclient="no (symbol upscli_connect not found)"])
1795 CPPFLAGS="$SAVE_CPPFLAGS"
1796 LDFLAGS="$SAVE_LDFLAGS"
1797 fi
1798 if test "x$with_libupsclient" = "xyes"
1799 then
1800 SAVE_CPPFLAGS="$CPPFLAGS"
1801 CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
1803 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1804 [#include <stdlib.h>
1805 #include <stdio.h>
1806 #include <upsclient.h>])
1808 CPPFLAGS="$SAVE_CPPFLAGS"
1809 fi
1810 if test "x$with_libupsclient" = "xyes"
1811 then
1812 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
1813 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
1814 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1815 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1816 fi
1818 ### BEGIN of check for libxmms ###
1819 with_xmms_config="xmms-config"
1820 with_xmms_cflags=""
1821 with_xmms_libs=""
1822 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1823 [
1824 if test "x$withval" != "xno" \
1825 && test "x$withval" != "xyes"
1826 then
1827 if test -f "$withval" && test -x "$withval";
1828 then
1829 with_xmms_config="$withval"
1830 else if test -x "$withval/bin/xmms-config"
1831 then
1832 with_xmms_config="$withval/bin/xmms-config"
1833 fi; fi
1834 with_libxmms="yes"
1835 else if test "x$withval" = "xno"
1836 then
1837 with_libxmms="no"
1838 else
1839 with_libxmms="yes"
1840 fi; fi
1841 ],
1842 [
1843 with_libxmms="yes"
1844 ])
1845 if test "x$with_libxmms" = "xyes"
1846 then
1847 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1848 xmms_config_status=$?
1850 if test $xmms_config_status -ne 0
1851 then
1852 with_libxmms="no"
1853 fi
1854 fi
1855 if test "x$with_libxmms" = "xyes"
1856 then
1857 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1858 xmms_config_status=$?
1860 if test $xmms_config_status -ne 0
1861 then
1862 with_libxmms="no"
1863 fi
1864 fi
1865 if test "x$with_libxmms" = "xyes"
1866 then
1867 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1868 [
1869 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1870 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1871 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1872 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1873 ],
1874 [
1875 with_libxmms="no"
1876 ],
1877 [$with_xmms_libs])
1878 fi
1879 with_libxmms_numeric=0
1880 if test "x$with_libxmms" = "xyes"
1881 then
1882 with_libxmms_numeric=1
1883 fi
1884 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1885 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1886 ### END of check for libxmms ###
1888 with_libnetlink_cflags=""
1889 with_libnetlink_libs="-lnetlink"
1890 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1891 [
1892 echo "libnetlink: withval = $withval"
1893 if test "x$withval" = "xyes"
1894 then
1895 with_libnetlink="yes"
1896 else if test "x$withval" = "xno"
1897 then
1898 with_libnetlink="no"
1899 else
1900 if test -d "$withval/include"
1901 then
1902 with_libnetlink_cflags="-I$withval/include"
1903 with_libnetlink_libs="-L$withval/lib -lnetlink"
1904 with_libnetlink="yes"
1905 else
1906 AC_MSG_ERROR("no such directory: $withval/include")
1907 fi
1908 fi; fi
1909 ],
1910 [
1911 if test "x$ac_system" = "xLinux"
1912 then
1913 with_libnetlink="yes"
1914 else
1915 with_libnetlink="no (Linux only library)"
1916 fi
1917 ])
1918 if test "x$with_libnetlink" = "xyes"
1919 then
1920 SAVE_CFLAGS=$CFLAGS
1921 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1923 with_libnetlink="no (libnetlink.h not found)"
1925 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1926 [
1927 with_libnetlink="yes"
1928 break
1929 ], [],
1930 [#include <stdio.h>
1931 #include <sys/types.h>
1932 #include <asm/types.h>
1933 #include <sys/socket.h>
1934 #include <linux/netlink.h>
1935 #include <linux/rtnetlink.h>])
1936 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1937 [#include <stdio.h>
1938 #include <sys/types.h>
1939 #include <asm/types.h>
1940 #include <sys/socket.h>])
1942 AC_COMPILE_IFELSE(
1943 [#include <stdio.h>
1944 #include <sys/types.h>
1945 #include <asm/types.h>
1946 #include <sys/socket.h>
1947 #include <linux/netlink.h>
1948 #include <linux/rtnetlink.h>
1950 int main (void)
1951 {
1952 int retval = TCA_STATS2;
1953 return (retval);
1954 }],
1955 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1956 []);
1958 AC_COMPILE_IFELSE(
1959 [#include <stdio.h>
1960 #include <sys/types.h>
1961 #include <asm/types.h>
1962 #include <sys/socket.h>
1963 #include <linux/netlink.h>
1964 #include <linux/rtnetlink.h>
1966 int main (void)
1967 {
1968 int retval = TCA_STATS;
1969 return (retval);
1970 }],
1971 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1972 []);
1974 CFLAGS="$SAVE_CFLAGS"
1975 fi
1976 if test "x$with_libnetlink" = "xyes"
1977 then
1978 AC_CHECK_LIB(netlink, rtnl_open,
1979 [with_libnetlink="yes"],
1980 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1981 [$with_libnetlink_libs])
1982 fi
1983 if test "x$with_libnetlink" = "xyes"
1984 then
1985 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1986 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1987 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1988 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1989 fi
1990 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1992 with_libopenipmipthread="yes"
1993 with_libopenipmipthread_cflags=""
1994 with_libopenipmipthread_libs=""
1996 AC_MSG_CHECKING([for pkg-config])
1997 temp_result="no"
1998 if test "x$PKG_CONFIG" = "x"
1999 then
2000 with_libopenipmipthread="no"
2001 temp_result="no"
2002 else
2003 temp_result="$PKG_CONFIG"
2004 fi
2005 AC_MSG_RESULT([$temp_result])
2007 if test "x$with_libopenipmipthread" = "xyes"
2008 then
2009 AC_MSG_CHECKING([for libOpenIPMIpthread])
2010 $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
2011 if test "$?" != "0"
2012 then
2013 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
2014 fi
2015 AC_MSG_RESULT([$with_libopenipmipthread])
2016 fi
2018 if test "x$with_libopenipmipthread" = "xyes"
2019 then
2020 AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
2021 temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
2022 if test "$?" = "0"
2023 then
2024 with_libopenipmipthread_cflags="$temp_result"
2025 else
2026 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
2027 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
2028 fi
2029 AC_MSG_RESULT([$temp_result])
2030 fi
2032 if test "x$with_libopenipmipthread" = "xyes"
2033 then
2034 AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
2035 temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
2036 if test "$?" = "0"
2037 then
2038 with_libopenipmipthread_ldflags="$temp_result"
2039 else
2040 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
2041 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
2042 fi
2043 AC_MSG_RESULT([$temp_result])
2044 fi
2046 if test "x$with_libopenipmipthread" = "xyes"
2047 then
2048 SAVE_CPPFLAGS="$CPPFLAGS"
2049 CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
2051 AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
2052 [with_libopenipmipthread="yes"],
2053 [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
2054 [#include <OpenIPMI/ipmiif.h>
2055 #include <OpenIPMI/ipmi_err.h>
2056 #include <OpenIPMI/ipmi_posix.h>
2057 #include <OpenIPMI/ipmi_conn.h>
2058 ])
2060 CPPFLAGS="$SAVE_CPPFLAGS"
2061 fi
2063 if test "x$with_libopenipmipthread" = "xyes"
2064 then
2065 BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
2066 BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
2067 AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
2068 AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
2069 fi
2071 dnl Check for libvirt and libxml2 libraries.
2072 with_libxml2="no (pkg-config isn't available)"
2073 with_libxml2_cflags=""
2074 with_libxml2_ldflags=""
2075 with_libvirt="no (pkg-config isn't available)"
2076 with_libvirt_cflags=""
2077 with_libvirt_ldflags=""
2078 if test "x$PKG_CONFIG" != "x"
2079 then
2080 pkg-config --exists 'libxml-2.0' 2>/dev/null
2081 if test "$?" = "0"
2082 then
2083 with_libxml2="yes"
2084 else
2085 with_libxml2="no (pkg-config doesn't know library)"
2086 fi
2088 pkg-config --exists libvirt 2>/dev/null
2089 if test "$?" = "0"
2090 then
2091 with_libvirt="yes"
2092 else
2093 with_libvirt="no (pkg-config doesn't know library)"
2094 fi
2095 fi
2096 if test "x$with_libxml2" = "xyes"
2097 then
2098 with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
2099 if test $? -ne 0
2100 then
2101 with_libxml2="no"
2102 fi
2103 with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
2104 if test $? -ne 0
2105 then
2106 with_libxml2="no"
2107 fi
2108 fi
2109 if test "x$with_libxml2" = "xyes"
2110 then
2111 SAVE_CPPFLAGS="$CPPFLAGS"
2112 CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
2114 AC_CHECK_HEADERS(libxml/parser.h, [],
2115 [with_libxml2="no (libxml/parser.h not found)"])
2117 CPPFLAGS="$SAVE_CPPFLAGS"
2118 fi
2119 if test "x$with_libxml2" = "xyes"
2120 then
2121 SAVE_CFLAGS="$CFLAGS"
2122 SAVE_LDFLAGS="$LDFLAGS"
2124 CFLAGS="$CFLAGS $with_libxml2_cflags"
2125 LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
2127 AC_CHECK_LIB(xml2, xmlXPathEval,
2128 [with_libxml2="yes"],
2129 [with_libxml2="no (symbol xmlXPathEval not found)"])
2131 CFLAGS="$SAVE_CFLAGS"
2132 LDFLAGS="$SAVE_LDFLAGS"
2133 fi
2134 dnl Add the right compiler flags and libraries.
2135 if test "x$with_libxml2" = "xyes"; then
2136 BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
2137 BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
2138 AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
2139 AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
2140 fi
2141 if test "x$with_libvirt" = "xyes"
2142 then
2143 with_libvirt_cflags="`pkg-config --cflags libvirt`"
2144 if test $? -ne 0
2145 then
2146 with_libvirt="no"
2147 fi
2148 with_libvirt_ldflags="`pkg-config --libs libvirt`"
2149 if test $? -ne 0
2150 then
2151 with_libvirt="no"
2152 fi
2153 fi
2154 if test "x$with_libvirt" = "xyes"
2155 then
2156 SAVE_CPPFLAGS="$CPPFLAGS"
2157 CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
2159 AC_CHECK_HEADERS(libvirt/libvirt.h, [],
2160 [with_libvirt="no (libvirt/libvirt.h not found)"])
2162 CPPFLAGS="$SAVE_CPPFLAGS"
2163 fi
2164 if test "x$with_libvirt" = "xyes"
2165 then
2166 SAVE_CFLAGS="$CFLAGS"
2167 SAVE_LDFLAGS="$LDFLAGS"
2169 CFLAGS="$CFLAGS $with_libvirt_cflags"
2170 LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
2172 AC_CHECK_LIB(virt, virDomainBlockStats,
2173 [with_libvirt="yes"],
2174 [with_libvirt="no (symbol virDomainBlockStats not found)"])
2176 CFLAGS="$SAVE_CFLAGS"
2177 LDFLAGS="$SAVE_LDFLAGS"
2178 fi
2179 dnl Add the right compiler flags and libraries.
2180 if test "x$with_libvirt" = "xyes"; then
2181 BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
2182 BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
2183 AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
2184 AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
2185 fi
2187 dnl End of check for libvirt and libxml2 libraries.
2189 # Check for enabled/disabled features
2190 #
2192 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
2193 # ------------------------------------------------------------
2194 dnl
2195 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
2196 dnl
2197 AC_DEFUN(
2198 [AC_COLLECTD],
2199 [
2200 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
2201 m4_if(
2202 [$2],
2203 [enable],
2204 [dnl
2205 m4_define([EnDis],[disabled])dnl
2206 m4_define([YesNo],[no])dnl
2207 ],dnl
2208 [m4_if(
2209 [$2],
2210 [disable],
2211 [dnl
2212 m4_define([EnDis],[enabled])dnl
2213 m4_define([YesNo],[yes])dnl
2214 ],
2215 [dnl
2216 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
2217 ]dnl
2218 )]dnl
2219 )dnl
2220 m4_if([$3], [feature], [],
2221 [m4_if(
2222 [$3], [module], [],
2223 [dnl
2224 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
2225 ]dnl
2226 )]dnl
2227 )dnl
2228 AC_ARG_ENABLE(
2229 [$1],
2230 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
2231 [],
2232 enable_$1='[YesNo]'dnl
2233 )# AC_ARG_ENABLE
2234 if test "x$enable_$1" = "xno"
2235 then
2236 collectd_$1=0
2237 else
2238 if test "x$enable_$1" = "xyes"
2239 then
2240 collectd_$1=1
2241 else
2242 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
2243 collectd_$1=1
2244 enable_$1='yes'
2245 fi
2246 fi
2247 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
2248 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
2249 ]dnl
2250 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
2252 # AC_PLUGIN(name, default, info)
2253 # ------------------------------------------------------------
2254 dnl
2255 AC_DEFUN(
2256 [AC_PLUGIN],
2257 [
2258 enable_plugin="no"
2259 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
2260 [
2261 if test "x$enableval" = "xyes"
2262 then
2263 enable_plugin="yes"
2264 else
2265 enable_plugin="no"
2266 fi
2267 ],
2268 [
2269 if test "x$2" = "xyes"
2270 then
2271 enable_plugin="yes"
2272 else
2273 enable_plugin="no"
2274 fi
2275 ])
2276 if test "x$enable_plugin" = "xyes"
2277 then
2278 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
2279 fi
2280 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
2281 enable_$1="$enable_plugin"
2282 ]
2283 )# AC_PLUGIN(name, default, info)
2285 m4_divert_once([HELP_ENABLE], [
2286 collectd features:])
2287 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
2288 AC_COLLECTD([debug], [enable], [feature], [debugging])
2289 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
2290 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
2292 plugin_ascent="no"
2293 plugin_battery="no"
2294 plugin_cpu="no"
2295 plugin_cpufreq="no"
2296 plugin_df="no"
2297 plugin_disk="no"
2298 plugin_entropy="no"
2299 plugin_interface="no"
2300 plugin_ipmi="no"
2301 plugin_ipvs="no"
2302 plugin_irq="no"
2303 plugin_libvirt="no"
2304 plugin_load="no"
2305 plugin_memory="no"
2306 plugin_multimeter="no"
2307 plugin_nfs="no"
2308 plugin_perl="no"
2309 plugin_processes="no"
2310 plugin_serial="no"
2311 plugin_swap="no"
2312 plugin_tape="no"
2313 plugin_tcpconns="no"
2314 plugin_users="no"
2315 plugin_vmem="no"
2316 plugin_vserver="no"
2317 plugin_wireless="no"
2319 # Linux
2320 if test "x$ac_system" = "xLinux"
2321 then
2322 plugin_battery="yes"
2323 plugin_cpu="yes"
2324 plugin_cpufreq="yes"
2325 plugin_disk="yes"
2326 plugin_entropy="yes"
2327 plugin_interface="yes"
2328 plugin_irq="yes"
2329 plugin_load="yes"
2330 plugin_memory="yes"
2331 plugin_nfs="yes"
2332 plugin_processes="yes"
2333 plugin_serial="yes"
2334 plugin_swap="yes"
2335 plugin_tcpconns="yes"
2336 plugin_vmem="yes"
2337 plugin_vserver="yes"
2338 plugin_wireless="yes"
2340 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
2341 then
2342 plugin_ipvs="yes"
2343 fi
2344 fi
2346 # Mac OS X devices
2347 if test "x$with_libiokit" = "xyes"
2348 then
2349 plugin_battery="yes"
2350 plugin_disk="yes"
2351 fi
2353 # Solaris
2354 if test "x$with_devinfo$with_kstat" = "xyesyes"
2355 then
2356 plugin_cpu="yes"
2357 plugin_disk="yes"
2358 plugin_interface="yes"
2359 plugin_memory="yes"
2360 plugin_swap="yes"
2361 plugin_tape="yes"
2362 fi
2364 # libstatgrab
2365 if test "x$with_libstatgrab" = "xyes"
2366 then
2367 plugin_cpu="yes"
2368 plugin_disk="yes"
2369 plugin_interface="yes"
2370 plugin_load="yes"
2371 plugin_memory="yes"
2372 plugin_swap="yes"
2373 plugin_users="yes"
2374 fi
2376 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
2377 then
2378 plugin_ascent="yes"
2379 fi
2381 if test "x$with_libopenipmipthread" = "xyes"
2382 then
2383 plugin_ipmi="yes"
2384 fi
2386 if test "x$have_processor_info" = "xyes"
2387 then
2388 plugin_cpu="yes"
2389 fi
2390 if test "x$have_sysctlbyname" = "xyes"
2391 then
2392 plugin_cpu="yes"
2393 plugin_memory="yes"
2394 plugin_tcpconns="yes"
2395 fi
2397 if test "x$have_statfs" = "xyes"
2398 then
2399 plugin_df="yes"
2400 fi
2401 if test "x$have_statvfs" = "xyes"
2402 then
2403 plugin_df="yes"
2404 fi
2406 if test "x$have_getifaddrs" = "xyes"
2407 then
2408 plugin_interface="yes"
2409 fi
2411 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
2412 then
2413 plugin_libvirt="yes"
2414 fi
2416 if test "x$have_getloadavg" = "xyes"
2417 then
2418 plugin_load="yes"
2419 fi
2421 if test "x$have_libperl$have_perl_ithreads" = "xyesyes"
2422 then
2423 plugin_perl="yes"
2424 fi
2426 # Mac OS X memory interface
2427 if test "x$have_host_statistics" = "xyes"
2428 then
2429 plugin_memory="yes"
2430 fi
2432 if test "x$have_termios_h" = "xyes"
2433 then
2434 plugin_multimeter="yes"
2435 fi
2437 if test "x$have_thread_info" = "xyes"
2438 then
2439 plugin_processes="yes"
2440 fi
2442 if test "x$with_libkvm" = "xyes"
2443 then
2444 plugin_swap="yes"
2445 fi
2447 if test "x$have_getutent" = "xyes"
2448 then
2449 plugin_users="yes"
2450 fi
2451 if test "x$have_getutxent" = "xyes"
2452 then
2453 plugin_users="yes"
2454 fi
2456 # FIXME: sysctl for swap plugin
2458 m4_divert_once([HELP_ENABLE], [
2459 collectd plugins:])
2461 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
2462 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
2463 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
2464 AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics])
2465 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2466 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2467 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2468 AC_PLUGIN([csv], [yes], [CSV output plugin])
2469 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2470 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2471 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2472 AC_PLUGIN([email], [yes], [EMail statistics])
2473 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2474 AC_PLUGIN([exec], [yes], [Execution of external programs])
2475 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2476 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2477 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
2478 AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
2479 AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
2480 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2481 AC_PLUGIN([libvirt], [$plugin_libvirt], [Virtual machine statistics])
2482 AC_PLUGIN([load], [$plugin_load], [System load])
2483 AC_PLUGIN([logfile], [yes], [File logging plugin])
2484 AC_PLUGIN([mbmon], [yes], [Query mbmond])
2485 AC_PLUGIN([memcached], [yes], [memcached statistics])
2486 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2487 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2488 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
2489 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
2490 AC_PLUGIN([network], [yes], [Network communication plugin])
2491 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
2492 AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
2493 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
2494 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
2495 AC_PLUGIN([perl], [$plugin_perl], [Embed a Perl interpreter])
2496 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2497 AC_PLUGIN([powerdns], [yes], [PowerDNS statistics])
2498 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2499 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2500 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2501 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2502 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2503 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2504 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2505 AC_PLUGIN([tail], [yes], [Parsing of logfiles])
2506 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
2507 AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
2508 AC_PLUGIN([teamspeak2], [yes], [TeamSpeak2 server statistics])
2509 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2510 AC_PLUGIN([users], [$plugin_users], [User statistics])
2511 AC_PLUGIN([uuid], [yes], [UUID as hostname plugin])
2512 AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
2513 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2514 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2515 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
2517 dnl ip_vs.h
2518 if test "x$ac_system" = "xLinux" \
2519 && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2520 then
2521 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2522 fi
2524 dnl Perl bindings
2525 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2526 [
2527 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2528 then
2529 PERL_BINDINGS_OPTIONS="$withval"
2530 with_perl_bindings="yes"
2531 else
2532 PERL_BINDINGS_OPTIONS=""
2533 with_perl_bindings="$withval"
2534 fi
2535 ],
2536 [
2537 PERL_BINDINGS_OPTIONS=""
2538 if test -n "$perl_interpreter"
2539 then
2540 with_perl_bindings="yes"
2541 else
2542 with_perl_bindings="no (no perl interpreter found)"
2543 fi
2544 ])
2545 if test "x$with_perl_bindings" = "xyes"
2546 then
2547 PERL_BINDINGS="perl"
2548 else
2549 PERL_BINDINGS=""
2550 fi
2551 AC_SUBST(PERL_BINDINGS)
2552 AC_SUBST(PERL_BINDINGS_OPTIONS)
2554 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
2556 if test "x$with_rrdtool" = "xyes" \
2557 && test "x$librrd_threadsafe" != "xyes"
2558 then
2559 with_rrdtool="yes (warning: librrd is not thread-safe)"
2560 fi
2562 if test "x$with_liboping" = "xyes" \
2563 && test "x$with_own_liboping" = "xyes"
2564 then
2565 with_liboping="yes (shipped version)"
2566 fi
2568 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
2569 then
2570 with_libiptc="yes (shipped version)"
2571 fi
2573 if test "x$with_libperl" = "xyes"
2574 then
2575 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
2576 else
2577 enable_perl="no (needs libperl)"
2578 fi
2580 if test "x$with_perl_bindings" = "xyes" \
2581 && test "x$PERL_BINDINGS_OPTIONS" != "x"
2582 then
2583 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2584 fi
2586 cat <<EOF;
2588 Configuration:
2589 Libraries:
2590 libcurl . . . . . . $with_libcurl
2591 libiokit . . . . . $with_libiokit
2592 libiptc . . . . . . $with_libiptc
2593 libkstat . . . . . $with_kstat
2594 libkvm . . . . . . $with_libkvm
2595 libmysql . . . . . $with_libmysql
2596 libnetlink . . . . $with_libnetlink
2597 libnetsnmp . . . . $with_libnetsnmp
2598 liboconfig . . . . $with_liboconfig
2599 libopenipmi . . . . $with_libopenipmipthread
2600 liboping . . . . . $with_liboping
2601 libpcap . . . . . . $with_libpcap
2602 libperl . . . . . . $with_libperl
2603 libpthread . . . . $with_libpthread
2604 librrd . . . . . . $with_rrdtool
2605 libsensors . . . . $with_lm_sensors
2606 libstatgrab . . . . $with_libstatgrab
2607 libupsclient . . . $with_libupsclient
2608 libvirt . . . . . . $with_libvirt
2609 libxml2 . . . . . . $with_libxml2
2610 libxmms . . . . . . $with_libxmms
2612 Features:
2613 daemon mode . . . . $enable_daemon
2614 debug . . . . . . . $enable_debug
2616 Bindings:
2617 perl . . . . . . . $with_perl_bindings
2619 Modules:
2620 apache . . . . . . $enable_apache
2621 apcups . . . . . . $enable_apcups
2622 apple_sensors . . . $enable_apple_sensors
2623 ascent . . . . . . $enable_ascent
2624 battery . . . . . . $enable_battery
2625 cpu . . . . . . . . $enable_cpu
2626 cpufreq . . . . . . $enable_cpufreq
2627 csv . . . . . . . . $enable_csv
2628 df . . . . . . . . $enable_df
2629 disk . . . . . . . $enable_disk
2630 dns . . . . . . . . $enable_dns
2631 email . . . . . . . $enable_email
2632 entropy . . . . . . $enable_entropy
2633 exec . . . . . . . $enable_exec
2634 hddtemp . . . . . . $enable_hddtemp
2635 interface . . . . . $enable_interface
2636 iptables . . . . . $enable_iptables
2637 ipmi . . . . . . . $enable_ipmi
2638 ipvs . . . . . . . $enable_ipvs
2639 irq . . . . . . . . $enable_irq
2640 libvirt . . . . . . $enable_libvirt
2641 load . . . . . . . $enable_load
2642 logfile . . . . . . $enable_logfile
2643 mbmon . . . . . . . $enable_mbmon
2644 memcached . . . . . $enable_memcached
2645 memory . . . . . . $enable_memory
2646 multimeter . . . . $enable_multimeter
2647 mysql . . . . . . . $enable_mysql
2648 netlink . . . . . . $enable_netlink
2649 network . . . . . . $enable_network
2650 nfs . . . . . . . . $enable_nfs
2651 nginx . . . . . . . $enable_nginx
2652 ntpd . . . . . . . $enable_ntpd
2653 nut . . . . . . . . $enable_nut
2654 perl . . . . . . . $enable_perl
2655 ping . . . . . . . $enable_ping
2656 powerdns . . . . . $enable_powerdns
2657 processes . . . . . $enable_processes
2658 rrdtool . . . . . . $enable_rrdtool
2659 sensors . . . . . . $enable_sensors
2660 serial . . . . . . $enable_serial
2661 snmp . . . . . . . $enable_snmp
2662 swap . . . . . . . $enable_swap
2663 syslog . . . . . . $enable_syslog
2664 tail . . . . . . . $enable_tail
2665 tape . . . . . . . $enable_tape
2666 tcpconns . . . . . $enable_tcpconns
2667 teamspeak2 . . . . $enable_teamspeak2
2668 unixsock . . . . . $enable_unixsock
2669 users . . . . . . . $enable_users
2670 uuid . . . . . . . $enable_uuid
2671 vmem . . . . . . . $enable_vmem
2672 vserver . . . . . . $enable_vserver
2673 wireless . . . . . $enable_wireless
2674 xmms . . . . . . . $enable_xmms
2676 EOF