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