1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 4.0.4)
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)
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/sysctl.h 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)
179 # For hddtemp module
180 AC_CHECK_HEADERS(linux/major.h libgen.h)
182 # For the apple_sensors module
183 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
185 # For the battery plugin
186 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
187 [
188 #if HAVE_IOKIT_IOKITLIB_H
189 # include <IOKit/IOKitLib.h>
190 #endif
191 #if HAVE_IOKIT_IOTYPES_H
192 # include <IOKit/IOTypes.h>
193 #endif
194 ])
196 # For load module
197 # For the processes plugin
198 # For the swap module
199 # For users module
200 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h sys/swap.h utmp.h utmpx.h)
202 # For interface plugin
203 AC_CHECK_HEADERS(ifaddrs.h)
204 AC_CHECK_HEADERS(net/if.h, [], [],
205 [
206 #if HAVE_SYS_TYPES_H
207 # include <sys/types.h>
208 #endif
209 #if HAVE_SYS_SOCKET_H
210 # include <sys/socket.h>
211 #endif
212 ])
213 AC_CHECK_HEADERS(linux/if.h, [], [],
214 [
215 #if HAVE_SYS_TYPES_H
216 # include <sys/types.h>
217 #endif
218 #if HAVE_SYS_SOCKET_H
219 # include <sys/socket.h>
220 #endif
221 ])
222 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
223 [
224 #if HAVE_SYS_TYPES_H
225 # include <sys/types.h>
226 #endif
227 #if HAVE_SYS_SOCKET_H
228 # include <sys/socket.h>
229 #endif
230 #if HAVE_LINUX_IF_H
231 # include <linux/if.h>
232 #endif
233 ])
235 # For apache plugin
236 # For mount interface
237 # For the dns plugin
238 AC_CHECK_HEADERS(curl/curl.h pwd.h grp.h sys/un.h sys/ucred.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/mount.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h arpa/nameser.h arpa/nameser_compat.h)
240 AC_CHECK_HEADERS(net/if_arp.h, [], [],
241 [#if HAVE_SYS_SOCKET_H
242 # include <sys/socket.h>
243 #endif
244 ])
245 AC_CHECK_HEADERS(net/ppp_defs.h)
246 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
247 [#if HAVE_NET_PPP_DEFS_H
248 # include <net/ppp_defs.h>
249 #endif
250 ])
251 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
252 [#if HAVE_STDINT_H
253 # include <stdint.h>
254 #endif
255 #if HAVE_SYS_TYPES_H
256 # include <sys/types.h>
257 #endif
258 #if HAVE_SYS_SOCKET_H
259 # include <sys/socket.h>
260 #endif
261 #if HAVE_NET_IF_H
262 # include <net/if.h>
263 #endif
264 #if HAVE_NETINET_IN_H
265 # include <netinet/in.h>
266 #endif
267 ])
269 # For the multimeter plugin
270 AC_CHECK_HEADERS(termios.h sys/ioctl.h)
272 #
273 # Checking for libraries
274 #
275 AC_CHECK_LIB(m, ext)
277 #
278 # Checks for typedefs, structures, and compiler characteristics.
279 #
280 AC_C_CONST
281 AC_TYPE_PID_T
282 AC_TYPE_SIZE_T
283 AC_TYPE_UID_T
284 AC_HEADER_TIME
286 #
287 # Checks for library functions.
288 #
289 AC_PROG_GCC_TRADITIONAL
290 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
292 socket_needs_socket="no"
293 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
294 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
296 nanosleep_needs_rt="no"
297 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
298 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
300 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
302 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
303 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
304 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
305 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
306 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
307 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
308 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
309 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
310 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
311 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
313 # For load module
314 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
316 # Check for NAN
317 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
318 [
319 if test "x$withval" = "xno"; then
320 nan_type="none"
321 else if test "x$withval" = "xyes"; then
322 nan_type="zero"
323 else
324 nan_type="$withval"
325 fi; fi
326 ],
327 [nan_type="none"])
328 if test "x$nan_type" = "xnone"; then
329 AC_CACHE_CHECK([whether NAN is defined by default],
330 [have_nan_default],
331 AC_COMPILE_IFELSE(
332 AC_LANG_PROGRAM(
333 [[
334 #include <stdlib.h>
335 #include <math.h>
336 static float foo = NAN;
337 ]],
338 [[
339 if (isnan (foo))
340 return 0;
341 else
342 return 1;
343 ]]),
344 [have_nan_default="yes"],
345 [have_nan_default="no"]
346 )
347 )
348 if test "x$have_nan_default" = "xyes"
349 then
350 nan_type="default"
351 fi
352 fi
353 if test "x$nan_type" = "xnone"; then
354 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
355 [have_nan_isoc],
356 AC_COMPILE_IFELSE(
357 AC_LANG_PROGRAM(
358 [[
359 #include <stdlib.h>
360 #define __USE_ISOC99 1
361 #include <math.h>
362 static float foo = NAN;
363 ]],
364 [[
365 if (isnan (foo))
366 return 0;
367 else
368 return 1;
369 ]]),
370 [have_nan_isoc="yes"],
371 [have_nan_isoc="no"]
372 )
373 )
374 if test "x$have_nan_isoc" = "xyes"
375 then
376 nan_type="isoc99"
377 fi
378 fi
379 if test "x$nan_type" = "xnone"; then
380 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
381 [have_nan_zero],
382 AC_RUN_IFELSE(
383 AC_LANG_PROGRAM(
384 [[
385 #include <stdlib.h>
386 #include <math.h>
387 #ifdef NAN
388 # undef NAN
389 #endif
390 #define NAN (0.0 / 0.0)
391 #ifndef isnan
392 # define isnan(f) ((f) != (f))
393 #endif
394 static float foo = NAN;
395 ]],
396 [[
397 if (isnan (foo))
398 return 0;
399 else
400 return 1;
401 ]]),
402 [have_nan_zero="yes"],
403 [have_nan_zero="no"]
404 )
405 )
406 if test "x$have_nan_zero" = "xyes"
407 then
408 nan_type="zero"
409 fi
410 fi
412 if test "x$nan_type" = "xdefault"; then
413 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
414 [Define if NAN is defined by default and can initialize static variables.])
415 else if test "x$nan_type" = "xisoc99"; then
416 AC_DEFINE(NAN_STATIC_ISOC, 1,
417 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
418 else if test "x$nan_type" = "xzero"; then
419 AC_DEFINE(NAN_ZERO_ZERO, 1,
420 [Define if NAN can be defined as (0.0 / 0.0)])
421 else
422 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
423 fi; fi; fi
425 # For mount interface
426 #AC_CHECK_FUNCS(getfsent getvfsent)
428 have_getfsstat="no"
429 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
430 have_getvfsstat="no"
431 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
432 have_listmntent="no"
433 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
435 have_getmntent="no"
436 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
437 if test "x$have_getmntent" = "xno"; then
438 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
439 fi
440 if test "x$have_getmntent" = "xno"; then
441 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
442 fi
443 if test "x$have_getmntent" = "xno"; then
444 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
445 fi
447 if test "x$have_getmntent" = "xc"; then
448 AC_CACHE_CHECK([whether getmntent takes one argument],
449 [have_one_getmntent],
450 AC_COMPILE_IFELSE(
451 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
452 #include <mntent.h>
453 #include "$srcdir/src/utils_mount.h"]],
454 [[
455 FILE *fh;
456 struct mntent *me;
457 fh = setmntent ("/etc/mtab", "r");
458 me = getmntent (fh);
459 ]]
460 ),
461 [have_one_getmntent="yes"],
462 [have_one_getmntent="no"]
463 )
464 )
465 AC_CACHE_CHECK([whether getmntent takes two arguments],
466 [have_two_getmntent],
467 AC_COMPILE_IFELSE(
468 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
469 #include <sys/mnttab.h>
470 #include "$srcdir/src/utils_mount.h"]],
471 [[
472 FILE *fh;
473 struct mnttab mt;
474 int status;
475 fh = fopen ("/etc/mnttab", "r");
476 status = getmntent (fh, &mt);
477 ]]
478 ),
479 [have_two_getmntent="yes"],
480 [have_two_getmntent="no"]
481 )
482 )
483 fi
485 # Check for different versions of `getmntent' here..
487 if test "x$have_getmntent" = "xc"; then
488 if test "x$have_one_getmntent" = "xyes"; then
489 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
490 [Define if the function getmntent exists and takes one argument.])
491 fi
492 if test "x$have_two_getmntent" = "xyes"; then
493 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
494 [Define if the function getmntent exists and takes two arguments.])
495 fi
496 fi
497 if test "x$have_getmntent" = "xsun"; then
498 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
499 [Define if the function getmntent exists. It's the version from libsun.])
500 fi
501 if test "x$have_getmntent" = "xseq"; then
502 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
503 [Define if the function getmntent exists. It's the version from libseq.])
504 fi
505 if test "x$have_getmntent" = "xgen"; then
506 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
507 [Define if the function getmntent exists. It's the version from libgen.])
508 fi
510 # Check for structures
511 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
512 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
513 [],
514 [
515 #include <sys/types.h>
516 #include <sys/socket.h>
517 #include <net/if.h>
518 ])
519 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
520 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
521 [],
522 [
523 #include <sys/types.h>
524 #include <sys/socket.h>
525 #include <linux/if.h>
526 #include <linux/netdevice.h>
527 ])
529 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
530 [#if HAVE_STDINT_H
531 # include <stdint.h>
532 #endif
533 #if HAVE_SYS_TYPES_H
534 # include <sys/types.h>
535 #endif
536 #if HAVE_NETINET_IN_SYSTM_H
537 # include <netinet/in_systm.h>
538 #endif
539 #if HAVE_NETINET_IN_H
540 # include <netinet/in.h>
541 #endif
542 #if HAVE_NETINET_IP_H
543 # include <netinet/ip.h>
544 #endif
545 #if HAVE_NETINET_UDP_H
546 # include <netinet/udp.h>
547 #endif
548 ])
549 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
550 [#if HAVE_STDINT_H
551 # include <stdint.h>
552 #endif
553 #if HAVE_SYS_TYPES_H
554 # include <sys/types.h>
555 #endif
556 #if HAVE_NETINET_IN_SYSTM_H
557 # include <netinet/in_systm.h>
558 #endif
559 #if HAVE_NETINET_IN_H
560 # include <netinet/in.h>
561 #endif
562 #if HAVE_NETINET_IP_H
563 # include <netinet/ip.h>
564 #endif
565 #if HAVE_NETINET_UDP_H
566 # include <netinet/udp.h>
567 #endif
568 ])
570 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
571 [],
572 [],
573 [
574 #if HAVE_KSTAT_H
575 # include <kstat.h>
576 #endif
577 ])
579 AC_MSG_CHECKING([for kernel type ($host_os)])
580 case $host_os in
581 *linux*)
582 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
583 ac_system="Linux"
584 ;;
585 *solaris*)
586 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
587 ac_system="Solaris"
588 ;;
589 *)
590 ac_system="unknown"
591 esac
592 AC_MSG_RESULT([$ac_system])
594 with_libresolv="yes"
595 AC_CHECK_LIB(resolv, res_search,
596 [
597 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
598 ],
599 [with_libresolv="no"])
600 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
603 m4_divert_once([HELP_WITH], [
604 collectd additional packages:])
606 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
607 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
608 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
609 then
610 LDFLAGS="$LDFLAGS -L$withval/lib"
611 CPPFLAGS="$CPPFLAGS -I$withval/include"
612 with_rrdtool="yes"
613 fi
614 ], [with_rrdtool="yes"])
615 if test "x$with_rrdtool" = "xyes"
616 then
617 AC_CHECK_LIB(rrd, rrd_update,
618 [
619 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
620 ],
621 [with_rrdtool="no (librrd not found)"], [-lm])
622 fi
623 if test "x$with_rrdtool" = "xyes"
624 then
625 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
626 fi
627 if test "x$with_rrdtool" = "xyes"
628 then
629 collect_rrdtool=1
630 else
631 collect_rrdtool=0
632 fi
633 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
634 [Wether or not to use rrdtool library])
635 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
637 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
638 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
639 then
640 LDFLAGS="$LDFLAGS -L$withval/lib"
641 CPPFLAGS="$CPPFLAGS -I$withval/include"
642 with_libpthread="yes"
643 else
644 if test "x$withval" = "xno"
645 then
646 with_libpthread="no (disabled)"
647 fi
648 fi
649 ], [with_libpthread="yes"])
650 if test "x$with_libpthread" = "xyes"
651 then
652 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
653 fi
654 if test "x$with_libpthread" = "xyes"
655 then
656 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
657 fi
658 if test "x$with_libpthread" = "xyes"
659 then
660 collect_pthread=1
661 else
662 collect_pthread=0
663 fi
664 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
665 [Wether or not to use pthread (POSIX threads) library])
666 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
668 if test "$ac_system" = "Solaris"
669 then
670 with_kstat="yes"
671 with_devinfo="yes"
672 else
673 with_kstat="no (Solaris only)"
674 with_devinfo="no (Solaris only)"
675 fi
677 if test "x$with_kstat" = "xyes"
678 then
679 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
680 fi
681 if test "x$with_kstat" = "xyes"
682 then
683 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
684 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
685 fi
686 if test "x$with_kstat" = "xyes"
687 then
688 AC_DEFINE(HAVE_LIBKSTAT, 1,
689 [Define to 1 if you have the 'kstat' library (-lkstat)])
690 fi
691 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
692 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
694 ### BEGIN of check for libcurl ###
695 with_curl_config="curl-config"
696 with_curl_prefix=0
697 with_curl_libs=""
698 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
699 [
700 if test "x$withval" != "xno" -a "x$withval" != "xyes"
701 then
702 if test -x "$withval/bin/curl-config"
703 then
704 with_curl_config="$withval/bin/curl-config"
705 with_curl_prefix=1
706 fi
707 fi
708 if test "x$withval" = "xno"
709 then
710 with_libcurl="no"
711 else
712 with_libcurl="yes"
713 fi
714 ],
715 [
716 with_libcurl="yes"
717 ])
718 if test "x$with_libcurl" = "xyes"
719 then
720 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
721 curl_config_status=$?
723 if test $curl_config_status -ne 0
724 then
725 with_libcurl="no"
726 else
727 AC_CHECK_LIB(curl, curl_easy_init,
728 [
729 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
730 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
731 ],
732 [
733 with_libcurl="no"
734 ],
735 [$with_curl_libs])
736 fi
737 fi
738 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
739 then
740 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
741 curl_config_status=$?
743 if test $curl_config_status -ne 0
744 then
745 with_libcurl="no"
746 else
747 if test -d "$with_curl_prefix/include"
748 then
749 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
750 fi
751 fi
752 fi
754 with_libcurl_numeric=0
755 if test "x$with_libcurl" = "xyes"
756 then
757 with_libcurl_numeric=1
758 fi
759 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
760 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
761 ### END of check for libcurl ###
763 with_libiokit="no"
764 collectd_libiokit=0
765 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
766 [
767 with_libiokit="yes"
768 collectd_libiokit=1
769 ],
770 [
771 with_libiokit="no"
772 collectd_libiokit=0
773 ])
774 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
775 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
777 with_libstatgrab="yes"
778 with_libdevstat="no"
779 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
780 [
781 if test "x$withval" != "xno" -a "x$withval" != "xyes"
782 then
783 LDFLAGS="$LDFLAGS -L$withval/lib"
784 CPPFLAGS="$CPPFLAGS -I$withval/include"
785 with_libstatgrab="yes"
786 fi
787 ],
788 [
789 if test "x$ac_system" == "xunknown"
790 then
791 with_libstatgrab="yes"
792 else
793 with_libstatgrab="no"
794 fi
795 ])
796 if test "x$with_libstatgrab" = "xyes"
797 then
798 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
799 fi
800 if test "x$with_libstatgrab" = "xyes"
801 then
802 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
803 fi
804 if test "x$with_libstatgrab" = "xyes"
805 then
806 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
807 fi
808 if test "x$with_libstatgrab" = "xyes"
809 then
810 collect_libstatgrab=1
811 else
812 collect_libstatgrab=0
813 fi
814 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
815 [Wether or not to use statgrab library])
816 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
817 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
819 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
820 if test "x$with_libkvm" = "xyes"
821 then
822 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
823 fi
824 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
826 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
827 [
828 if test "x$withval" != "xno" && test "x$withval" != "xyes"
829 then
830 LDFLAGS="$LDFLAGS -L$withval/lib"
831 CPPFLAGS="$CPPFLAGS -I$withval/include"
832 with_lm_sensors="yes"
833 fi
834 ],
835 [
836 if test "x$ac_system" = "xLinux"
837 then
838 with_lm_sensors="yes"
839 else
840 with_lm_sensors="no"
841 fi
842 ])
843 if test "x$with_lm_sensors" = "xyes"
844 then
845 AC_CHECK_LIB(sensors, sensors_init,
846 [
847 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
848 ],
849 [with_lm_sensors="no (libsensors not found)"])
850 fi
851 if test "x$with_lm_sensors" = "xyes"
852 then
853 AC_CHECK_HEADERS(sensors/sensors.h,
854 [
855 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
856 ],
857 [with_lm_sensors="no (sensors/sensors.h not found)"])
858 fi
859 if test "x$with_lm_sensors" = "xyes"
860 then
861 collect_lm_sensors=1
862 else
863 collect_lm_sensors=0
864 fi
865 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
866 [Wether or not to use sensors library])
867 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
869 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
870 [
871 if test "x$withval" != "xno" && test "x$withval" != "xyes"
872 then
873 LDFLAGS="$LDFLAGS -L$withval/lib"
874 CPPFLAGS="$CPPFLAGS -I$withval/include"
875 with_libmysql="yes"
876 fi
877 ],
878 [
879 with_libmysql="yes"
880 ])
881 if test "x$with_libmysql" = "xyes"
882 then
883 AC_CHECK_LIB(mysqlclient, mysql_init,
884 [
885 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
886 ], [with_libmysql="no (libmysql not found)"])
887 fi
888 if test "x$with_libmysql" = "xyes"
889 then
890 AC_CHECK_HEADERS(mysql/mysql.h,
891 [
892 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
893 ], [with_libmysql="no (mysql/mysql.h not found)"])
894 fi
895 if test "x$with_libmysql" = "xyes"
896 then
897 collect_libmysql=1
898 else
899 collect_libmysql=0
900 fi
901 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
902 [Wether or not to use mysql library])
903 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
905 with_own_liboconfig="no"
906 liboconfig_LDFLAGS="$LDFLAGS"
907 liboconfig_CPPFLAGS="$CPPFLAGS"
908 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
909 [
910 if test "x$withval" != "xno" && test "x$withval" != "xyes"
911 then
912 if test -d "$withval/lib"
913 then
914 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
915 fi
916 if test -d "$withval/include"
917 then
918 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
919 fi
920 fi
921 if test "x$withval" = "xno"
922 then
923 AC_MSG_ERROR("liboconfig is required")
924 fi
925 ],
926 [
927 with_liboconfig="yes"
928 ])
930 save_LDFLAGS="$LDFLAGS"
931 save_CPPFLAGS="$CPPFLAGS"
932 LDFLAGS="$liboconfig_LDFLAGS"
933 CPPFLAGS="$liboconfig_CPPFLAGS"
934 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
935 [
936 with_liboconfig="yes"
937 with_own_liboconfig="no"
938 ],
939 [
940 with_liboconfig="yes"
941 with_own_liboconfig="yes"
942 LDFLAGS="$save_LDFLAGS"
943 CPPFLAGS="$save_CPPFLAGS"
944 ])
946 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
947 if test "x$with_own_liboconfig" = "xyes"
948 then
949 with_liboconfig="yes (shipped version)"
950 fi
952 #with_liboping="yes"
953 with_own_liboping="no"
954 liboping_LDFLAGS="$LDFLAGS"
955 liboping_CPPFLAGS="$CPPFLAGS"
956 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
957 [
958 if test "x$withval" != "xno" && test "x$withval" != "xyes"
959 then
960 if test -d "$withval/lib"
961 then
962 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
963 fi
964 if test -d "$withval/include"
965 then
966 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
967 fi
968 fi
969 if test "x$withval" = "xno"
970 then
971 with_liboping="no"
972 with_own_liboping="no"
973 fi
974 ],
975 [
976 #753
977 with_liboping="yes"
978 ])
980 if test "x$with_liboping" = "xyes"
981 then
982 save_LDFLAGS="$LDFLAGS"
983 save_CPPFLAGS="$CPPFLAGS"
984 LDFLAGS="$liboping_LDFLAGS"
985 CPPFLAGS="$liboping_CPPFLAGS"
986 AC_CHECK_LIB(oping, ping_construct,
987 [
988 with_liboping="yes"
989 with_own_liboping="no"
990 ],
991 [
992 with_liboping="yes"
993 with_own_liboping="yes"
994 LDFLAGS="$save_LDFLAGS"
995 CPPFLAGS="$save_CPPFLAGS"
996 ])
997 fi
998 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
999 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1001 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1002 [
1003 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1004 then
1005 LDFLAGS="$LDFLAGS -L$withval/lib"
1006 CPPFLAGS="$CPPFLAGS -I$withval/include"
1007 with_libpcap="yes"
1008 fi
1009 ],
1010 [
1011 with_libpcap="yes"
1012 ])
1013 if test "x$with_libpcap" = "xyes"
1014 then
1015 AC_CHECK_LIB(pcap, pcap_open_live,
1016 [
1017 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1018 ], [with_libpcap="no (libpcap not found)"])
1019 fi
1020 if test "x$with_libpcap" = "xyes"
1021 then
1022 AC_CHECK_HEADERS(pcap.h,
1023 [
1024 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1025 ], [with_libpcap="no (pcap.h not found)"])
1026 fi
1027 if test "x$with_libpcap" = "xyes"
1028 then
1029 collect_libpcap=1
1030 else
1031 collect_libpcap=0
1032 fi
1033 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1034 [Wether or not to use the pcap library])
1035 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1037 perl_interpreter="perl"
1038 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1039 [
1040 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1041 then
1042 LDFLAGS="$LDFLAGS -L$withval/lib"
1043 CPPFLAGS="$CPPFLAGS -I$withval/include"
1044 perl_interpreter="$withval/bin/perl"
1045 with_libperl="yes"
1046 fi
1047 ],
1048 [
1049 with_libperl="yes"
1050 ])
1051 if test "x$with_libperl" = "xyes"
1052 then
1053 SAVE_CFLAGS=$CFLAGS
1054 SAVE_LDFLAGS=$LDFLAGS
1055 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1056 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1057 CFLAGS="$CFLAGS $PERL_CFLAGS"
1058 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1060 AC_CACHE_CHECK([for libperl],
1061 [have_libperl],
1062 AC_LINK_IFELSE(
1063 AC_LANG_PROGRAM(
1064 [[
1065 #include <EXTERN.h>
1066 #include <perl.h>
1067 #include <XSUB.h>
1068 ]],
1069 [[
1070 PerlInterpreter *perl = NULL;
1071 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1072 newSVpv ("Collectd::Plugin::FooBar", 24),
1073 Nullsv);
1074 ]]),
1075 [have_libperl="yes"],
1076 [have_libperl="no"]
1077 )
1078 )
1080 if test "x$have_libperl" = "xyes"
1081 then
1082 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1083 AC_SUBST(PERL_CFLAGS)
1084 AC_SUBST(PERL_LDFLAGS)
1085 else
1086 with_libperl="no"
1087 fi
1089 CFLAGS=$SAVE_CFLAGS
1090 LDFLAGS=$SAVE_LDFLAGS
1091 fi
1092 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1094 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1095 [
1096 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1097 then
1098 LDFLAGS="$LDFLAGS -L$withval/lib"
1099 CPPFLAGS="$CPPFLAGS -I$withval/include"
1100 with_libiptc="yes"
1101 fi
1102 ],
1103 [
1104 if test "x$ac_system" = "xLinux"
1105 then
1106 with_libiptc="yes"
1107 else
1108 with_libiptc="no (Linux only)"
1109 fi
1110 ])
1111 if test "x$with_libiptc" = "xyes"
1112 then
1113 AC_CHECK_LIB(iptc, iptc_init,
1114 [
1115 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1116 ], [with_libiptc="no (libiptc not found)"])
1117 fi
1118 if test "x$with_libiptc" = "xyes"
1119 then
1120 AC_CHECK_HEADERS(libiptc/libiptc.h,
1121 [
1122 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1123 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1124 fi
1125 if test "x$with_libiptc" = "xyes"
1126 then
1127 collect_libiptc=1
1128 else
1129 collect_libiptc=0
1130 fi
1131 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1133 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1134 [
1135 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1136 then
1137 LDFLAGS="$LDFLAGS -L$withval/lib"
1138 CPPFLAGS="$CPPFLAGS -I$withval/include"
1139 with_libnetsnmp="yes"
1140 fi
1141 ],
1142 [with_libnetsnmp="yes"])
1143 if test "x$with_libnetsnmp" = "xyes"
1144 then
1145 AC_CHECK_LIB(netsnmp, init_snmp,
1146 [
1147 AC_DEFINE(HAVE_LIBSNMP, 1, [Define to 1 if you have the Net-SNMP library (-lnetsnmp).])
1148 ], [with_libnetsnmp="no (libnetsnmp not found)"])
1149 fi
1150 if test "x$with_libnetsnmp" = "xyes"
1151 then
1152 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h,
1153 [
1154 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.])
1155 ], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1156 fi
1157 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1159 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1160 [
1161 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1162 then
1163 LDFLAGS="$LDFLAGS -L$withval/lib"
1164 CPPFLAGS="$CPPFLAGS -I$withval/include"
1165 with_libupsclient="yes"
1166 fi
1167 ],
1168 [
1169 with_libupsclient="yes"
1170 ])
1171 if test "x$with_libupsclient" = "xyes"
1172 then
1173 AC_CHECK_LIB(upsclient, upscli_connect,
1174 [
1175 AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
1176 ], [with_libupsclient="no (libupsclient not found)"])
1177 fi
1178 if test "x$with_libupsclient" = "xyes"
1179 then
1180 AC_CHECK_HEADERS(upsclient.h,
1181 [
1182 AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the <upsclient.h> header file.])
1183 ], [with_libupsclient="no (upsclient.h not found)"])
1184 fi
1185 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1187 ### BEGIN of check for libxmms ###
1188 with_xmms_config="xmms-config"
1189 with_xmms_prefix=0
1190 with_xmms_cflags=""
1191 with_xmms_libs=""
1192 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1193 [
1194 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1195 then
1196 if test -x "$withval/bin/xmms-config"
1197 then
1198 with_xmms_config="$withval/bin/xmms-config"
1199 with_xmms_prefix=1
1200 fi
1201 fi
1202 if test "x$withval" = "xno"
1203 then
1204 with_libxmms="no"
1205 else
1206 with_libxmms="yes"
1207 fi
1208 ],
1209 [
1210 with_libxmms="yes"
1211 ])
1212 if test "x$with_libxmms" = "xyes"
1213 then
1214 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1215 xmms_config_status=$?
1217 if test $xmms_config_status -ne 0
1218 then
1219 with_libxmms="no"
1220 fi
1221 fi
1222 if test "x$with_libxmms" = "xyes"
1223 then
1224 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1225 xmms_config_status=$?
1227 if test $xmms_config_status -ne 0
1228 then
1229 with_libxmms="no"
1230 fi
1231 fi
1232 if test "x$with_libxmms" = "xyes"
1233 then
1234 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1235 [
1236 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1237 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1238 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1239 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1240 ],
1241 [
1242 with_libxmms="no"
1243 ],
1244 [$with_xmms_libs])
1245 fi
1246 with_libxmms_numeric=0
1247 if test "x$with_libxmms" = "xyes"
1248 then
1249 with_libxmms_numeric=1
1250 fi
1251 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1252 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1253 ### END of check for libxmms ###
1255 # Check for enabled/disabled features
1256 #
1258 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1259 # ------------------------------------------------------------
1260 dnl
1261 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1262 dnl
1263 AC_DEFUN(
1264 [AC_COLLECTD],
1265 [
1266 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1267 m4_if(
1268 [$2],
1269 [enable],
1270 [dnl
1271 m4_define([EnDis],[disabled])dnl
1272 m4_define([YesNo],[no])dnl
1273 ],dnl
1274 [m4_if(
1275 [$2],
1276 [disable],
1277 [dnl
1278 m4_define([EnDis],[enabled])dnl
1279 m4_define([YesNo],[yes])dnl
1280 ],
1281 [dnl
1282 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1283 ]dnl
1284 )]dnl
1285 )dnl
1286 m4_if([$3], [feature], [],
1287 [m4_if(
1288 [$3], [module], [],
1289 [dnl
1290 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1291 ]dnl
1292 )]dnl
1293 )dnl
1294 AC_ARG_ENABLE(
1295 [$1],
1296 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1297 [],
1298 enable_$1='[YesNo]'dnl
1299 )# AC_ARG_ENABLE
1300 if test "x$enable_$1" = "xno"
1301 then
1302 collectd_$1=0
1303 else
1304 if test "x$enable_$1" = "xyes"
1305 then
1306 collectd_$1=1
1307 else
1308 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1309 collectd_$1=1
1310 enable_$1='yes'
1311 fi
1312 fi
1313 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1314 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1315 ]dnl
1316 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1318 # AC_PLUGIN(name, default, info)
1319 # ------------------------------------------------------------
1320 dnl
1321 AC_DEFUN(
1322 [AC_PLUGIN],
1323 [
1324 enable_plugin="no"
1325 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1326 [
1327 if test "x$enableval" = "xyes"
1328 then
1329 enable_plugin="yes"
1330 else
1331 enable_plugin="no"
1332 fi
1333 ],
1334 [
1335 if test "x$2" = "xyes"
1336 then
1337 enable_plugin="yes"
1338 else
1339 enable_plugin="no"
1340 fi
1341 ])
1342 if test "x$enable_plugin" = "xyes"
1343 then
1344 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1345 fi
1346 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1347 enable_$1="$enable_plugin"
1348 ]
1349 )# AC_PLUGIN(name, default, info)
1351 m4_divert_once([HELP_ENABLE], [
1352 collectd features:])
1353 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1354 AC_COLLECTD([debug], [enable], [feature], [debugging])
1355 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1356 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1358 plugin_battery="no"
1359 plugin_cpu="no"
1360 plugin_cpufreq="no"
1361 plugin_df="no"
1362 plugin_disk="no"
1363 plugin_entropy="no"
1364 plugin_interface="no"
1365 plugin_irq="no"
1366 plugin_load="no"
1367 plugin_memory="no"
1368 plugin_nfs="no"
1369 plugin_processes="no"
1370 plugin_serial="no"
1371 plugin_swap="no"
1372 plugin_tape="no"
1373 plugin_users="no"
1374 plugin_vserver="no"
1375 plugin_wireless="no"
1377 # Linux
1378 if test "x$ac_system" = "xLinux"
1379 then
1380 plugin_battery="yes"
1381 plugin_cpu="yes"
1382 plugin_cpufreq="yes"
1383 plugin_disk="yes"
1384 plugin_entropy="yes"
1385 plugin_interface="yes"
1386 plugin_irq="yes"
1387 plugin_load="yes"
1388 plugin_memory="yes"
1389 plugin_nfs="yes"
1390 plugin_processes="yes"
1391 plugin_serial="yes"
1392 plugin_swap="yes"
1393 plugin_vserver="yes"
1394 plugin_wireless="yes"
1395 fi
1397 # Mac OS X devices
1398 if test "x$with_libiokit" = "xyes"
1399 then
1400 plugin_battery="yes"
1401 plugin_disk="yes"
1402 fi
1404 # Solaris
1405 if test "x$with_devinfo$with_kstat" = "xyesyes"
1406 then
1407 plugin_cpu="yes"
1408 plugin_disk="yes"
1409 plugin_interface="yes"
1410 plugin_memory="yes"
1411 plugin_swap="yes"
1412 plugin_tape="yes"
1413 fi
1415 # libstatgrab
1416 if test "x$with_libstatgrab" = "xyes"
1417 then
1418 plugin_interface="yes"
1419 plugin_load="yes"
1420 plugin_memory="yes"
1421 plugin_swap="yes"
1422 fi
1424 if test "x$have_processor_info" = "xyes"
1425 then
1426 plugin_cpu="yes"
1427 fi
1428 if test "x$have_sysctlbyname" = "xyes"
1429 then
1430 plugin_cpu="yes"
1431 plugin_memory="yes"
1432 fi
1434 if test "x$have_statfs" = "xyes"
1435 then
1436 plugin_df="yes"
1437 fi
1438 if test "x$have_statvfs" = "xyes"
1439 then
1440 plugin_df="yes"
1441 fi
1443 if test "x$have_getifaddrs" = "xyes"
1444 then
1445 plugin_interface="yes"
1446 fi
1448 if test "x$have_getloadavg" = "xyes"
1449 then
1450 plugin_load="yes"
1451 fi
1453 # Mac OS X memory interface
1454 if test "x$have_host_statistics" = "xyes"
1455 then
1456 plugin_memory="yes"
1457 fi
1459 if test "x$have_thread_info" = "xyes"
1460 then
1461 plugin_processes="yes"
1462 fi
1464 if test "x$with_libkvm" = "xyes"
1465 then
1466 plugin_swap="yes"
1467 fi
1469 if test "x$have_getutent" = "xyes"
1470 then
1471 plugin_users="yes"
1472 fi
1473 if test "x$have_getutxent" = "xyes"
1474 then
1475 plugin_users="yes"
1476 fi
1478 # FIXME: sysctl for swap plugin
1480 m4_divert_once([HELP_ENABLE], [
1481 collectd plugins:])
1483 AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
1484 AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
1485 AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
1486 AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
1487 AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
1488 AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
1489 AC_PLUGIN([csv], [yes], [CSV output plugin])
1490 AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
1491 AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
1492 AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
1493 AC_PLUGIN([email], [yes], [EMail statistics])
1494 AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
1495 AC_PLUGIN([exec], [yes], [Execution of external programs])
1496 AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
1497 AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
1498 AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
1499 AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
1500 AC_PLUGIN([load], [$plugin_load], [System load])
1501 AC_PLUGIN([logfile], [yes], [File logging plugin])
1502 AC_PLUGIN([mbmon], [yes], [Query mbmond])
1503 AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
1504 AC_PLUGIN([multimeter], [no], [Read multimeter values])
1505 AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
1506 AC_PLUGIN([network], [yes], [Network communication plugin])
1507 AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
1508 AC_PLUGIN([ntpd], [yes], [NTPd statistics])
1509 AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
1510 AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
1511 AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
1512 AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
1513 AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
1514 AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
1515 AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
1516 AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
1517 AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
1518 AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
1519 AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
1520 AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
1521 AC_PLUGIN([users], [$plugin_users], [User statistics])
1522 AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
1523 AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
1524 AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
1526 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
1528 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1529 then
1530 with_liboping="yes (shipped version)"
1531 fi
1533 if test "x$with_libperl" = "xyes"
1534 then
1535 with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)"
1536 else
1537 enable_perl="no (needs libperl)"
1538 fi
1540 cat <<EOF;
1542 Configuration:
1543 Libraries:
1544 libcurl . . . . . . $with_libcurl
1545 libiokit . . . . . $with_libiokit
1546 libiptc . . . . . . $with_libiptc
1547 libkstat . . . . . $with_kstat
1548 libkvm . . . . . . $with_libkvm
1549 libmysql . . . . . $with_libmysql
1550 libnetsnmp . . . . $with_libnetsnmp
1551 liboconfig . . . . $with_liboconfig
1552 liboping . . . . . $with_liboping
1553 libpcap . . . . . . $with_libpcap
1554 libperl . . . . . . $with_libperl
1555 libpthread . . . . $with_libpthread
1556 librrd . . . . . . $with_rrdtool
1557 libsensors . . . . $with_lm_sensors
1558 libstatgrab . . . . $with_libstatgrab
1559 libupsclient . . . $with_libupsclient
1560 libxmms . . . . . . $with_libxmms
1562 Features:
1563 daemon mode . . . . $enable_daemon
1564 debug . . . . . . . $enable_debug
1566 Modules:
1567 apache . . . . . . $enable_apache
1568 apcups . . . . . . $enable_apcups
1569 apple_sensors . . . $enable_apple_sensors
1570 battery . . . . . . $enable_battery
1571 cpu . . . . . . . . $enable_cpu
1572 cpufreq . . . . . . $enable_cpufreq
1573 csv . . . . . . . . $enable_csv
1574 df . . . . . . . . $enable_df
1575 disk . . . . . . . $enable_disk
1576 dns . . . . . . . . $enable_dns
1577 email . . . . . . . $enable_email
1578 entropy . . . . . . $enable_entropy
1579 exec . . . . . . . $enable_exec
1580 hddtemp . . . . . . $enable_hddtemp
1581 interface . . . . . $enable_interface
1582 iptables . . . . . $enable_iptables
1583 irq . . . . . . . . $enable_irq
1584 load . . . . . . . $enable_load
1585 logfile . . . . . . $enable_logfile
1586 mbmon . . . . . . . $enable_mbmon
1587 memory . . . . . . $enable_memory
1588 multimeter . . . . $enable_multimeter
1589 mysql . . . . . . . $enable_mysql
1590 network . . . . . . $enable_network
1591 nfs . . . . . . . . $enable_nfs
1592 ntpd . . . . . . . $enable_ntpd
1593 nut . . . . . . . . $enable_nut
1594 perl . . . . . . . $enable_perl
1595 ping . . . . . . . $enable_ping
1596 processes . . . . . $enable_processes
1597 sensors . . . . . . $enable_sensors
1598 serial . . . . . . $enable_serial
1599 snmp . . . . . . . $enable_snmp
1600 swap . . . . . . . $enable_swap
1601 syslog . . . . . . $enable_syslog
1602 tape . . . . . . . $enable_tape
1603 unixsock . . . . . $enable_unixsock
1604 users . . . . . . . $enable_users
1605 vserver . . . . . . $enable_vserver
1606 wireless . . . . . $enable_wireless
1607 xmms . . . . . . . $enable_xmms
1609 EOF