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