1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.11.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 #
11 # Checks for programs.
12 #
13 AC_PROG_CC
14 AC_PROG_CPP
15 AC_PROG_INSTALL
16 AC_PROG_LN_S
17 AC_PROG_MAKE_SET
18 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
20 dnl configure libtool
21 AC_DISABLE_STATIC
22 AC_LIBLTDL_CONVENIENCE
23 AC_SUBST(LTDLINCL)
24 AC_SUBST(LIBLTDL)
25 AC_LIBTOOL_DLOPEN
26 AC_PROG_LIBTOOL
27 #AC_PROG_RANLIB
28 AC_CONFIG_SUBDIRS(libltdl)
30 #
31 # Checks for header files.
32 #
33 AC_HEADER_STDC
34 AC_HEADER_SYS_WAIT
35 AC_HEADER_DIRENT
36 AC_CHECK_HEADERS(stdint.h)
37 AC_CHECK_HEADERS(stdio.h)
38 AC_CHECK_HEADERS(errno.h)
39 AC_CHECK_HEADERS(math.h)
40 AC_CHECK_HEADERS(syslog.h)
41 AC_CHECK_HEADERS(fcntl.h)
42 AC_CHECK_HEADERS(signal.h)
43 AC_CHECK_HEADERS(assert.h)
44 AC_CHECK_HEADERS(sys/types.h)
45 AC_CHECK_HEADERS(sys/socket.h)
46 AC_CHECK_HEADERS(sys/select.h)
47 AC_CHECK_HEADERS(sys/poll.h)
48 AC_CHECK_HEADERS(netdb.h)
49 AC_CHECK_HEADERS(arpa/inet.h)
50 AC_CHECK_HEADERS(sys/resource.h)
51 AC_CHECK_HEADERS(sys/param.h)
53 # For ping library
54 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
55 [#if HAVE_STDINT_H
56 # include <stdint.h>
57 #endif
58 #if HAVE_SYS_TYPES_H
59 # include <sys/types.h>
60 #endif
61 ])
62 AC_CHECK_HEADERS(netinet/in.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 ])
73 AC_CHECK_HEADERS(netinet/ip.h, [], [],
74 [#if HAVE_STDINT_H
75 # include <stdint.h>
76 #endif
77 #if HAVE_SYS_TYPES_H
78 # include <sys/types.h>
79 #endif
80 #if HAVE_NETINET_IN_SYSTM_H
81 # include <netinet/in_systm.h>
82 #endif
83 #if HAVE_NETINET_IN_H
84 # include <netinet/in.h>
85 #endif
86 ])
87 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
88 [#if HAVE_STDINT_H
89 # include <stdint.h>
90 #endif
91 #if HAVE_SYS_TYPES_H
92 # include <sys/types.h>
93 #endif
94 #if HAVE_NETINET_IN_SYSTM_H
95 # include <netinet/in_systm.h>
96 #endif
97 #if HAVE_NETINET_IN_H
98 # include <netinet/in.h>
99 #endif
100 #if HAVE_NETINET_IP_H
101 # include <netinet/ip.h>
102 #endif
103 ])
104 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
105 [#if HAVE_STDINT_H
106 # include <stdint.h>
107 #endif
108 #if HAVE_SYS_TYPES_H
109 # include <sys/types.h>
110 #endif
111 #if HAVE_NETINET_IN_SYSTM_H
112 # include <netinet/in_systm.h>
113 #endif
114 #if HAVE_NETINET_IN_H
115 # include <netinet/in.h>
116 #endif
117 #if HAVE_NETINET_IP_H
118 # include <netinet/ip.h>
119 #endif
120 ])
121 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
122 [#if HAVE_STDINT_H
123 # include <stdint.h>
124 #endif
125 #if HAVE_SYS_TYPES_H
126 # include <sys/types.h>
127 #endif
128 #if HAVE_NETINET_IN_SYSTM_H
129 # include <netinet/in_systm.h>
130 #endif
131 #if HAVE_NETINET_IN_H
132 # include <netinet/in.h>
133 #endif
134 ])
135 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
136 [#if HAVE_STDINT_H
137 # include <stdint.h>
138 #endif
139 #if HAVE_SYS_TYPES_H
140 # include <sys/types.h>
141 #endif
142 #if HAVE_NETINET_IN_SYSTM_H
143 # include <netinet/in_systm.h>
144 #endif
145 #if HAVE_NETINET_IN_H
146 # include <netinet/in.h>
147 #endif
148 #if HAVE_NETINET_IP6_H
149 # include <netinet/ip6.h>
150 #endif
151 ])
152 AC_CHECK_HEADERS(netinet/udp.h, [], [],
153 [#if HAVE_STDINT_H
154 # include <stdint.h>
155 #endif
156 #if HAVE_SYS_TYPES_H
157 # include <sys/types.h>
158 #endif
159 #if HAVE_NETINET_IN_SYSTM_H
160 # include <netinet/in_systm.h>
161 #endif
162 #if HAVE_NETINET_IN_H
163 # include <netinet/in.h>
164 #endif
165 #if HAVE_NETINET_IP_H
166 # include <netinet/ip.h>
167 #endif
168 ])
170 # For cpu modules
171 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
172 AC_CHECK_HEADERS(mach/mach_init.h)
173 AC_CHECK_HEADERS(mach/host_priv.h)
174 AC_CHECK_HEADERS(mach/mach_error.h)
175 AC_CHECK_HEADERS(mach/mach_host.h)
176 AC_CHECK_HEADERS(mach/mach_port.h)
177 AC_CHECK_HEADERS(mach/mach_types.h)
178 AC_CHECK_HEADERS(mach/message.h)
179 AC_CHECK_HEADERS(mach/processor_set.h)
180 AC_CHECK_HEADERS(mach/processor.h)
181 AC_CHECK_HEADERS(mach/processor_info.h)
182 AC_CHECK_HEADERS(mach/task.h)
183 AC_CHECK_HEADERS(mach/thread_act.h)
184 AC_CHECK_HEADERS(mach/vm_region.h)
185 AC_CHECK_HEADERS(mach/vm_map.h)
186 AC_CHECK_HEADERS(mach/vm_prot.h)
187 AC_CHECK_HEADERS(mach/vm_statistics.h)
188 AC_CHECK_HEADERS(mach/kern_return.h)
190 # For hddtemp module
191 AC_CHECK_HEADERS(linux/major.h)
193 # For the apple_sensors module
194 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
195 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
196 AC_CHECK_HEADERS(IOKit/IOTypes.h)
198 # For the battery plugin
199 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
200 [
201 #if HAVE_IOKIT_IOKITLIB_H
202 # include <IOKit/IOKitLib.h>
203 #endif
204 #if HAVE_IOKIT_IOTYPES_H
205 # include <IOKit/IOTypes.h>
206 #endif
207 ])
208 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
210 # For the `disk' plugin
211 AC_CHECK_HEADERS(IOKit/IOBSD.h)
212 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
214 # For load module
215 AC_CHECK_HEADERS(sys/loadavg.h)
217 # For the processes plugin
218 AC_CHECK_HEADERS(linux/config.h)
220 # For the swap module
221 AC_CHECK_HEADERS(sys/swap.h)
223 # For users module
224 AC_CHECK_HEADERS(utmp.h)
225 AC_CHECK_HEADERS(utmpx.h)
227 # For traffic plugin
228 AC_CHECK_HEADERS(ifaddrs.h)
229 AC_CHECK_HEADERS(net/if.h, [], [],
230 [
231 #if HAVE_SYS_TYPES_H
232 # include <sys/types.h>
233 #endif
234 #if HAVE_SYS_SOCKET_H
235 # include <sys/socket.h>
236 #endif
237 ])
238 AC_CHECK_HEADERS(linux/if.h, [], [],
239 [
240 #if HAVE_SYS_TYPES_H
241 # include <sys/types.h>
242 #endif
243 #if HAVE_SYS_SOCKET_H
244 # include <sys/socket.h>
245 #endif
246 ])
247 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
248 [
249 #if HAVE_SYS_TYPES_H
250 # include <sys/types.h>
251 #endif
252 #if HAVE_SYS_SOCKET_H
253 # include <sys/socket.h>
254 #endif
255 #if HAVE_LINUX_IF_H
256 # include <linux/if.h>
257 #endif
258 ])
260 # For apache plugin
261 AC_CHECK_HEADERS(curl/curl.h)
263 # For quota module
264 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
265 AC_CHECK_HEADERS(ctype.h)
266 AC_CHECK_HEADERS(limits.h)
267 AC_CHECK_HEADERS(sys/quota.h)
268 AC_CHECK_HEADERS(xfs/xqm.h)
270 # For mount interface
271 AC_CHECK_HEADERS(fs_info.h)
272 AC_CHECK_HEADERS(fshelp.h)
273 AC_CHECK_HEADERS(paths.h)
274 AC_CHECK_HEADERS(mntent.h)
275 AC_CHECK_HEADERS(mnttab.h)
276 AC_CHECK_HEADERS(sys/fstyp.h)
277 AC_CHECK_HEADERS(sys/fs_types.h)
278 AC_CHECK_HEADERS(sys/mntent.h)
279 AC_CHECK_HEADERS(sys/mnttab.h)
280 AC_CHECK_HEADERS(sys/mount.h)
281 AC_CHECK_HEADERS(sys/statfs.h)
282 AC_CHECK_HEADERS(sys/statvfs.h)
283 AC_CHECK_HEADERS(sys/vfs.h)
284 AC_CHECK_HEADERS(sys/vfstab.h)
286 # For the swap plugin, FreeBSD
287 AC_CHECK_HEADERS(kvm.h)
289 # For the email plugin
290 AC_CHECK_HEADERS(linux/un.h, [], [],
291 [
292 #if HAVE_SYS_SOCKET_H
293 # include <sys/socket.h>
294 #endif
295 ])
296 AC_CHECK_HEADERS(sys/un.h)
297 AC_CHECK_HEADERS(grp.h)
299 # For debugging interface (variable number of arguments)
300 AC_CHECK_HEADERS(stdarg.h)
302 # Regular expressions for the ignorelist.
303 AC_CHECK_HEADERS(regex.h)
305 # For the dns plugin
306 AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
308 AC_CHECK_HEADERS(net/if_arp.h, [], [],
309 [#if HAVE_SYS_SOCKET_H
310 # include <sys/socket.h>
311 #endif
312 ])
313 AC_CHECK_HEADERS(net/if_ppp.h)
314 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
315 [#if HAVE_STDINT_H
316 # include <stdint.h>
317 #endif
318 #if HAVE_SYS_TYPES_H
319 # include <sys/types.h>
320 #endif
321 #if HAVE_SYS_SOCKET_H
322 # include <sys/socket.h>
323 #endif
324 #if HAVE_NET_IF_H
325 # include <net/if.h>
326 #endif
327 #if HAVE_NETINET_IN_H
328 # include <netinet/in.h>
329 #endif
330 ])
332 dnl Checking for libraries
333 AC_CHECK_LIB(m, ext)
335 #
336 # Checks for typedefs, structures, and compiler characteristics.
337 #
338 AC_C_CONST
339 AC_TYPE_PID_T
340 AC_TYPE_SIZE_T
341 AC_TYPE_UID_T
342 AC_HEADER_TIME
344 #
345 # Checks for library functions.
346 #
347 AC_PROG_GCC_TRADITIONAL
348 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
349 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
350 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
351 AC_CHECK_FUNCS(strncasecmp strcasecmp)
352 AC_CHECK_FUNCS(openlog syslog closelog)
354 socket_needs_socket="no"
355 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
356 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
358 nanosleep_needs_rt="no"
359 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
360 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
362 # Regular expressions for the ignorelist.
363 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
365 # For cpu module
366 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
368 # For df module
369 AC_CHECK_FUNCS(statfs statvfs)
371 # For load module
372 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
374 # For the `processes' plugin
375 AC_CHECK_FUNCS(thread_info)
377 # For users module
378 AC_CHECK_FUNCS(getutent getutxent)
380 # For quota module
381 AC_CHECK_FUNCS(quotactl)
382 AC_CHECK_FUNCS(getgrgid getpwuid)
384 # For traffic module
385 AC_CHECK_FUNCS(getifaddrs)
387 # For mount interface
388 #AC_CHECK_FUNCS(getfsent getvfsent)
390 have_getfsstat="no"
391 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
392 have_getvfsstat="no"
393 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
394 have_listmntent="no"
395 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
397 have_getmntent="no"
398 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
399 if test "x$have_getmntent" = "xno"; then
400 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
401 fi
402 if test "x$have_getmntent" = "xno"; then
403 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
404 fi
405 if test "x$have_getmntent" = "xno"; then
406 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
407 fi
409 if test "x$have_getmntent" = "xc"; then
410 AC_CACHE_CHECK([whether getmntent takes one argument],
411 [have_one_getmntent],
412 AC_COMPILE_IFELSE(
413 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
414 #include <mntent.h>
415 #include "$srcdir/src/utils_mount.h"]],
416 [[
417 FILE *fh;
418 struct mntent *me;
419 fh = setmntent ("/etc/mtab", "r");
420 me = getmntent (fh);
421 ]]
422 ),
423 [have_one_getmntent="yes"],
424 [have_one_getmntent="no"]
425 )
426 )
427 AC_CACHE_CHECK([whether getmntent takes two arguments],
428 [have_two_getmntent],
429 AC_COMPILE_IFELSE(
430 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
431 #include <sys/mnttab.h>
432 #include "$srcdir/src/utils_mount.h"]],
433 [[
434 FILE *fh;
435 struct mnttab mt;
436 int status;
437 fh = fopen ("/etc/mnttab", "r");
438 status = getmntent (fh, &mt);
439 ]]
440 ),
441 [have_two_getmntent="yes"],
442 [have_two_getmntent="no"]
443 )
444 )
445 fi
447 # Check for different versions of `getmntent' here..
449 if test "x$have_getmntent" = "xc"; then
450 if test "x$have_one_getmntent" = "xyes"; then
451 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
452 [Define if the function getmntent exists and takes one argument.])
453 fi
454 if test "x$have_two_getmntent" = "xyes"; then
455 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
456 [Define if the function getmntent exists and takes two arguments.])
457 fi
458 fi
459 if test "x$have_getmntent" = "xsun"; then
460 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
461 [Define if the function getmntent exists. It's the version from libsun.])
462 fi
463 if test "x$have_getmntent" = "xseq"; then
464 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
465 [Define if the function getmntent exists. It's the version from libseq.])
466 fi
467 if test "x$have_getmntent" = "xgen"; then
468 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
469 [Define if the function getmntent exists. It's the version from libgen.])
470 fi
472 # Check for structures
473 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
474 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
475 [],
476 [
477 #include <sys/types.h>
478 #include <sys/socket.h>
479 #include <net/if.h>
480 ])
481 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
482 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
483 [],
484 [
485 #include <sys/types.h>
486 #include <sys/socket.h>
487 #include <linux/if.h>
488 #include <linux/netdevice.h>
489 ])
491 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
492 [#if HAVE_STDINT_H
493 # include <stdint.h>
494 #endif
495 #if HAVE_SYS_TYPES_H
496 # include <sys/types.h>
497 #endif
498 #if HAVE_NETINET_IN_SYSTM_H
499 # include <netinet/in_systm.h>
500 #endif
501 #if HAVE_NETINET_IN_H
502 # include <netinet/in.h>
503 #endif
504 #if HAVE_NETINET_IP_H
505 # include <netinet/ip.h>
506 #endif
507 #if HAVE_NETINET_UDP_H
508 # include <netinet/udp.h>
509 #endif
510 ])
511 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
512 [#if HAVE_STDINT_H
513 # include <stdint.h>
514 #endif
515 #if HAVE_SYS_TYPES_H
516 # include <sys/types.h>
517 #endif
518 #if HAVE_NETINET_IN_SYSTM_H
519 # include <netinet/in_systm.h>
520 #endif
521 #if HAVE_NETINET_IN_H
522 # include <netinet/in.h>
523 #endif
524 #if HAVE_NETINET_IP_H
525 # include <netinet/ip.h>
526 #endif
527 #if HAVE_NETINET_UDP_H
528 # include <netinet/udp.h>
529 #endif
530 ])
532 AC_MSG_CHECKING([for kernel type ($host_os)])
533 case $host_os in
534 *linux*)
535 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
536 ac_system="Linux"
537 ;;
538 *solaris*)
539 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
540 ac_system="Solaris"
541 ;;
542 *)
543 ac_system="unknown"
544 esac
545 AC_MSG_RESULT([$ac_system])
547 with_libresolv="yes"
548 AC_CHECK_LIB(resolv, res_search,
549 [
550 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
551 ],
552 [with_libresolv="no"])
553 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
556 m4_divert_once([HELP_WITH], [
557 collectd additional packages:])
559 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
560 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
561 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
562 then
563 LDFLAGS="$LDFLAGS -L$withval/lib"
564 CPPFLAGS="$CPPFLAGS -I$withval/include"
565 with_rrdtool="yes"
566 fi
567 ], [with_rrdtool="yes"])
568 if test "x$with_rrdtool" = "xyes"
569 then
570 AC_CHECK_LIB(rrd, rrd_update,
571 [
572 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
573 ],
574 [with_rrdtool="no (librrd not found)"], [-lm])
575 fi
576 if test "x$with_rrdtool" = "xyes"
577 then
578 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
579 fi
580 if test "x$with_rrdtool" = "xyes"
581 then
582 collect_rrdtool=1
583 else
584 collect_rrdtool=0
585 fi
586 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
587 [Wether or not to use rrdtool library])
588 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
590 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
591 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
592 then
593 LDFLAGS="$LDFLAGS -L$withval/lib"
594 CPPFLAGS="$CPPFLAGS -I$withval/include"
595 with_libpthread="yes"
596 else
597 if test "x$withval" = "xno"
598 then
599 with_libpthread="no (disabled)"
600 fi
601 fi
602 ], [with_libpthread="yes"])
603 if test "x$with_libpthread" = "xyes"
604 then
605 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
606 fi
607 if test "x$with_libpthread" = "xyes"
608 then
609 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
610 fi
611 if test "x$with_libpthread" = "xyes"
612 then
613 collect_pthread=1
614 else
615 collect_pthread=0
616 fi
617 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
618 [Wether or not to use pthread (POSIX threads) library])
619 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
621 if test "$ac_system" = "Solaris"
622 then
623 with_kstat="yes"
624 with_devinfo="yes"
625 else
626 with_kstat="no (Solaris only)"
627 with_devinfo="no (Solaris only)"
628 fi
630 if test "x$with_kstat" = "xyes"
631 then
632 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
633 fi
634 if test "x$with_kstat" = "xyes"
635 then
636 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
637 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
638 fi
639 if test "x$with_kstat" = "xyes"
640 then
641 AC_DEFINE(HAVE_LIBKSTAT, 1,
642 [Define to 1 if you have the 'kstat' library (-lkstat)])
643 fi
644 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
645 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
647 ### BEGIN of check for libcurl ###
648 with_curl_config="curl-config"
649 with_curl_prefix=0
650 with_curl_libs=""
651 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
652 [
653 if test "x$withval" != "xno" -a "x$withval" != "xyes"
654 then
655 if test -x "$withval/bin/curl-config"
656 then
657 with_curl_config="$withval/bin/curl-config"
658 with_curl_prefix=1
659 fi
660 fi
661 if test "x$withval" = "xno"
662 then
663 with_libcurl="no"
664 else
665 with_libcurl="yes"
666 fi
667 ],
668 [
669 with_libcurl="yes"
670 ])
671 if test "x$with_libcurl" = "xyes"
672 then
673 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
674 curl_config_status=$?
676 if test $curl_config_status -ne 0
677 then
678 with_libcurl="no"
679 else
680 AC_CHECK_LIB(curl, curl_easy_init,
681 [
682 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
683 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
684 ],
685 [
686 with_libcurl="no"
687 ],
688 [$with_curl_libs])
689 fi
690 fi
691 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
692 then
693 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
694 curl_config_status=$?
696 if test $curl_config_status -ne 0
697 then
698 with_libcurl="no"
699 else
700 if test -d "$with_curl_prefix/include"
701 then
702 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
703 fi
704 fi
705 fi
707 with_libcurl_numeric=0
708 if test "x$with_libcurl" = "xyes"
709 then
710 with_libcurl_numeric=1
711 fi
712 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
713 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
714 ### END of check for libcurl ###
716 with_libiokit="no"
717 collectd_libiokit=0
718 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
719 [
720 with_libiokit="yes"
721 collectd_libiokit=1
722 ],
723 [
724 with_libiokit="no"
725 collectd_libiokit=0
726 ])
727 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
728 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
730 with_libstatgrab="yes"
731 with_libdevstat="no"
732 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
733 [
734 if test "x$withval" != "xno" -a "x$withval" != "xyes"
735 then
736 LDFLAGS="$LDFLAGS -L$withval/lib"
737 CPPFLAGS="$CPPFLAGS -I$withval/include"
738 with_libstatgrab="yes"
739 fi
740 ],
741 [
742 if test "x$ac_system" == "xunknown"
743 then
744 with_libstatgrab="yes"
745 else
746 with_libstatgrab="no"
747 fi
748 ])
749 if test "x$with_libstatgrab" = "xyes"
750 then
751 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
752 fi
753 if test "x$with_libstatgrab" = "xyes"
754 then
755 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
756 fi
757 if test "x$with_libstatgrab" = "xyes"
758 then
759 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
760 fi
761 if test "x$with_libstatgrab" = "xyes"
762 then
763 collect_libstatgrab=1
764 else
765 collect_libstatgrab=0
766 fi
767 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
768 [Wether or not to use statgrab library])
769 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
770 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
772 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
773 if test "x$with_libkvm" = "xyes"
774 then
775 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
776 fi
777 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
779 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
780 [
781 if test "x$withval" != "xno" && test "x$withval" != "xyes"
782 then
783 LDFLAGS="$LDFLAGS -L$withval/lib"
784 CPPFLAGS="$CPPFLAGS -I$withval/include"
785 with_lm_sensors="yes"
786 fi
787 ],
788 [
789 if test "x$ac_system" = "xLinux"
790 then
791 with_lm_sensors="yes"
792 else
793 with_lm_sensors="no"
794 fi
795 ])
796 if test "x$with_lm_sensors" = "xyes"
797 then
798 AC_CHECK_LIB(sensors, sensors_init,
799 [
800 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
801 ],
802 [with_lm_sensors="no (libsensors not found)"])
803 fi
804 if test "x$with_lm_sensors" = "xyes"
805 then
806 AC_CHECK_HEADERS(sensors/sensors.h,
807 [
808 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
809 ],
810 [with_lm_sensors="no (sensors/sensors.h not found)"])
811 fi
812 if test "x$with_lm_sensors" = "xyes"
813 then
814 collect_lm_sensors=1
815 else
816 collect_lm_sensors=0
817 fi
818 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
819 [Wether or not to use sensors library])
820 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
822 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
823 [
824 if test "x$withval" != "xno" && test "x$withval" != "xyes"
825 then
826 LDFLAGS="$LDFLAGS -L$withval/lib"
827 CPPFLAGS="$CPPFLAGS -I$withval/include"
828 with_libmysql="yes"
829 fi
830 ],
831 [
832 with_libmysql="yes"
833 ])
834 if test "x$with_libmysql" = "xyes"
835 then
836 AC_CHECK_LIB(mysqlclient, mysql_init,
837 [
838 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
839 ], [with_libmysql="no (libmysql not found)"])
840 fi
841 if test "x$with_libmysql" = "xyes"
842 then
843 AC_CHECK_HEADERS(mysql/mysql.h,
844 [
845 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
846 ], [with_libmysql="no (mysql/mysql.h not found)"])
847 fi
848 if test "x$with_libmysql" = "xyes"
849 then
850 collect_libmysql=1
851 else
852 collect_libmysql=0
853 fi
854 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
855 [Wether or not to use mysql library])
856 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
858 #with_liboping="yes"
859 with_own_liboping="no"
860 liboping_LDFLAGS="$LDFLAGS"
861 liboping_CPPFLAGS="$CPPFLAGS"
862 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
863 [
864 if test "x$withval" != "xno" && test "x$withval" != "xyes"
865 then
866 if test -d "$withval/lib"
867 then
868 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
869 fi
870 if test -d "$withval/include"
871 then
872 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
873 fi
874 fi
875 if test "x$withval" = "xno"
876 then
877 with_liboping="no"
878 with_own_liboping="no"
879 fi
880 ],
881 [
882 #753
883 with_liboping="yes"
884 ])
886 if test "x$with_liboping" = "xyes"
887 then
888 save_LDFLAGS="$LDFLAGS"
889 save_CPPFLAGS="$CPPFLAGS"
890 LDFLAGS="$liboping_LDFLAGS"
891 CPPFLAGS="$liboping_CPPFLAGS"
892 AC_CHECK_LIB(oping, ping_construct,
893 [
894 with_liboping="yes"
895 with_own_liboping="no"
896 ],
897 [
898 with_liboping="yes"
899 with_own_liboping="yes"
900 LDFLAGS="$save_LDFLAGS"
901 CPPFLAGS="$save_CPPFLAGS"
902 ])
903 fi
904 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
905 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
906 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
907 then
908 with_liboping="yes (shipped version)"
909 fi
911 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
912 [
913 if test "x$withval" != "xno" && test "x$withval" != "xyes"
914 then
915 LDFLAGS="$LDFLAGS -L$withval/lib"
916 CPPFLAGS="$CPPFLAGS -I$withval/include"
917 with_libpcap="yes"
918 fi
919 ],
920 [
921 with_libpcap="yes"
922 ])
923 if test "x$with_libpcap" = "xyes"
924 then
925 AC_CHECK_LIB(pcap, pcap_open_live,
926 [
927 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
928 ], [with_libpcap="no (libpcap not found)"])
929 fi
930 if test "x$with_libpcap" = "xyes"
931 then
932 AC_CHECK_HEADERS(pcap.h,
933 [
934 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
935 ], [with_libpcap="no (pcap.h not found)"])
936 fi
937 if test "x$with_libpcap" = "xyes"
938 then
939 collect_libpcap=1
940 else
941 collect_libpcap=0
942 fi
943 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
944 [Wether or not to use the pcap library])
945 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
947 # Define `step' and `hearbeat' values..
948 declare -i collectd_step=10
949 declare -i collectd_heartbeat=25
950 AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
951 [
952 if test "x$withval" != "xno" -a "x$withval" != "xyes"
953 then
954 declare -i tmp_collectd_step="$withval"
955 if test $tmp_collectd_step -gt 0
956 then
957 collectd_step=$tmp_collectd_step
958 let "collectd_heartbeat=$collectd_step*2"
959 fi
960 fi
961 ], [])
962 AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
963 [
964 if test "x$withval" != "xno" -a "x$withval" != "xyes"
965 then
966 declare -i tmp_collectd_heartbeat="$withval"
967 if test $tmp_collectd_heartbeat -gt 0
968 then
969 collectd_heartbeat=$tmp_collectd_heartbeat
970 fi
971 fi
972 ], [])
974 if test $collectd_step -ne 10
975 then
976 AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
977 fi
978 if test $collectd_heartbeat -ne 25
979 then
980 AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
981 fi
983 # Check for enabled/disabled features
984 #
986 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
987 # ------------------------------------------------------------
988 dnl
989 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
990 dnl
991 AC_DEFUN(
992 [AC_COLLECTD],
993 [
994 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
995 m4_if(
996 [$2],
997 [enable],
998 [dnl
999 m4_define([EnDis],[disabled])dnl
1000 m4_define([YesNo],[no])dnl
1001 ],dnl
1002 [m4_if(
1003 [$2],
1004 [disable],
1005 [dnl
1006 m4_define([EnDis],[enabled])dnl
1007 m4_define([YesNo],[yes])dnl
1008 ],
1009 [dnl
1010 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1011 ]dnl
1012 )]dnl
1013 )dnl
1014 m4_if([$3], [feature], [],
1015 [m4_if(
1016 [$3], [module], [],
1017 [dnl
1018 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1019 ]dnl
1020 )]dnl
1021 )dnl
1022 AC_ARG_ENABLE(
1023 [$1],
1024 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1025 [],
1026 enable_$1='[YesNo]'dnl
1027 )# AC_ARG_ENABLE
1028 if test "x$enable_$1" = "xno"
1029 then
1030 collectd_$1=0
1031 else
1032 if test "x$enable_$1" = "xyes"
1033 then
1034 collectd_$1=1
1035 else
1036 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1037 collectd_$1=1
1038 enable_$1='yes'
1039 fi
1040 fi
1041 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1042 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1043 ]dnl
1044 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1046 m4_divert_once([HELP_ENABLE], [
1047 collectd features:])
1048 AC_COLLECTD([debug], [enable], [feature], [debugging])
1049 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
1050 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
1052 m4_divert_once([HELP_ENABLE], [
1053 collectd modules:])
1054 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
1055 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
1056 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
1057 AC_COLLECTD([battery], [disable], [module], [battery statistics])
1058 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
1059 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1060 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
1061 AC_COLLECTD([df], [disable], [module], [df statistics])
1062 AC_COLLECTD([dns], [disable], [module], [dns statistics])
1063 AC_COLLECTD([email], [disable], [module], [email statistics])
1064 AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
1065 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
1066 AC_COLLECTD([load], [disable], [module], [system load statistics])
1067 AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
1068 AC_COLLECTD([memory], [disable], [module], [memory statistics])
1069 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
1070 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
1071 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
1072 AC_COLLECTD([ntpd], [disable], [module], [nfs statistics])
1073 AC_COLLECTD([ping], [disable], [module], [ping statistics])
1074 AC_COLLECTD([processes], [disable], [module], [processes statistics])
1075 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1076 AC_COLLECTD([serial], [disable], [module], [serial statistics])
1077 AC_COLLECTD([swap], [disable], [module], [swap statistics])
1078 AC_COLLECTD([tape], [disable], [module], [tape statistics])
1079 AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
1080 AC_COLLECTD([users], [disable], [module], [user count statistics])
1081 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
1082 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
1084 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libconfig/Makefile src/liboping/Makefile)
1086 cat <<EOF;
1088 Configuration:
1089 Libraries:
1090 libcurl . . . . . . $with_libcurl
1091 libiokit . . . . . $with_libiokit
1092 liboping . . . . . $with_liboping
1093 librrd . . . . . . $with_rrdtool
1094 lm_sensors . . . . $with_lm_sensors
1095 libstatgrab . . . . $with_libstatgrab
1096 libkstat . . . . . $with_kstat
1097 libmysql . . . . . $with_libmysql
1098 libpcap . . . . . . $with_libpcap
1099 libpthread . . . . $with_libpthread
1101 Features:
1102 debug . . . . . . . $enable_debug
1103 daemon mode . . . . $enable_daemon
1104 step . . . . . . . $collectd_step seconds
1105 heartbeat . . . . . $collectd_heartbeat seconds
1107 Modules:
1108 apache . . . . . . $enable_apache
1109 apcups . . . . . . $enable_apcups
1110 apple_sensors . . . $enable_apple_sensors
1111 battery . . . . . . $enable_battery
1112 cpu . . . . . . . . $enable_cpu
1113 cpufreq . . . . . . $enable_cpufreq
1114 df . . . . . . . . $enable_df
1115 disk . . . . . . . $enable_disk
1116 dns . . . . . . . . $enable_dns
1117 email . . . . . . . $enable_email
1118 hddtemp . . . . . . $enable_hddtemp
1119 load . . . . . . . $enable_load
1120 mbmon . . . . . . . $enable_mbmon
1121 memory . . . . . . $enable_memory
1122 multimeter . . . . $enable_multimeter
1123 mysql . . . . . . . $enable_mysql
1124 nfs . . . . . . . . $enable_nfs
1125 ntpd . . . . . . . $enable_ntpd
1126 ping . . . . . . . $enable_ping
1127 processes . . . . . $enable_processes
1128 sensors . . . . . . $enable_sensors
1129 serial . . . . . . $enable_serial
1130 swap . . . . . . . $enable_swap
1131 tape . . . . . . . $enable_tape
1132 traffic . . . . . . $enable_traffic
1133 users . . . . . . . $enable_users
1134 vserver . . . . . . $enable_vserver
1135 wireless . . . . . $enable_wireless
1137 EOF