5956ec5804e67035c50ec34d9a26e5be270fe285
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.10.1)
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 src/libconfig)
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 ])
153 # For cpu modules
154 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
155 AC_CHECK_HEADERS(mach/mach_init.h)
156 AC_CHECK_HEADERS(mach/host_priv.h)
157 AC_CHECK_HEADERS(mach/mach_error.h)
158 AC_CHECK_HEADERS(mach/mach_host.h)
159 AC_CHECK_HEADERS(mach/mach_port.h)
160 AC_CHECK_HEADERS(mach/mach_types.h)
161 AC_CHECK_HEADERS(mach/message.h)
162 AC_CHECK_HEADERS(mach/processor_set.h)
163 AC_CHECK_HEADERS(mach/processor.h)
164 AC_CHECK_HEADERS(mach/processor_info.h)
165 AC_CHECK_HEADERS(mach/task.h)
166 AC_CHECK_HEADERS(mach/thread_act.h)
167 AC_CHECK_HEADERS(mach/vm_region.h)
168 AC_CHECK_HEADERS(mach/vm_map.h)
169 AC_CHECK_HEADERS(mach/vm_prot.h)
170 AC_CHECK_HEADERS(mach/vm_statistics.h)
171 AC_CHECK_HEADERS(mach/kern_return.h)
173 # For hddtemp module
174 AC_CHECK_HEADERS(linux/major.h)
176 # For the apple_sensors module
177 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
178 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
179 AC_CHECK_HEADERS(IOKit/IOTypes.h)
181 # For the battery plugin
182 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
183 [
184 #if HAVE_IOKIT_IOKITLIB_H
185 # include <IOKit/IOKitLib.h>
186 #endif
187 #if HAVE_IOKIT_IOTYPES_H
188 # include <IOKit/IOTypes.h>
189 #endif
190 ])
191 AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
193 # For the `disk' plugin
194 AC_CHECK_HEADERS(IOKit/IOBSD.h)
195 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
197 # For load module
198 AC_CHECK_HEADERS(sys/loadavg.h)
200 # For the processes plugin
201 AC_CHECK_HEADERS(linux/config.h)
203 # For the swap module
204 AC_CHECK_HEADERS(sys/swap.h)
206 # For users module
207 AC_CHECK_HEADERS(utmp.h)
208 AC_CHECK_HEADERS(utmpx.h)
210 # For traffic plugin
211 AC_CHECK_HEADERS(ifaddrs.h)
212 AC_CHECK_HEADERS(net/if.h, [], [],
213 [
214 #if HAVE_SYS_TYPES_H
215 # include <sys/types.h>
216 #endif
217 #if HAVE_SYS_SOCKET_H
218 # include <sys/socket.h>
219 #endif
220 ])
221 AC_CHECK_HEADERS(linux/if.h, [], [],
222 [
223 #if HAVE_SYS_TYPES_H
224 # include <sys/types.h>
225 #endif
226 #if HAVE_SYS_SOCKET_H
227 # include <sys/socket.h>
228 #endif
229 ])
230 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
231 [
232 #if HAVE_SYS_TYPES_H
233 # include <sys/types.h>
234 #endif
235 #if HAVE_SYS_SOCKET_H
236 # include <sys/socket.h>
237 #endif
238 #if HAVE_LINUX_IF_H
239 # include <linux/if.h>
240 #endif
241 ])
243 # For apache plugin
244 AC_CHECK_HEADERS(curl/curl.h)
246 # For quota module
247 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
248 AC_CHECK_HEADERS(ctype.h)
249 AC_CHECK_HEADERS(limits.h)
250 AC_CHECK_HEADERS(sys/quota.h)
251 AC_CHECK_HEADERS(xfs/xqm.h)
253 # For mount interface
254 AC_CHECK_HEADERS(fs_info.h)
255 AC_CHECK_HEADERS(fshelp.h)
256 AC_CHECK_HEADERS(paths.h)
257 AC_CHECK_HEADERS(mntent.h)
258 AC_CHECK_HEADERS(mnttab.h)
259 AC_CHECK_HEADERS(sys/fstyp.h)
260 AC_CHECK_HEADERS(sys/fs_types.h)
261 AC_CHECK_HEADERS(sys/mntent.h)
262 AC_CHECK_HEADERS(sys/mnttab.h)
263 AC_CHECK_HEADERS(sys/mount.h)
264 AC_CHECK_HEADERS(sys/statfs.h)
265 AC_CHECK_HEADERS(sys/statvfs.h)
266 AC_CHECK_HEADERS(sys/vfs.h)
267 AC_CHECK_HEADERS(sys/vfstab.h)
269 # For the swap plugin, FreeBSD
270 AC_CHECK_HEADERS(kvm.h)
272 # For debugging interface (variable number of arguments)
273 AC_CHECK_HEADERS(stdarg.h)
275 # For the dns plugin
276 AC_CHECK_HEADERS(arpa/nameser.h)
278 dnl Checking for libraries
279 AC_CHECK_LIB(m, ext)
281 #
282 # Checks for typedefs, structures, and compiler characteristics.
283 #
284 AC_C_CONST
285 AC_TYPE_PID_T
286 AC_TYPE_SIZE_T
287 AC_TYPE_UID_T
288 AC_HEADER_TIME
290 #
291 # Checks for library functions.
292 #
293 AC_PROG_GCC_TRADITIONAL
294 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
295 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
296 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
297 AC_CHECK_FUNCS(strncasecmp strcasecmp)
298 AC_CHECK_FUNCS(openlog syslog closelog)
300 socket_needs_socket="no"
301 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
302 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
304 nanosleep_needs_rt="no"
305 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
306 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
308 # For cpu module
309 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
311 # For df module
312 AC_CHECK_FUNCS(statfs statvfs)
314 # For load module
315 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
317 # For the `processes' plugin
318 AC_CHECK_FUNCS(thread_info)
320 # For users module
321 AC_CHECK_FUNCS(getutent getutxent)
323 # For quota module
324 AC_CHECK_FUNCS(quotactl)
325 AC_CHECK_FUNCS(getgrgid getpwuid)
327 # For traffic module
328 AC_CHECK_FUNCS(getifaddrs)
330 # For mount interface
331 AC_CHECK_FUNCS(getfsent getvfsent listmntent)
332 AC_CHECK_FUNCS(getfsstat getvfsstat)
334 # Check for different versions of `getmntent' here..
335 AC_FUNC_GETMNTENT
336 if test "x$ac_cv_lib_sun_getmntent" = "xyes"
337 then
338 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
339 [Define if the function getmntent exists. It's the version from libsun.])
340 fi
341 if test "x$ac_cv_lib_seq_getmntent" = "xyes"
342 then
343 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
344 [Define if the function getmntent exists. It's the version from libseq.])
345 fi
346 if test "x$ac_cv_lib_gen_getmntent" = "xyes"
347 then
348 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
349 [Define if the function getmntent exists. It's the version from libgen.])
350 fi
352 if test "x$ac_cv_func_getmntent" = "xyes"; then
353 saveCFLAGS="$CFLAGS"
354 CFLAGS="-Wall -Werror $CFLAGS"
355 AC_CACHE_CHECK([whether getmntent takes one argument],
356 [fu_cv_getmntent1],
357 AC_COMPILE_IFELSE(
358 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
359 #include "$srcdir/src/utils_mount.h"]],
360 [[(void)getmntent((FILE *)NULL);]]
361 ),
362 [fu_cv_getmntent1=yes],
363 [fu_cv_getmntent1=no]
364 )
365 )
366 if test "x$fu_cv_getmntent1" = "xno"; then
367 AC_CACHE_CHECK([whether getmntent takes two arguments],
368 [fu_cv_getmntent2],
369 AC_COMPILE_IFELSE(
370 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
371 #include "$srcdir/src/utils_mount.h"]],
372 [[(void)getmntent((FILE *)NULL,
373 (struct mnttab *)NULL);]]
374 ),
375 [fu_cv_getmntent2=yes],
376 [fu_cv_getmntent2=no]
377 )
378 )
379 fi
380 CFLAGS="$saveCFLAGS"
381 fi
382 if test "x$fu_cv_getmntent1" = "xyes"; then
383 AC_DEFINE(HAVE_GETMNTENT1,
384 1,
385 [Define if there is a function named getmntent
386 for reading the list of mounted filesystems, and
387 that function takes a single argument. (4.3BSD,
388 SunOS, HP-UX, Dynix, Irix, Linux)]
389 )
390 fi
391 if test "x$fu_cv_getmntent2" = "xyes"; then
392 AC_DEFINE(HAVE_GETMNTENT2,
393 1,
394 [Define if there is a function named getmntent
395 for reading the list of mounted filesystems, and
396 that function takes two arguments. (SVR4)]
397 )
398 fi
400 # Check for structures
401 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
402 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
403 [],
404 [
405 #include <sys/types.h>
406 #include <sys/socket.h>
407 #include <net/if.h>
408 ])
409 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
410 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
411 [],
412 [
413 #include <sys/types.h>
414 #include <sys/socket.h>
415 #include <linux/if.h>
416 #include <linux/netdevice.h>
417 ])
419 AC_MSG_CHECKING([for kernel type ($host_os)])
420 case $host_os in
421 *linux*)
422 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
423 ac_system="Linux"
424 ;;
425 *solaris*)
426 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
427 ac_system="Solaris"
428 ;;
429 *)
430 ac_system="unknown"
431 esac
432 AC_MSG_RESULT([$ac_system])
434 with_libresolv="yes"
435 AC_CHECK_LIB(resolv, res_search,
436 [
437 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
438 ],
439 [with_libresolv="no"])
440 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
443 m4_divert_once([HELP_WITH], [
444 collectd additional packages:])
446 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
447 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
448 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
449 then
450 LDFLAGS="$LDFLAGS -L$withval/lib"
451 CPPFLAGS="$CPPFLAGS -I$withval/include"
452 with_rrdtool="yes"
453 fi
454 ], [with_rrdtool="yes"])
455 if test "x$with_rrdtool" = "xyes"
456 then
457 AC_CHECK_LIB(rrd, rrd_update,
458 [
459 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
460 ],
461 [with_rrdtool="no (librrd not found)"], [-lm])
462 fi
463 if test "x$with_rrdtool" = "xyes"
464 then
465 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
466 fi
467 if test "x$with_rrdtool" = "xyes"
468 then
469 collect_rrdtool=1
470 else
471 collect_rrdtool=0
472 fi
473 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
474 [Wether or not to use rrdtool library])
475 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
477 #AC_ARG_WITH(pth, [AS_HELP_STRING([--with-pth=@<:@=PREFIX@:>@], [Path to pth (experimental).]),
478 #[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
479 # then
480 # LDFLAGS="$LDFLAGS -L$withval/lib"
481 # CPPFLAGS="$CPPFLAGS -I$withval/include"
482 # with_pth="yes"
483 # fi
484 #], [with_pth="no"])
485 #if test "x$with_pth" = "xyes"
486 #then
487 # AC_CHECK_LIB(pth, pth_init,, [with_pth="no (libpth not found)"], [])
488 #fi
489 #if test "x$with_pth" = "xyes"
490 #then
491 # AC_CHECK_HEADERS(pth.h,, [with_pth="no (pth.h not found)"])
492 #fi
493 #if test "x$with_pth" = "xyes"
494 #then
495 # collect_pth=1
496 #else
497 # collect_pth=0
498 #fi
499 #AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
500 # [Wether or not to use pth (portable threads) library])
501 #AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
503 if test "$ac_system" = "Solaris"
504 then
505 with_kstat="yes"
506 with_devinfo="yes"
507 else
508 with_kstat="no (Solaris only)"
509 with_devinfo="no (Solaris only)"
510 fi
512 if test "x$with_kstat" = "xyes"
513 then
514 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (libkstat not found)"])
515 fi
516 if test "x$with_kstat" = "xyes"
517 then
518 AC_CHECK_LIB(devinfo, di_init,, [with_devinfo="no (not found)"])
519 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
520 fi
521 if test "x$with_kstat" = "xyes"
522 then
523 collect_kstat=1
524 else
525 collect_kstat=0
526 fi
527 AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
528 [Wether or not to use kstat library (Solaris)])
529 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
530 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
532 ### BEGIN of check for libcurl ###
533 with_curl_config="curl-config"
534 with_curl_prefix=0
535 with_curl_libs=""
536 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
537 [
538 if test "x$withval" != "xno" -a "x$withval" != "xyes"
539 then
540 if test -x "$withval/bin/curl-config"
541 then
542 with_curl_config="$withval/bin/curl-config"
543 with_curl_prefix=1
544 fi
545 fi
546 if test "x$withval" = "xno"
547 then
548 with_libcurl="no"
549 else
550 with_libcurl="yes"
551 fi
552 ],
553 [
554 with_libcurl="yes"
555 ])
556 if test "x$with_libcurl" = "xyes"
557 then
558 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
559 curl_config_status=$?
561 if test $curl_config_status -ne 0
562 then
563 with_libcurl="no"
564 else
565 AC_CHECK_LIB(curl, curl_easy_init,
566 [
567 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
568 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
569 ],
570 [
571 with_libcurl="no"
572 ],
573 [$with_curl_libs])
574 fi
575 fi
576 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
577 then
578 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
579 curl_config_status=$?
581 if test $curl_config_status -ne 0
582 then
583 with_libcurl="no"
584 else
585 if test -d "$with_curl_prefix/include"
586 then
587 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
588 fi
589 fi
590 fi
592 with_libcurl_numeric=0
593 if test "x$with_libcurl" = "xyes"
594 then
595 with_libcurl_numeric=1
596 fi
597 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
598 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
599 ### END of check for libcurl ###
601 with_libiokit="no"
602 collectd_libiokit=0
603 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
604 [
605 with_libiokit="yes"
606 collectd_libiokit=1
607 ],
608 [
609 with_libiokit="no"
610 collectd_libiokit=0
611 ])
612 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
613 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
615 with_libstatgrab="yes"
616 with_libdevstat="no"
617 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
618 [
619 if test "x$withval" != "xno" -a "x$withval" != "xyes"
620 then
621 LDFLAGS="$LDFLAGS -L$withval/lib"
622 CPPFLAGS="$CPPFLAGS -I$withval/include"
623 with_libstatgrab="yes"
624 fi
625 ],
626 [
627 if test "x$ac_system" == "xunknown"
628 then
629 with_libstatgrab="yes"
630 else
631 with_libstatgrab="no"
632 fi
633 ])
634 if test "x$with_libstatgrab" = "xyes"
635 then
636 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
637 fi
638 if test "x$with_libstatgrab" = "xyes"
639 then
640 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
641 fi
642 if test "x$with_libstatgrab" = "xyes"
643 then
644 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
645 fi
646 if test "x$with_libstatgrab" = "xyes"
647 then
648 collect_libstatgrab=1
649 else
650 collect_libstatgrab=0
651 fi
652 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
653 [Wether or not to use statgrab library])
654 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
655 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
657 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
658 if test "x$with_libkvm" = "xyes"
659 then
660 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
661 fi
662 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
664 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
665 [
666 if test "x$withval" != "xno" && test "x$withval" != "xyes"
667 then
668 LDFLAGS="$LDFLAGS -L$withval/lib"
669 CPPFLAGS="$CPPFLAGS -I$withval/include"
670 with_lm_sensors="yes"
671 fi
672 ],
673 [
674 if test "x$ac_system" = "xLinux"
675 then
676 with_lm_sensors="yes"
677 else
678 with_lm_sensors="no"
679 fi
680 ])
681 if test "x$with_lm_sensors" = "xyes"
682 then
683 AC_CHECK_LIB(sensors, sensors_init,
684 [
685 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
686 ],
687 [with_lm_sensors="no (libsensors not found)"])
688 fi
689 if test "x$with_lm_sensors" = "xyes"
690 then
691 AC_CHECK_HEADERS(sensors/sensors.h,
692 [
693 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
694 ],
695 [with_lm_sensors="no (sensors/sensors.h not found)"])
696 fi
697 if test "x$with_lm_sensors" = "xyes"
698 then
699 collect_lm_sensors=1
700 else
701 collect_lm_sensors=0
702 fi
703 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
704 [Wether or not to use sensors library])
705 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
707 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
708 [
709 if test "x$withval" != "xno" && test "x$withval" != "xyes"
710 then
711 LDFLAGS="$LDFLAGS -L$withval/lib"
712 CPPFLAGS="$CPPFLAGS -I$withval/include"
713 with_libmysql="yes"
714 fi
715 ],
716 [
717 with_libmysql="yes"
718 ])
719 if test "x$with_libmysql" = "xyes"
720 then
721 AC_CHECK_LIB(mysqlclient, mysql_init,
722 [
723 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
724 ], [with_libmysql="no (libmysql not found)"])
725 fi
726 if test "x$with_libmysql" = "xyes"
727 then
728 AC_CHECK_HEADERS(mysql/mysql.h,
729 [
730 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
731 ], [with_libmysql="no (mysql/mysql.h not found)"])
732 fi
733 if test "x$with_libmysql" = "xyes"
734 then
735 collect_libmysql=1
736 else
737 collect_libmysql=0
738 fi
739 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
740 [Wether or not to use mysql library])
741 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
743 #with_liboping="yes"
744 with_own_liboping="no"
745 liboping_LDFLAGS="$LDFLAGS"
746 liboping_CPPFLAGS="$CPPFLAGS"
747 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
748 [
749 if test "x$withval" != "xno" && test "x$withval" != "xyes"
750 then
751 if test -d "$withval/lib"
752 then
753 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
754 fi
755 if test -d "$withval/include"
756 then
757 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
758 fi
759 fi
760 if test "x$withval" = "xno"
761 then
762 with_liboping="no"
763 with_own_liboping="no"
764 fi
765 ],
766 [
767 #753
768 with_liboping="yes"
769 ])
771 if test "x$with_liboping" = "xyes"
772 then
773 save_LDFLAGS="$LDFLAGS"
774 save_CPPFLAGS="$CPPFLAGS"
775 LDFLAGS="$liboping_LDFLAGS"
776 CPPFLAGS="$liboping_CPPFLAGS"
777 AC_CHECK_LIB(oping, ping_construct,
778 [
779 with_liboping="yes"
780 with_own_liboping="no"
781 ],
782 [
783 with_liboping="yes"
784 with_own_liboping="yes"
785 LDFLAGS="$save_LDFLAGS"
786 CPPFLAGS="$save_CPPFLAGS"
787 ])
788 fi
789 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
790 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
791 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
792 then
793 with_liboping="yes (shipped version)"
794 fi
796 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
797 [
798 if test "x$withval" != "xno" && test "x$withval" != "xyes"
799 then
800 LDFLAGS="$LDFLAGS -L$withval/lib"
801 CPPFLAGS="$CPPFLAGS -I$withval/include"
802 with_libpcap="yes"
803 fi
804 ],
805 [
806 with_libpcap="yes"
807 ])
808 if test "x$with_libpcap" = "xyes"
809 then
810 AC_CHECK_LIB(pcap, pcap_open_live,
811 [
812 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
813 ], [with_libpcap="no (libpcap not found)"])
814 fi
815 if test "x$with_libpcap" = "xyes"
816 then
817 AC_CHECK_HEADERS(pcap.h,
818 [
819 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
820 ], [with_libpcap="no (pcap.h not found)"])
821 fi
822 if test "x$with_libpcap" = "xyes"
823 then
824 collect_libpcap=1
825 else
826 collect_libpcap=0
827 fi
828 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
829 [Wether or not to use the pcap library])
830 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
832 # Define `step' and `hearbeat' values..
833 declare -i collectd_step=10
834 declare -i collectd_heartbeat=25
835 AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
836 [
837 if test "x$withval" != "xno" -a "x$withval" != "xyes"
838 then
839 declare -i tmp_collectd_step="$withval"
840 if test $tmp_collectd_step -gt 0
841 then
842 collectd_step=$tmp_collectd_step
843 let "collectd_heartbeat=$collectd_step*2"
844 fi
845 fi
846 ], [])
847 AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
848 [
849 if test "x$withval" != "xno" -a "x$withval" != "xyes"
850 then
851 declare -i tmp_collectd_heartbeat="$withval"
852 if test $tmp_collectd_heartbeat -gt 0
853 then
854 collectd_heartbeat=$tmp_collectd_heartbeat
855 fi
856 fi
857 ], [])
859 if test $collectd_step -ne 10
860 then
861 AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
862 fi
863 if test $collectd_heartbeat -ne 25
864 then
865 AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
866 fi
868 #
869 # Check for enabled/disabled features
870 #
872 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
873 # ------------------------------------------------------------
874 dnl
875 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
876 dnl
877 AC_DEFUN(
878 [AC_COLLECTD],
879 [
880 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
881 m4_if(
882 [$2],
883 [enable],
884 [dnl
885 m4_define([EnDis],[disabled])dnl
886 m4_define([YesNo],[no])dnl
887 ],dnl
888 [m4_if(
889 [$2],
890 [disable],
891 [dnl
892 m4_define([EnDis],[enabled])dnl
893 m4_define([YesNo],[yes])dnl
894 ],
895 [dnl
896 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
897 ]dnl
898 )]dnl
899 )dnl
900 m4_if([$3], [feature], [],
901 [m4_if(
902 [$3], [module], [],
903 [dnl
904 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
905 ]dnl
906 )]dnl
907 )dnl
908 AC_ARG_ENABLE(
909 [$1],
910 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
911 [],
912 enable_$1='[YesNo]'dnl
913 )# AC_ARG_ENABLE
914 if test "x$enable_$1" = "xno"
915 then
916 collectd_$1=0
917 else
918 if test "x$enable_$1" = "xyes"
919 then
920 collectd_$1=1
921 else
922 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
923 collectd_$1=1
924 enable_$1='yes'
925 fi
926 fi
927 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
928 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
929 ]dnl
930 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
932 m4_divert_once([HELP_ENABLE], [
933 collectd features:])
934 AC_COLLECTD([debug], [enable], [feature], [debugging])
935 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
936 AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
938 m4_divert_once([HELP_ENABLE], [
939 collectd modules:])
940 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
941 AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
942 AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
943 AC_COLLECTD([battery], [disable], [module], [battery statistics])
944 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
945 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
946 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
947 AC_COLLECTD([df], [disable], [module], [df statistics])
948 AC_COLLECTD([dns], [disable], [module], [dns statistics])
949 AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
950 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
951 AC_COLLECTD([load], [disable], [module], [system load statistics])
952 AC_COLLECTD([memory], [disable], [module], [memory statistics])
953 AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
954 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
955 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
956 AC_COLLECTD([ntpd], [disable], [module], [nfs statistics])
957 AC_COLLECTD([ping], [disable], [module], [ping statistics])
958 AC_COLLECTD([processes], [disable], [module], [processes statistics])
959 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
960 AC_COLLECTD([serial], [disable], [module], [serial statistics])
961 AC_COLLECTD([swap], [disable], [module], [swap statistics])
962 AC_COLLECTD([tape], [disable], [module], [tape statistics])
963 AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
964 AC_COLLECTD([users], [disable], [module], [user count statistics])
965 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
966 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
968 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libconfig/Makefile src/liboping/Makefile)
970 cat <<EOF;
972 Configuration:
973 Libraries:
974 libcurl . . . . . . $with_libcurl
975 libiokit . . . . . $with_libiokit
976 liboping . . . . . $with_liboping
977 librrd . . . . . . $with_rrdtool
978 lm_sensors . . . . $with_lm_sensors
979 libstatgrab . . . . $with_libstatgrab
980 libkstat . . . . . $with_kstat
981 libmysql . . . . . $with_libmysql
982 libpcap . . . . . . $with_libpcap
984 Features:
985 debug . . . . . . . $enable_debug
986 daemon mode . . . . $enable_daemon
987 step . . . . . . . $collectd_step seconds
988 heartbeat . . . . . $collectd_heartbeat seconds
990 Modules:
991 apache . . . . . . $enable_apache
992 apcups . . . . . . $enable_apcups
993 apple_sensors . . . $enable_apple_sensors
994 battery . . . . . . $enable_battery
995 cpu . . . . . . . . $enable_cpu
996 cpufreq . . . . . . $enable_cpufreq
997 df . . . . . . . . $enable_df
998 disk . . . . . . . $enable_disk
999 dns . . . . . . . . $enable_dns
1000 hddtemp . . . . . . $enable_hddtemp
1001 load . . . . . . . $enable_load
1002 memory . . . . . . $enable_memory
1003 multimeter . . . . $enable_multimeter
1004 mysql . . . . . . . $enable_mysql
1005 nfs . . . . . . . . $enable_nfs
1006 ntpd . . . . . . . $enable_ntpd
1007 ping . . . . . . . $enable_ping
1008 processes . . . . . $enable_processes
1009 sensors . . . . . . $enable_sensors
1010 serial . . . . . . $enable_serial
1011 swap . . . . . . . $enable_swap
1012 tape . . . . . . . $enable_tape
1013 traffic . . . . . . $enable_traffic
1014 users . . . . . . . $enable_users
1015 vserver . . . . . . $enable_vserver
1016 wireless . . . . . $enable_wireless
1018 EOF