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