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