1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
6 AC_LANG(C)
8 AC_PREFIX_DEFAULT("/opt/collectd")
10 AC_SYS_LARGEFILE
12 #
13 # Checks for programs.
14 #
15 AC_PROG_CC
16 AC_PROG_CPP
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
19 AC_PROG_MAKE_SET
20 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
22 dnl configure libtool
23 AC_DISABLE_STATIC
24 AC_LIBLTDL_CONVENIENCE
25 AC_SUBST(LTDLINCL)
26 AC_SUBST(LIBLTDL)
27 AC_LIBTOOL_DLOPEN
28 AC_PROG_LIBTOOL
29 AC_PROG_LEX
30 AC_PROG_YACC
31 AC_CONFIG_SUBDIRS(libltdl)
33 #
34 # Checks for header files.
35 #
36 AC_HEADER_STDC
37 AC_HEADER_SYS_WAIT
38 AC_HEADER_DIRENT
40 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)
42 # For ping library
43 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
44 [#if HAVE_STDINT_H
45 # include <stdint.h>
46 #endif
47 #if HAVE_SYS_TYPES_H
48 # include <sys/types.h>
49 #endif
50 ])
51 AC_CHECK_HEADERS(netinet/in.h, [], [],
52 [#if HAVE_STDINT_H
53 # include <stdint.h>
54 #endif
55 #if HAVE_SYS_TYPES_H
56 # include <sys/types.h>
57 #endif
58 #if HAVE_NETINET_IN_SYSTM_H
59 # include <netinet/in_systm.h>
60 #endif
61 ])
62 AC_CHECK_HEADERS(netinet/ip.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 #if HAVE_NETINET_IN_SYSTM_H
70 # include <netinet/in_systm.h>
71 #endif
72 #if HAVE_NETINET_IN_H
73 # include <netinet/in.h>
74 #endif
75 ])
76 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
77 [#if HAVE_STDINT_H
78 # include <stdint.h>
79 #endif
80 #if HAVE_SYS_TYPES_H
81 # include <sys/types.h>
82 #endif
83 #if HAVE_NETINET_IN_SYSTM_H
84 # include <netinet/in_systm.h>
85 #endif
86 #if HAVE_NETINET_IN_H
87 # include <netinet/in.h>
88 #endif
89 #if HAVE_NETINET_IP_H
90 # include <netinet/ip.h>
91 #endif
92 ])
93 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
94 [#if HAVE_STDINT_H
95 # include <stdint.h>
96 #endif
97 #if HAVE_SYS_TYPES_H
98 # include <sys/types.h>
99 #endif
100 #if HAVE_NETINET_IN_SYSTM_H
101 # include <netinet/in_systm.h>
102 #endif
103 #if HAVE_NETINET_IN_H
104 # include <netinet/in.h>
105 #endif
106 #if HAVE_NETINET_IP_H
107 # include <netinet/ip.h>
108 #endif
109 ])
110 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
111 [#if HAVE_STDINT_H
112 # include <stdint.h>
113 #endif
114 #if HAVE_SYS_TYPES_H
115 # include <sys/types.h>
116 #endif
117 #if HAVE_NETINET_IN_SYSTM_H
118 # include <netinet/in_systm.h>
119 #endif
120 #if HAVE_NETINET_IN_H
121 # include <netinet/in.h>
122 #endif
123 ])
124 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
125 [#if HAVE_STDINT_H
126 # include <stdint.h>
127 #endif
128 #if HAVE_SYS_TYPES_H
129 # include <sys/types.h>
130 #endif
131 #if HAVE_NETINET_IN_SYSTM_H
132 # include <netinet/in_systm.h>
133 #endif
134 #if HAVE_NETINET_IN_H
135 # include <netinet/in.h>
136 #endif
137 #if HAVE_NETINET_IP6_H
138 # include <netinet/ip6.h>
139 #endif
140 ])
141 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
142 [#if HAVE_STDINT_H
143 # include <stdint.h>
144 #endif
145 #if HAVE_SYS_TYPES_H
146 # include <sys/types.h>
147 #endif
148 #if HAVE_NETINET_IN_SYSTM_H
149 # include <netinet/in_systm.h>
150 #endif
151 #if HAVE_NETINET_IN_H
152 # include <netinet/in.h>
153 #endif
154 #if HAVE_NETINET_IP_H
155 # include <netinet/ip.h>
156 #endif
157 ])
158 AC_CHECK_HEADERS(netinet/udp.h, [], [],
159 [#if HAVE_STDINT_H
160 # include <stdint.h>
161 #endif
162 #if HAVE_SYS_TYPES_H
163 # include <sys/types.h>
164 #endif
165 #if HAVE_NETINET_IN_SYSTM_H
166 # include <netinet/in_systm.h>
167 #endif
168 #if HAVE_NETINET_IN_H
169 # include <netinet/in.h>
170 #endif
171 #if HAVE_NETINET_IP_H
172 # include <netinet/ip.h>
173 #endif
174 ])
176 # For cpu modules
177 AC_CHECK_HEADERS(sys/dkstat.h 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)
178 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
179 [
180 #if HAVE_SYS_TYPES_H
181 # include <sys/types.h>
182 #endif
183 #if HAVE_SYS_PARAM_H
184 # include <sys/param.h>
185 #endif
186 ])
188 # For hddtemp module
189 AC_CHECK_HEADERS(linux/major.h libgen.h)
191 # For the apple_sensors module
192 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
194 # For the battery plugin
195 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
196 [
197 #if HAVE_IOKIT_IOKITLIB_H
198 # include <IOKit/IOKitLib.h>
199 #endif
200 #if HAVE_IOKIT_IOTYPES_H
201 # include <IOKit/IOTypes.h>
202 #endif
203 ])
205 # For the swap module
206 AC_CHECK_HEADERS(sys/swap.h, [], [],
207 [
208 #if HAVE_SYS_TYPES_H
209 # include <sys/types.h>
210 #endif
211 #if HAVE_SYS_PARAM_H
212 # include <sys/param.h>
213 #endif
214 ])
216 # For load module
217 # For the processes plugin
218 # For users module
219 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
221 # For interface plugin
222 AC_CHECK_HEADERS(ifaddrs.h)
223 AC_CHECK_HEADERS(net/if.h, [], [],
224 [
225 #if HAVE_SYS_TYPES_H
226 # include <sys/types.h>
227 #endif
228 #if HAVE_SYS_SOCKET_H
229 # include <sys/socket.h>
230 #endif
231 ])
232 AC_CHECK_HEADERS(linux/if.h, [], [],
233 [
234 #if HAVE_SYS_TYPES_H
235 # include <sys/types.h>
236 #endif
237 #if HAVE_SYS_SOCKET_H
238 # include <sys/socket.h>
239 #endif
240 ])
241 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
242 [
243 #if HAVE_SYS_TYPES_H
244 # include <sys/types.h>
245 #endif
246 #if HAVE_SYS_SOCKET_H
247 # include <sys/socket.h>
248 #endif
249 #if HAVE_LINUX_IF_H
250 # include <linux/if.h>
251 #endif
252 ])
254 # For quota module
255 AC_CHECK_HEADERS(sys/ucred.h, [], [],
256 [
257 #if HAVE_SYS_TYPES_H
258 # include <sys/types.h>
259 #endif
260 #if HAVE_SYS_PARAM_H
261 # include <sys/param.h>
262 #endif
263 ])
265 # For mount interface
266 AC_CHECK_HEADERS(sys/mount.h, [], [],
267 [
268 #if HAVE_SYS_TYPES_H
269 # include <sys/types.h>
270 #endif
271 #if HAVE_SYS_PARAM_H
272 # include <sys/param.h>
273 #endif
274 ])
276 # For the email plugin
277 AC_CHECK_HEADERS(linux/un.h, [], [],
278 [
279 #if HAVE_SYS_SOCKET_H
280 # include <sys/socket.h>
281 #endif
282 ])
284 AC_CHECK_HEADERS(curl/curl.h 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)
286 # For the dns plugin
287 AC_CHECK_HEADERS(arpa/nameser.h)
288 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
289 [
290 #if HAVE_ARPA_NAMESER_H
291 # include <arpa/nameser.h>
292 #endif
293 ])
295 AC_CHECK_HEADERS(net/if_arp.h, [], [],
296 [#if HAVE_SYS_SOCKET_H
297 # include <sys/socket.h>
298 #endif
299 ])
300 AC_CHECK_HEADERS(net/ppp_defs.h)
301 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
302 [#if HAVE_NET_PPP_DEFS_H
303 # include <net/ppp_defs.h>
304 #endif
305 ])
306 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
307 [#if HAVE_STDINT_H
308 # include <stdint.h>
309 #endif
310 #if HAVE_SYS_TYPES_H
311 # include <sys/types.h>
312 #endif
313 #if HAVE_SYS_SOCKET_H
314 # include <sys/socket.h>
315 #endif
316 #if HAVE_NET_IF_H
317 # include <net/if.h>
318 #endif
319 #if HAVE_NETINET_IN_H
320 # include <netinet/in.h>
321 #endif
322 ])
324 # For the multimeter plugin
325 have_termios_h="no"
326 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
328 #
329 # Checking for libraries
330 #
331 AC_CHECK_LIB(m, ext)
333 #
334 # Checks for typedefs, structures, and compiler characteristics.
335 #
336 AC_C_CONST
337 AC_TYPE_PID_T
338 AC_TYPE_SIZE_T
339 AC_TYPE_UID_T
340 AC_HEADER_TIME
342 #
343 # Checks for library functions.
344 #
345 AC_PROG_GCC_TRADITIONAL
346 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
348 AC_CHECK_FUNCS(getpwnam_r)
349 AC_CHECK_FUNCS(getgrnam_r)
351 socket_needs_socket="no"
352 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
353 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
355 nanosleep_needs_rt="no"
356 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
357 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
359 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
361 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
362 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
363 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
364 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
365 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
366 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
367 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
368 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
369 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
370 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
372 # For load module
373 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
375 # Check for NAN
376 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
377 [
378 if test "x$withval" = "xno"; then
379 nan_type="none"
380 else if test "x$withval" = "xyes"; then
381 nan_type="zero"
382 else
383 nan_type="$withval"
384 fi; fi
385 ],
386 [nan_type="none"])
387 if test "x$nan_type" = "xnone"; then
388 AC_CACHE_CHECK([whether NAN is defined by default],
389 [have_nan_default],
390 AC_COMPILE_IFELSE(
391 AC_LANG_PROGRAM(
392 [[
393 #include <stdlib.h>
394 #include <math.h>
395 static float foo = NAN;
396 ]],
397 [[
398 if (isnan (foo))
399 return 0;
400 else
401 return 1;
402 ]]),
403 [have_nan_default="yes"],
404 [have_nan_default="no"]
405 )
406 )
407 if test "x$have_nan_default" = "xyes"
408 then
409 nan_type="default"
410 fi
411 fi
412 if test "x$nan_type" = "xnone"; then
413 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
414 [have_nan_isoc],
415 AC_COMPILE_IFELSE(
416 AC_LANG_PROGRAM(
417 [[
418 #include <stdlib.h>
419 #define __USE_ISOC99 1
420 #include <math.h>
421 static float foo = NAN;
422 ]],
423 [[
424 if (isnan (foo))
425 return 0;
426 else
427 return 1;
428 ]]),
429 [have_nan_isoc="yes"],
430 [have_nan_isoc="no"]
431 )
432 )
433 if test "x$have_nan_isoc" = "xyes"
434 then
435 nan_type="isoc99"
436 fi
437 fi
438 if test "x$nan_type" = "xnone"; then
439 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
440 [have_nan_zero],
441 AC_RUN_IFELSE(
442 AC_LANG_PROGRAM(
443 [[
444 #include <stdlib.h>
445 #include <math.h>
446 #ifdef NAN
447 # undef NAN
448 #endif
449 #define NAN (0.0 / 0.0)
450 #ifndef isnan
451 # define isnan(f) ((f) != (f))
452 #endif
453 static float foo = NAN;
454 ]],
455 [[
456 if (isnan (foo))
457 return 0;
458 else
459 return 1;
460 ]]),
461 [have_nan_zero="yes"],
462 [have_nan_zero="no"]
463 )
464 )
465 if test "x$have_nan_zero" = "xyes"
466 then
467 nan_type="zero"
468 fi
469 fi
471 if test "x$nan_type" = "xdefault"; then
472 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
473 [Define if NAN is defined by default and can initialize static variables.])
474 else if test "x$nan_type" = "xisoc99"; then
475 AC_DEFINE(NAN_STATIC_ISOC, 1,
476 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
477 else if test "x$nan_type" = "xzero"; then
478 AC_DEFINE(NAN_ZERO_ZERO, 1,
479 [Define if NAN can be defined as (0.0 / 0.0)])
480 else
481 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
482 fi; fi; fi
484 # For mount interface
485 #AC_CHECK_FUNCS(getfsent getvfsent)
487 have_getfsstat="no"
488 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
489 have_getvfsstat="no"
490 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
491 have_listmntent="no"
492 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
494 have_getmntent="no"
495 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
496 if test "x$have_getmntent" = "xno"; then
497 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
498 fi
499 if test "x$have_getmntent" = "xno"; then
500 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
501 fi
502 if test "x$have_getmntent" = "xno"; then
503 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
504 fi
506 if test "x$have_getmntent" = "xc"; then
507 AC_CACHE_CHECK([whether getmntent takes one argument],
508 [have_one_getmntent],
509 AC_COMPILE_IFELSE(
510 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
511 #include <mntent.h>
512 #include "$srcdir/src/utils_mount.h"]],
513 [[
514 FILE *fh;
515 struct mntent *me;
516 fh = setmntent ("/etc/mtab", "r");
517 me = getmntent (fh);
518 ]]
519 ),
520 [have_one_getmntent="yes"],
521 [have_one_getmntent="no"]
522 )
523 )
524 AC_CACHE_CHECK([whether getmntent takes two arguments],
525 [have_two_getmntent],
526 AC_COMPILE_IFELSE(
527 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
528 #include <sys/mnttab.h>
529 #include "$srcdir/src/utils_mount.h"]],
530 [[
531 FILE *fh;
532 struct mnttab mt;
533 int status;
534 fh = fopen ("/etc/mnttab", "r");
535 status = getmntent (fh, &mt);
536 ]]
537 ),
538 [have_two_getmntent="yes"],
539 [have_two_getmntent="no"]
540 )
541 )
542 fi
544 # Check for different versions of `getmntent' here..
546 if test "x$have_getmntent" = "xc"; then
547 if test "x$have_one_getmntent" = "xyes"; then
548 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
549 [Define if the function getmntent exists and takes one argument.])
550 fi
551 if test "x$have_two_getmntent" = "xyes"; then
552 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
553 [Define if the function getmntent exists and takes two arguments.])
554 fi
555 fi
556 if test "x$have_getmntent" = "xsun"; then
557 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
558 [Define if the function getmntent exists. It's the version from libsun.])
559 fi
560 if test "x$have_getmntent" = "xseq"; then
561 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
562 [Define if the function getmntent exists. It's the version from libseq.])
563 fi
564 if test "x$have_getmntent" = "xgen"; then
565 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
566 [Define if the function getmntent exists. It's the version from libgen.])
567 fi
569 # Check for structures
570 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
571 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
572 [],
573 [
574 #include <sys/types.h>
575 #include <sys/socket.h>
576 #include <net/if.h>
577 ])
578 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
579 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
580 [],
581 [
582 #include <sys/types.h>
583 #include <sys/socket.h>
584 #include <linux/if.h>
585 #include <linux/netdevice.h>
586 ])
588 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
589 [#if HAVE_STDINT_H
590 # include <stdint.h>
591 #endif
592 #if HAVE_SYS_TYPES_H
593 # include <sys/types.h>
594 #endif
595 #if HAVE_NETINET_IN_SYSTM_H
596 # include <netinet/in_systm.h>
597 #endif
598 #if HAVE_NETINET_IN_H
599 # include <netinet/in.h>
600 #endif
601 #if HAVE_NETINET_IP_H
602 # include <netinet/ip.h>
603 #endif
604 #if HAVE_NETINET_UDP_H
605 # include <netinet/udp.h>
606 #endif
607 ])
608 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
609 [#if HAVE_STDINT_H
610 # include <stdint.h>
611 #endif
612 #if HAVE_SYS_TYPES_H
613 # include <sys/types.h>
614 #endif
615 #if HAVE_NETINET_IN_SYSTM_H
616 # include <netinet/in_systm.h>
617 #endif
618 #if HAVE_NETINET_IN_H
619 # include <netinet/in.h>
620 #endif
621 #if HAVE_NETINET_IP_H
622 # include <netinet/ip.h>
623 #endif
624 #if HAVE_NETINET_UDP_H
625 # include <netinet/udp.h>
626 #endif
627 ])
629 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
630 [],
631 [],
632 [
633 #if HAVE_KSTAT_H
634 # include <kstat.h>
635 #endif
636 ])
638 AC_MSG_CHECKING([for kernel type ($host_os)])
639 case $host_os in
640 *linux*)
641 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
642 ac_system="Linux"
643 ;;
644 *solaris*)
645 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
646 ac_system="Solaris"
647 ;;
648 *)
649 ac_system="unknown"
650 esac
651 AC_MSG_RESULT([$ac_system])
653 with_libresolv="yes"
654 AC_CHECK_LIB(resolv, res_search,
655 [
656 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
657 ],
658 [with_libresolv="no"])
659 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
662 m4_divert_once([HELP_WITH], [
663 collectd additional packages:])
665 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
666 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
667 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
668 then
669 LDFLAGS="$LDFLAGS -L$withval/lib"
670 CPPFLAGS="$CPPFLAGS -I$withval/include"
671 with_rrdtool="yes"
672 fi
673 ], [with_rrdtool="yes"])
674 if test "x$with_rrdtool" = "xyes"
675 then
676 AC_CHECK_LIB(rrd, rrd_update,
677 [
678 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
679 ],
680 [with_rrdtool="no (librrd not found)"], [-lm])
681 fi
682 if test "x$with_rrdtool" = "xyes"
683 then
684 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
685 fi
686 if test "x$with_rrdtool" = "xyes"
687 then
688 collect_rrdtool=1
689 else
690 collect_rrdtool=0
691 fi
692 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
693 [Wether or not to use rrdtool library])
694 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
696 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
697 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
698 then
699 LDFLAGS="$LDFLAGS -L$withval/lib"
700 CPPFLAGS="$CPPFLAGS -I$withval/include"
701 with_libpthread="yes"
702 else
703 if test "x$withval" = "xno"
704 then
705 with_libpthread="no (disabled)"
706 fi
707 fi
708 ], [with_libpthread="yes"])
709 if test "x$with_libpthread" = "xyes"
710 then
711 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
712 fi
713 if test "x$with_libpthread" = "xyes"
714 then
715 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
716 fi
717 if test "x$with_libpthread" = "xyes"
718 then
719 collect_pthread=1
720 else
721 collect_pthread=0
722 fi
723 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
724 [Wether or not to use pthread (POSIX threads) library])
725 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
727 if test "$ac_system" = "Solaris"
728 then
729 with_kstat="yes"
730 with_devinfo="yes"
731 else
732 with_kstat="no (Solaris only)"
733 with_devinfo="no (Solaris only)"
734 fi
736 if test "x$with_kstat" = "xyes"
737 then
738 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
739 fi
740 if test "x$with_kstat" = "xyes"
741 then
742 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
743 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
744 fi
745 if test "x$with_kstat" = "xyes"
746 then
747 AC_DEFINE(HAVE_LIBKSTAT, 1,
748 [Define to 1 if you have the 'kstat' library (-lkstat)])
749 fi
750 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
751 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
753 ### BEGIN of check for libcurl ###
754 with_curl_config="curl-config"
755 with_curl_cflags=""
756 with_curl_libs=""
757 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
758 [
759 if test "x$withval" = "xno"
760 then
761 with_libcurl="no"
762 else if test "x$withval" = "xyes"
763 then
764 with_libcurl="yes"
765 else
766 if test -x "$withval"
767 then
768 with_curl_config="$withval"
769 else if test -x "$withval/bin/curl-config"
770 then
771 with_curl_config="$withval/bin/curl-config"
772 fi; fi
773 fi; fi
774 ],
775 [
776 with_libcurl="yes"
777 ])
778 if test "x$with_libcurl" = "xyes"
779 then
780 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
781 curl_config_status=$?
783 if test $curl_config_status -ne 0
784 then
785 with_libcurl="no"
786 else
787 SAVE_CFLAGS=$CFLAGS
788 CFLAGS="$CFLAGS $with_curl_cflags"
790 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
792 CFLAGS="$SAVE_CFLAGS"
793 fi
794 fi
795 if test "x$with_libcurl" = "xyes"
796 then
797 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
798 curl_config_status=$?
800 if test $curl_config_status -ne 0
801 then
802 with_libcurl="no"
803 else
804 AC_CHECK_LIB(curl, curl_easy_init,
805 [
806 # We need to do this to have `HAVE_LIBCURL' defined but
807 # `-lcurl' NOT added to the default LDFLAGS.
808 AC_DEFINE(HAVE_LIBCURL, 1,
809 [Define to 1 if you have the curl library.])
810 ],
811 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
812 [$with_curl_libs])
813 fi
814 fi
815 if test "x$with_libcurl" = "xyes"
816 then
817 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
818 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
819 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
820 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
821 fi
822 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
823 ### END of check for libcurl ###
825 with_libiokit="no"
826 collectd_libiokit=0
827 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
828 [
829 with_libiokit="yes"
830 collectd_libiokit=1
831 ],
832 [
833 with_libiokit="no"
834 collectd_libiokit=0
835 ])
836 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
837 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
839 with_libstatgrab="yes"
840 with_libdevstat="no"
841 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
842 [
843 if test "x$withval" != "xno" -a "x$withval" != "xyes"
844 then
845 LDFLAGS="$LDFLAGS -L$withval/lib"
846 CPPFLAGS="$CPPFLAGS -I$withval/include"
847 with_libstatgrab="yes"
848 fi
849 ],
850 [
851 if test "x$ac_system" == "xunknown"
852 then
853 with_libstatgrab="yes"
854 else
855 with_libstatgrab="no"
856 fi
857 ])
858 if test "x$with_libstatgrab" = "xyes"
859 then
860 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
861 fi
862 if test "x$with_libstatgrab" = "xyes"
863 then
864 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
865 fi
866 if test "x$with_libstatgrab" = "xyes"
867 then
868 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
869 fi
870 if test "x$with_libstatgrab" = "xyes"
871 then
872 collect_libstatgrab=1
873 else
874 collect_libstatgrab=0
875 fi
876 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
877 [Wether or not to use statgrab library])
878 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
879 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
881 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
882 if test "x$with_libkvm" = "xyes"
883 then
884 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
885 fi
886 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
888 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
889 [
890 if test "x$withval" != "xno" && test "x$withval" != "xyes"
891 then
892 LDFLAGS="$LDFLAGS -L$withval/lib"
893 CPPFLAGS="$CPPFLAGS -I$withval/include"
894 with_lm_sensors="yes"
895 fi
896 ],
897 [
898 if test "x$ac_system" = "xLinux"
899 then
900 with_lm_sensors="yes"
901 else
902 with_lm_sensors="no"
903 fi
904 ])
905 if test "x$with_lm_sensors" = "xyes"
906 then
907 AC_CHECK_LIB(sensors, sensors_init,
908 [
909 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
910 ],
911 [with_lm_sensors="no (libsensors not found)"])
912 fi
913 if test "x$with_lm_sensors" = "xyes"
914 then
915 AC_CHECK_HEADERS(sensors/sensors.h,
916 [
917 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
918 ],
919 [with_lm_sensors="no (sensors/sensors.h not found)"])
920 fi
921 if test "x$with_lm_sensors" = "xyes"
922 then
923 collect_lm_sensors=1
924 else
925 collect_lm_sensors=0
926 fi
927 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
928 [Wether or not to use sensors library])
929 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
931 with_mysql_config="mysql_config"
932 with_mysql_cflags=""
933 with_mysql_libs=""
934 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
935 [
936 if test "x$withval" = "xno"
937 then
938 with_libmysql="no"
939 else if test "x$withval" = "xyes"
940 then
941 with_libmysql="yes"
942 else
943 if test -x "$withval";
944 then
945 with_mysql_config="$withval"
946 else if test -x "$withval/bin/mysql_config"
947 then
948 with_mysql_config="$withval/bin/mysql_config"
949 fi; fi
950 fi; fi
951 ],
952 [
953 with_libmysql="yes"
954 ])
955 if test "x$with_libmysql" = "xyes"
956 then
957 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
958 mysql_config_status=$?
960 if test $mysql_config_status -ne 0
961 then
962 with_libmysql="no"
963 else
964 SAVE_CFLAGS=$CFLAGS
965 CFLAGS="$CFLAGS $with_mysql_cflags"
967 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
969 CFLAGS="$SAVE_CFLAGS"
970 fi
971 fi
972 if test "x$with_libmysql" = "xyes"
973 then
974 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
975 mysql_config_status=$?
977 if test $mysql_config_status -ne 0
978 then
979 with_libmysql="no"
980 else
981 AC_CHECK_LIB(mysqlclient, mysql_init,
982 [
983 # We need to do this to have `HAVE_LIBMYSQLCLIENT' defined
984 # but `-lmysqlclient' NOT added to the default LDFLAGS.
985 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1,
986 [Define to 1 if you have the mysqlclient library.])
987 ],
988 [with_libmysql="no (libmysql not found)"],
989 [$with_mysql_libs])
990 fi
991 fi
992 if test "x$with_libmysql" = "xyes"
993 then
994 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
995 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
996 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
997 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
998 fi
999 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1001 with_own_liboconfig="no"
1002 liboconfig_LDFLAGS="$LDFLAGS"
1003 liboconfig_CPPFLAGS="$CPPFLAGS"
1004 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1005 [
1006 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1007 then
1008 if test -d "$withval/lib"
1009 then
1010 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1011 fi
1012 if test -d "$withval/include"
1013 then
1014 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1015 fi
1016 fi
1017 if test "x$withval" = "xno"
1018 then
1019 AC_MSG_ERROR("liboconfig is required")
1020 fi
1021 ],
1022 [
1023 with_liboconfig="yes"
1024 ])
1026 save_LDFLAGS="$LDFLAGS"
1027 save_CPPFLAGS="$CPPFLAGS"
1028 LDFLAGS="$liboconfig_LDFLAGS"
1029 CPPFLAGS="$liboconfig_CPPFLAGS"
1030 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1031 [
1032 with_liboconfig="yes"
1033 with_own_liboconfig="no"
1034 ],
1035 [
1036 with_liboconfig="yes"
1037 with_own_liboconfig="yes"
1038 LDFLAGS="$save_LDFLAGS"
1039 CPPFLAGS="$save_CPPFLAGS"
1040 ])
1042 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1043 if test "x$with_own_liboconfig" = "xyes"
1044 then
1045 with_liboconfig="yes (shipped version)"
1046 fi
1048 #with_liboping="yes"
1049 with_own_liboping="no"
1050 liboping_LDFLAGS="$LDFLAGS"
1051 liboping_CPPFLAGS="$CPPFLAGS"
1052 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1053 [
1054 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1055 then
1056 if test -d "$withval/lib"
1057 then
1058 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1059 fi
1060 if test -d "$withval/include"
1061 then
1062 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1063 fi
1064 fi
1065 if test "x$withval" = "xno"
1066 then
1067 with_liboping="no"
1068 with_own_liboping="no"
1069 fi
1070 ],
1071 [
1072 #753
1073 with_liboping="yes"
1074 ])
1076 if test "x$with_liboping" = "xyes"
1077 then
1078 save_LDFLAGS="$LDFLAGS"
1079 save_CPPFLAGS="$CPPFLAGS"
1080 LDFLAGS="$liboping_LDFLAGS"
1081 CPPFLAGS="$liboping_CPPFLAGS"
1082 AC_CHECK_LIB(oping, ping_construct,
1083 [
1084 with_liboping="yes"
1085 with_own_liboping="no"
1086 ],
1087 [
1088 with_liboping="yes"
1089 with_own_liboping="yes"
1090 LDFLAGS="$save_LDFLAGS"
1091 CPPFLAGS="$save_CPPFLAGS"
1092 ])
1093 fi
1094 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1095 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1097 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1098 [
1099 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1100 then
1101 LDFLAGS="$LDFLAGS -L$withval/lib"
1102 CPPFLAGS="$CPPFLAGS -I$withval/include"
1103 with_libpcap="yes"
1104 fi
1105 ],
1106 [
1107 with_libpcap="yes"
1108 ])
1109 if test "x$with_libpcap" = "xyes"
1110 then
1111 AC_CHECK_LIB(pcap, pcap_open_live,
1112 [
1113 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1114 ], [with_libpcap="no (libpcap not found)"])
1115 fi
1116 if test "x$with_libpcap" = "xyes"
1117 then
1118 AC_CHECK_HEADERS(pcap.h,
1119 [
1120 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1121 ], [with_libpcap="no (pcap.h not found)"])
1122 fi
1123 if test "x$with_libpcap" = "xyes"
1124 then
1125 collect_libpcap=1
1126 else
1127 collect_libpcap=0
1128 fi
1129 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1130 [Wether or not to use the pcap library])
1131 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1133 perl_interpreter="perl"
1134 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1135 [
1136 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1137 then
1138 LDFLAGS="$LDFLAGS -L$withval/lib"
1139 CPPFLAGS="$CPPFLAGS -I$withval/include"
1140 perl_interpreter="$withval/bin/perl"
1141 with_libperl="yes"
1142 fi
1143 ],
1144 [
1145 with_libperl="yes"
1146 ])
1147 if test "x$with_libperl" = "xyes"
1148 then
1149 SAVE_CFLAGS=$CFLAGS
1150 SAVE_LDFLAGS=$LDFLAGS
1151 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1152 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1153 CFLAGS="$CFLAGS $PERL_CFLAGS"
1154 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1156 AC_CACHE_CHECK([for libperl],
1157 [have_libperl],
1158 AC_LINK_IFELSE(
1159 AC_LANG_PROGRAM(
1160 [[
1161 #include <EXTERN.h>
1162 #include <perl.h>
1163 #include <XSUB.h>
1164 ]],
1165 [[
1166 PerlInterpreter *perl = NULL;
1167 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1168 newSVpv ("Collectd::Plugin::FooBar", 24),
1169 Nullsv);
1170 ]]),
1171 [have_libperl="yes"],
1172 [have_libperl="no"]
1173 )
1174 )
1176 if test "x$have_libperl" = "xyes"
1177 then
1178 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1179 AC_SUBST(PERL_CFLAGS)
1180 AC_SUBST(PERL_LDFLAGS)
1181 else
1182 with_libperl="no"
1183 fi
1185 CFLAGS=$SAVE_CFLAGS
1186 LDFLAGS=$SAVE_LDFLAGS
1187 fi
1188 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1190 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1191 [
1192 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1193 then
1194 LDFLAGS="$LDFLAGS -L$withval/lib"
1195 CPPFLAGS="$CPPFLAGS -I$withval/include"
1196 with_libiptc="yes"
1197 fi
1198 ],
1199 [
1200 if test "x$ac_system" = "xLinux"
1201 then
1202 with_libiptc="yes"
1203 else
1204 with_libiptc="no (Linux only)"
1205 fi
1206 ])
1207 if test "x$with_libiptc" = "xyes"
1208 then
1209 AC_CHECK_LIB(iptc, iptc_init,
1210 [
1211 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1212 ], [with_libiptc="no (libiptc not found)"])
1213 fi
1214 if test "x$with_libiptc" = "xyes"
1215 then
1216 AC_CHECK_HEADERS(libiptc/libiptc.h,
1217 [
1218 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1219 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1220 fi
1221 if test "x$with_libiptc" = "xyes"
1222 then
1223 collect_libiptc=1
1224 else
1225 collect_libiptc=0
1226 fi
1227 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1229 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1230 [
1231 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1232 then
1233 LDFLAGS="$LDFLAGS -L$withval/lib"
1234 CPPFLAGS="$CPPFLAGS -I$withval/include"
1235 with_libnetsnmp="yes"
1236 fi
1237 ],
1238 [with_libnetsnmp="yes"])
1239 if test "x$with_libnetsnmp" = "xyes"
1240 then
1241 AC_CHECK_LIB(netsnmp, init_snmp,
1242 [
1243 AC_DEFINE(HAVE_LIBSNMP, 1, [Define to 1 if you have the Net-SNMP library (-lnetsnmp).])
1244 ], [with_libnetsnmp="no (libnetsnmp not found)"])
1245 fi
1246 if test "x$with_libnetsnmp" = "xyes"
1247 then
1248 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h,
1249 [
1250 AC_DEFINE(HAVE_NET_SNMP_NET_SNMP_CONFIG_H, 1, [Define to 1 if you have the <net-snmp/net-snmp-config.h> header file.])
1251 ], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1252 fi
1253 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1255 with_upsclient_config="libupsclient-config"
1256 with_upsclient_cflags=""
1257 with_upsclient_libs=""
1258 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1259 [
1260 if test "x$withval" = "xno"
1261 then
1262 with_libupsclient="no"
1263 else
1264 with_libupsclient="yes"
1265 if "x$withval" != "xyes"
1266 then
1267 with_upsclient_config="$withval/bin/libupsclient-config"
1268 fi
1269 fi
1270 ],
1271 [
1272 with_libupsclient="yes"
1273 ])
1274 if test "x$with_libupsclient" = "xyes"
1275 then
1276 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1277 upsclient_config_status=$?
1279 if test $upsclient_config_status -ne 0
1280 then
1281 with_libupsclient="no"
1282 fi
1283 fi
1284 if test "x$with_libupsclient" = "xyes"
1285 then
1286 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1287 upsclient_config_status=$?
1289 if test $upsclient_config_status -ne 0
1290 then
1291 with_libupsclient="no"
1292 fi
1293 fi
1294 if test "x$with_libupsclient" = "xyes"
1295 then
1296 CFLAGS_ORIG=$CFLAGS
1297 CFLAGS="$CFLAGS $with_upsclient_cflags"
1298 LDFLAGS_ORIG=$LDFLAGS
1299 LDFLAGS="$LDFLAGS $with_upsclient_libs"
1300 AC_CHECK_LIB(upsclient, upscli_connect,
1301 [
1302 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1303 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1304 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1305 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1306 ],
1307 [
1308 with_libupsclient="no"
1309 ])
1310 CFLAGS=$CFLAGS_ORIG
1311 LDFLAGS=$LDFLAGS_ORIG
1312 fi
1313 if test "x$with_libupsclient" = "xyes"
1314 then
1315 AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
1316 fi
1317 if test "x$with_libupsclient" = "xyes"
1318 then
1319 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1320 [#include <stdlib.h>
1321 #include <stdio.h>
1322 #include <upsclient.h>])
1323 fi
1324 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1326 ### BEGIN of check for libxmms ###
1327 with_xmms_config="xmms-config"
1328 with_xmms_cflags=""
1329 with_xmms_libs=""
1330 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1331 [
1332 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1333 then
1334 if test -x "$withval/bin/xmms-config"
1335 then
1336 with_xmms_config="$withval/bin/xmms-config"
1337 fi
1338 fi
1339 if test "x$withval" = "xno"
1340 then
1341 with_libxmms="no"
1342 else
1343 with_libxmms="yes"
1344 fi
1345 ],
1346 [
1347 with_libxmms="yes"
1348 ])
1349 if test "x$with_libxmms" = "xyes"
1350 then
1351 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1352 xmms_config_status=$?
1354 if test $xmms_config_status -ne 0
1355 then
1356 with_libxmms="no"
1357 fi
1358 fi
1359 if test "x$with_libxmms" = "xyes"
1360 then
1361 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1362 xmms_config_status=$?
1364 if test $xmms_config_status -ne 0
1365 then
1366 with_libxmms="no"
1367 fi
1368 fi
1369 if test "x$with_libxmms" = "xyes"
1370 then
1371 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1372 [
1373 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1374 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1375 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1376 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1377 ],
1378 [
1379 with_libxmms="no"
1380 ],
1381 [$with_xmms_libs])
1382 fi
1383 with_libxmms_numeric=0
1384 if test "x$with_libxmms" = "xyes"
1385 then
1386 with_libxmms_numeric=1
1387 fi
1388 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1389 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1390 ### END of check for libxmms ###
1392 with_libnetlink="yes"
1393 AC_CHECK_LIB(netlink, rtnl_open, [with_libnetlink="yes"], [with_libnetlink="no"])
1395 # Check for enabled/disabled features
1396 #
1398 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1399 # ------------------------------------------------------------
1400 dnl
1401 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1402 dnl
1403 AC_DEFUN(
1404 [AC_COLLECTD],
1405 [
1406 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1407 m4_if(
1408 [$2],
1409 [enable],
1410 [dnl
1411 m4_define([EnDis],[disabled])dnl
1412 m4_define([YesNo],[no])dnl
1413 ],dnl
1414 [m4_if(
1415 [$2],
1416 [disable],
1417 [dnl
1418 m4_define([EnDis],[enabled])dnl
1419 m4_define([YesNo],[yes])dnl
1420 ],
1421 [dnl
1422 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1423 ]dnl
1424 )]dnl
1425 )dnl
1426 m4_if([$3], [feature], [],
1427 [m4_if(
1428 [$3], [module], [],
1429 [dnl
1430 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1431 ]dnl
1432 )]dnl
1433 )dnl
1434 AC_ARG_ENABLE(
1435 [$1],
1436 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1437 [],
1438 enable_$1='[YesNo]'dnl
1439 )# AC_ARG_ENABLE
1440 if test "x$enable_$1" = "xno"
1441 then
1442 collectd_$1=0
1443 else
1444 if test "x$enable_$1" = "xyes"
1445 then
1446 collectd_$1=1
1447 else
1448 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1449 collectd_$1=1
1450 enable_$1='yes'
1451 fi
1452 fi
1453 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1454 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1455 ]dnl
1456 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1458 # AC_PLUGIN(name, default, info)
1459 # ------------------------------------------------------------
1460 dnl
1461 AC_DEFUN(
1462 [AC_PLUGIN],
1463 [
1464 enable_plugin="no"
1465 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1466 [
1467 if test "x$enableval" = "xyes"
1468 then
1469 enable_plugin="yes"
1470 else
1471 enable_plugin="no"
1472 fi
1473 ],
1474 [
1475 if test "x$2" = "xyes"
1476 then
1477 enable_plugin="yes"
1478 else
1479 enable_plugin="no"
1480 fi
1481 ])
1482 if test "x$enable_plugin" = "xyes"
1483 then
1484 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1485 fi
1486 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1487 enable_$1="$enable_plugin"
1488 ]
1489 )# AC_PLUGIN(name, default, info)
1491 m4_divert_once([HELP_ENABLE], [
1492 collectd features:])
1493 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1494 AC_COLLECTD([debug], [enable], [feature], [debugging])
1495 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1496 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1498 plugin_battery="no"
1499 plugin_cpu="no"
1500 plugin_cpufreq="no"
1501 plugin_df="no"
1502 plugin_disk="no"
1503 plugin_entropy="no"
1504 plugin_interface="no"
1505 plugin_irq="no"
1506 plugin_load="no"
1507 plugin_memory="no"
1508 plugin_multimeter="no"
1509 plugin_nfs="no"
1510 plugin_processes="no"
1511 plugin_serial="no"
1512 plugin_swap="no"
1513 plugin_tape="no"
1514 plugin_users="no"
1515 plugin_vserver="no"
1516 plugin_wireless="no"
1518 # Linux
1519 if test "x$ac_system" = "xLinux"
1520 then
1521 plugin_battery="yes"
1522 plugin_cpu="yes"
1523 plugin_cpufreq="yes"
1524 plugin_disk="yes"
1525 plugin_entropy="yes"
1526 plugin_interface="yes"
1527 plugin_irq="yes"
1528 plugin_load="yes"
1529 plugin_memory="yes"
1530 plugin_nfs="yes"
1531 plugin_processes="yes"
1532 plugin_serial="yes"
1533 plugin_swap="yes"
1534 plugin_vserver="yes"
1535 plugin_wireless="yes"
1536 fi
1538 # Mac OS X devices
1539 if test "x$with_libiokit" = "xyes"
1540 then
1541 plugin_battery="yes"
1542 plugin_disk="yes"
1543 fi
1545 # Solaris
1546 if test "x$with_devinfo$with_kstat" = "xyesyes"
1547 then
1548 plugin_cpu="yes"
1549 plugin_disk="yes"
1550 plugin_interface="yes"
1551 plugin_memory="yes"
1552 plugin_swap="yes"
1553 plugin_tape="yes"
1554 fi
1556 # libstatgrab
1557 if test "x$with_libstatgrab" = "xyes"
1558 then
1559 plugin_interface="yes"
1560 plugin_load="yes"
1561 plugin_memory="yes"
1562 plugin_swap="yes"
1563 fi
1565 if test "x$have_processor_info" = "xyes"
1566 then
1567 plugin_cpu="yes"
1568 fi
1569 if test "x$have_sysctlbyname" = "xyes"
1570 then
1571 plugin_cpu="yes"
1572 plugin_memory="yes"
1573 fi
1575 if test "x$have_statfs" = "xyes"
1576 then
1577 plugin_df="yes"
1578 fi
1579 if test "x$have_statvfs" = "xyes"
1580 then
1581 plugin_df="yes"
1582 fi
1584 if test "x$have_getifaddrs" = "xyes"
1585 then
1586 plugin_interface="yes"
1587 fi
1589 if test "x$have_getloadavg" = "xyes"
1590 then
1591 plugin_load="yes"
1592 fi
1594 # Mac OS X memory interface
1595 if test "x$have_host_statistics" = "xyes"
1596 then
1597 plugin_memory="yes"
1598 fi
1600 if test "x$have_termios_h" = "xyes"
1601 then
1602 plugin_multimeter="yes"
1603 fi
1605 if test "x$have_thread_info" = "xyes"
1606 then
1607 plugin_processes="yes"
1608 fi
1610 if test "x$with_libkvm" = "xyes"
1611 then
1612 plugin_swap="yes"
1613 fi
1615 if test "x$have_getutent" = "xyes"
1616 then
1617 plugin_users="yes"
1618 fi
1619 if test "x$have_getutxent" = "xyes"
1620 then
1621 plugin_users="yes"
1622 fi
1624 # FIXME: sysctl for swap plugin
1626 m4_divert_once([HELP_ENABLE], [
1627 collectd plugins:])
1629 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
1630 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
1631 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
1632 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
1633 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
1634 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
1635 AC_PLUGIN([csv], [yes], [CSV output plugin])
1636 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
1637 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
1638 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
1639 AC_PLUGIN([email], [yes], [EMail statistics])
1640 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
1641 AC_PLUGIN([exec], [yes], [Execution of external programs])
1642 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
1643 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
1644 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
1645 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
1646 AC_PLUGIN([load], [$plugin_load], [System load])
1647 AC_PLUGIN([logfile], [yes], [File logging plugin])
1648 AC_PLUGIN([mbmon], [yes], [Query mbmond])
1649 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
1650 AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
1651 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
1652 AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
1653 AC_PLUGIN([network], [yes], [Network communication plugin])
1654 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
1655 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
1656 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
1657 AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
1658 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
1659 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
1660 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
1661 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
1662 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
1663 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
1664 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
1665 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
1666 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
1667 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
1668 AC_PLUGIN([users], [$plugin_users], [User statistics])
1669 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
1670 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
1671 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
1673 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
1675 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1676 then
1677 with_liboping="yes (shipped version)"
1678 fi
1680 if test "x$with_libperl" = "xyes"
1681 then
1682 with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)"
1683 else
1684 enable_perl="no (needs libperl)"
1685 fi
1687 cat <<EOF;
1689 Configuration:
1690 Libraries:
1691 libcurl . . . . . . $with_libcurl
1692 libiokit . . . . . $with_libiokit
1693 libiptc . . . . . . $with_libiptc
1694 libkstat . . . . . $with_kstat
1695 libkvm . . . . . . $with_libkvm
1696 libmysql . . . . . $with_libmysql
1697 libnetsnmp . . . . $with_libnetsnmp
1698 liboconfig . . . . $with_liboconfig
1699 liboping . . . . . $with_liboping
1700 libpcap . . . . . . $with_libpcap
1701 libperl . . . . . . $with_libperl
1702 libpthread . . . . $with_libpthread
1703 librrd . . . . . . $with_rrdtool
1704 libsensors . . . . $with_lm_sensors
1705 libstatgrab . . . . $with_libstatgrab
1706 libupsclient . . . $with_libupsclient
1707 libxmms . . . . . . $with_libxmms
1709 Features:
1710 daemon mode . . . . $enable_daemon
1711 debug . . . . . . . $enable_debug
1713 Modules:
1714 apache . . . . . . $enable_apache
1715 apcups . . . . . . $enable_apcups
1716 apple_sensors . . . $enable_apple_sensors
1717 battery . . . . . . $enable_battery
1718 cpu . . . . . . . . $enable_cpu
1719 cpufreq . . . . . . $enable_cpufreq
1720 csv . . . . . . . . $enable_csv
1721 df . . . . . . . . $enable_df
1722 disk . . . . . . . $enable_disk
1723 dns . . . . . . . . $enable_dns
1724 email . . . . . . . $enable_email
1725 entropy . . . . . . $enable_entropy
1726 exec . . . . . . . $enable_exec
1727 hddtemp . . . . . . $enable_hddtemp
1728 interface . . . . . $enable_interface
1729 iptables . . . . . $enable_iptables
1730 irq . . . . . . . . $enable_irq
1731 load . . . . . . . $enable_load
1732 logfile . . . . . . $enable_logfile
1733 mbmon . . . . . . . $enable_mbmon
1734 memory . . . . . . $enable_memory
1735 multimeter . . . . $enable_multimeter
1736 mysql . . . . . . . $enable_mysql
1737 netlink . . . . . . $enable_network
1738 network . . . . . . $enable_network
1739 nfs . . . . . . . . $enable_nfs
1740 ntpd . . . . . . . $enable_ntpd
1741 nut . . . . . . . . $enable_nut
1742 perl . . . . . . . $enable_perl
1743 ping . . . . . . . $enable_ping
1744 processes . . . . . $enable_processes
1745 sensors . . . . . . $enable_sensors
1746 serial . . . . . . $enable_serial
1747 snmp . . . . . . . $enable_snmp
1748 swap . . . . . . . $enable_swap
1749 syslog . . . . . . $enable_syslog
1750 tape . . . . . . . $enable_tape
1751 unixsock . . . . . $enable_unixsock
1752 users . . . . . . . $enable_users
1753 vserver . . . . . . $enable_vserver
1754 wireless . . . . . $enable_wireless
1755 xmms . . . . . . . $enable_xmms
1757 EOF