5b620250eaa2fb62b6ee2b3fb79230b28ad1fbbb
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.9.0-alpha1)
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(netdb.h)
48 AC_CHECK_HEADERS(arpa/inet.h)
49 AC_CHECK_HEADERS(sys/resource.h)
50 AC_CHECK_HEADERS(sys/param.h)
52 # For ping library
53 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
54 [#if HAVE_STDINT_H
55 # include <stdint.h>
56 #endif
57 ])
58 AC_CHECK_HEADERS(netinet/in.h, [], [],
59 [#if HAVE_STDINT_H
60 # include <stdint.h>
61 #endif
62 #if HAVE_NETINET_IN_SYSTM_H
63 # include <netinet/in_systm.h>
64 #endif
65 ])
66 AC_CHECK_HEADERS(netinet/ip.h, [], [],
67 [#if HAVE_STDINT_H
68 # include <stdint.h>
69 #endif
70 #if HAVE_NETINET_IN_SYSTM_H
71 # include <netinet/in_systm.h>
72 #endif
73 #if HAVE_NETINET_IN_H
74 # include <netinet/in.h>
75 #endif
76 ])
77 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
78 [#if HAVE_STDINT_H
79 # include <stdint.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 #if HAVE_NETINET_IP_H
88 # include <netinet/ip.h>
89 #endif
90 ])
91 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
92 [#if HAVE_STDINT_H
93 # include <stdint.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/ip6.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 ])
119 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
120 [#if HAVE_STDINT_H
121 # include <stdint.h>
122 #endif
123 #if HAVE_SYS_TYPES_H
124 # include <sys/types.h>
125 #endif
126 #if HAVE_NETINET_IN_SYSTM_H
127 # include <netinet/in_systm.h>
128 #endif
129 #if HAVE_NETINET_IN_H
130 # include <netinet/in.h>
131 #endif
132 #if HAVE_NETINET_IP6_H
133 # include <netinet/ip6.h>
134 #endif
135 ])
137 # For cpu modules
138 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
139 AC_CHECK_HEADERS(mach/mach_init.h)
140 AC_CHECK_HEADERS(mach/host_priv.h)
141 AC_CHECK_HEADERS(mach/mach_error.h)
142 AC_CHECK_HEADERS(mach/mach_host.h)
143 AC_CHECK_HEADERS(mach/mach_port.h)
144 AC_CHECK_HEADERS(mach/mach_types.h)
145 AC_CHECK_HEADERS(mach/message.h)
146 AC_CHECK_HEADERS(mach/processor_set.h)
147 AC_CHECK_HEADERS(mach/processor.h)
148 AC_CHECK_HEADERS(mach/processor_info.h)
149 AC_CHECK_HEADERS(mach/task.h)
150 AC_CHECK_HEADERS(mach/thread_act.h)
151 AC_CHECK_HEADERS(mach/vm_region.h)
152 AC_CHECK_HEADERS(mach/vm_map.h)
153 AC_CHECK_HEADERS(mach/vm_prot.h)
154 AC_CHECK_HEADERS(mach/vm_statistics.h)
155 AC_CHECK_HEADERS(mach/kern_return.h)
157 # For hddtemp module
158 AC_CHECK_HEADERS(linux/major.h)
160 # For the iokit module
161 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
162 AC_CHECK_HEADERS(IOKit/IOKitLib.h)
163 AC_CHECK_HEADERS(IOKit/IOTypes.h)
165 # For load module
166 AC_CHECK_HEADERS(sys/loadavg.h)
168 # For users module
169 AC_CHECK_HEADERS(utmp.h)
170 AC_CHECK_HEADERS(utmpx.h)
172 # For traffic plugin
173 AC_CHECK_HEADERS(ifaddrs.h)
174 AC_CHECK_HEADERS(net/if.h, [], [],
175 [
176 #if HAVE_SYS_TYPES_H
177 # include <sys/types.h>
178 #endif
179 #if HAVE_SYS_SOCKET_H
180 # include <sys/socket.h>
181 #endif
182 ])
183 AC_CHECK_HEADERS(linux/if.h, [], [],
184 [
185 #if HAVE_SYS_TYPES_H
186 # include <sys/types.h>
187 #endif
188 #if HAVE_SYS_SOCKET_H
189 # include <sys/socket.h>
190 #endif
191 ])
192 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
193 [
194 #if HAVE_SYS_TYPES_H
195 # include <sys/types.h>
196 #endif
197 #if HAVE_SYS_SOCKET_H
198 # include <sys/socket.h>
199 #endif
200 #if HAVE_LINUX_IF_H
201 # include <linux/if.h>
202 #endif
203 ])
205 # For apache plugin
206 AC_CHECK_HEADERS(curl/curl.h)
208 # For quota module
209 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
210 AC_CHECK_HEADERS(ctype.h)
211 AC_CHECK_HEADERS(limits.h)
212 AC_CHECK_HEADERS(sys/quota.h)
213 AC_CHECK_HEADERS(xfs/xqm.h)
215 # For mount interface
216 AC_CHECK_HEADERS(fs_info.h)
217 AC_CHECK_HEADERS(fshelp.h)
218 AC_CHECK_HEADERS(paths.h)
219 AC_CHECK_HEADERS(mntent.h)
220 AC_CHECK_HEADERS(mnttab.h)
221 AC_CHECK_HEADERS(sys/fstyp.h)
222 AC_CHECK_HEADERS(sys/fs_types.h)
223 AC_CHECK_HEADERS(sys/mntent.h)
224 AC_CHECK_HEADERS(sys/mnttab.h)
225 AC_CHECK_HEADERS(sys/mount.h)
226 AC_CHECK_HEADERS(sys/statfs.h)
227 AC_CHECK_HEADERS(sys/statvfs.h)
228 AC_CHECK_HEADERS(sys/vfs.h)
229 AC_CHECK_HEADERS(sys/vfstab.h)
231 # For debugging interface (variable number of arguments)
232 AC_CHECK_HEADERS(stdarg.h)
234 dnl Checking for libraries
235 AC_CHECK_LIB(m, ext)
237 #
238 # Checks for typedefs, structures, and compiler characteristics.
239 #
240 AC_C_CONST
241 AC_TYPE_PID_T
242 AC_TYPE_SIZE_T
243 AC_TYPE_UID_T
244 AC_HEADER_TIME
246 #
247 # Checks for library functions.
248 #
249 AC_PROG_GCC_TRADITIONAL
250 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
251 AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
252 AC_CHECK_FUNCS(getaddrinfo getnameinfo)
253 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
254 AC_CHECK_FUNCS(strncasecmp strcasecmp)
255 AC_CHECK_FUNCS(openlog syslog closelog)
257 # For cpu module
258 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
260 # For df module
261 AC_CHECK_FUNCS(statfs statvfs)
263 # For load module
264 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
266 # For the `processes' plugin
267 AC_CHECK_FUNCS(thread_info)
269 # For users module
270 AC_CHECK_FUNCS(getutent getutxent)
272 # For quota module
273 AC_CHECK_FUNCS(quotactl)
274 AC_CHECK_FUNCS(getgrgid getpwuid)
276 # For traffic module
277 AC_CHECK_FUNCS(getifaddrs)
279 # For mount interface
280 AC_CHECK_FUNCS(getfsent getvfsent listmntent)
281 AC_CHECK_FUNCS(getfsstat)
283 # Check for different versions of `getmntent' here..
284 AC_FUNC_GETMNTENT
285 if test "x$ac_cv_lib_sun_getmntent" = "xyes"
286 then
287 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
288 [Define if the function getmntent exists. It's the version from libsun.])
289 fi
290 if test "x$ac_cv_lib_seq_getmntent" = "xyes"
291 then
292 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
293 [Define if the function getmntent exists. It's the version from libseq.])
294 fi
295 if test "x$ac_cv_lib_gen_getmntent" = "xyes"
296 then
297 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
298 [Define if the function getmntent exists. It's the version from libgen.])
299 fi
301 if test "x$ac_cv_func_getmntent" = "xyes"; then
302 saveCFLAGS="$CFLAGS"
303 CFLAGS="-Wall -Werror $CFLAGS"
304 AC_CACHE_CHECK([whether getmntent takes one argument],
305 [fu_cv_getmntent1],
306 AC_COMPILE_IFELSE(
307 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
308 #include "$srcdir/src/utils_mount.h"]],
309 [[(void)getmntent((FILE *)NULL);]]
310 ),
311 [fu_cv_getmntent1=yes],
312 [fu_cv_getmntent1=no]
313 )
314 )
315 if test "x$fu_cv_getmntent1" = "xno"; then
316 AC_CACHE_CHECK([whether getmntent takes two arguments],
317 [fu_cv_getmntent2],
318 AC_COMPILE_IFELSE(
319 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
320 #include "$srcdir/src/utils_mount.h"]],
321 [[(void)getmntent((FILE *)NULL,
322 (struct mnttab *)NULL);]]
323 ),
324 [fu_cv_getmntent2=yes],
325 [fu_cv_getmntent2=no]
326 )
327 )
328 fi
329 CFLAGS="$saveCFLAGS"
330 fi
331 if test "x$fu_cv_getmntent1" = "xyes"; then
332 AC_DEFINE(HAVE_GETMNTENT1,
333 1,
334 [Define if there is a function named getmntent
335 for reading the list of mounted filesystems, and
336 that function takes a single argument. (4.3BSD,
337 SunOS, HP-UX, Dynix, Irix, Linux)]
338 )
339 fi
340 if test "x$fu_cv_getmntent2" = "xyes"; then
341 AC_DEFINE(HAVE_GETMNTENT2,
342 1,
343 [Define if there is a function named getmntent
344 for reading the list of mounted filesystems, and
345 that function takes two arguments. (SVR4)]
346 )
347 fi
349 # Check for structures
350 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_obytes],
351 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
352 [],
353 [
354 #include <sys/types.h>
355 #include <sys/socket.h>
356 #include <net/if.h>
357 ])
358 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_bytes],
359 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
360 [],
361 [
362 #include <sys/types.h>
363 #include <sys/socket.h>
364 #include <linux/if.h>
365 #include <linux/netdevice.h>
366 ])
368 AC_MSG_CHECKING([for kernel type ($host_os)])
369 case $host_os in
370 *linux*)
371 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
372 ac_system="Linux"
373 ;;
374 *solaris*)
375 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
376 ac_system="Solaris"
377 ;;
378 *)
379 ac_system="unknown"
380 esac
381 AC_MSG_RESULT([$ac_system])
383 with_libsocket="yes"
384 AC_CHECK_LIB(socket, socket,
385 [
386 AC_DEFINE(HAVE_LIBSOCKET, 1, [Define to 1 if you have the 'socket' library (-lsocket).])
387 ],
388 [with_libsocket="no"])
389 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$with_libsocket" = "xyes")
391 with_libresolv="yes"
392 AC_CHECK_LIB(resolv, res_search,
393 [
394 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
395 ],
396 [with_libresolv="no"])
397 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
400 m4_divert_once([HELP_WITH], [
401 collectd additional packages:])
403 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
404 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
405 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
406 then
407 LDFLAGS="$LDFLAGS -L$withval/lib"
408 CPPFLAGS="$CPPFLAGS -I$withval/include"
409 with_rrdtool="yes"
410 fi
411 ], [with_rrdtool="yes"])
412 if test "x$with_rrdtool" = "xyes"
413 then
414 AC_CHECK_LIB(rrd, rrd_update,
415 [
416 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
417 ],
418 [with_rrdtool="no (librrd not found)"], [-lm])
419 fi
420 if test "x$with_rrdtool" = "xyes"
421 then
422 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
423 fi
424 if test "x$with_rrdtool" = "xyes"
425 then
426 collect_rrdtool=1
427 else
428 collect_rrdtool=0
429 fi
430 AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
431 [Wether or not to use rrdtool library])
432 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
434 #AC_ARG_WITH(pth, [AS_HELP_STRING([--with-pth=@<:@=PREFIX@:>@], [Path to pth (experimental).]),
435 #[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
436 # then
437 # LDFLAGS="$LDFLAGS -L$withval/lib"
438 # CPPFLAGS="$CPPFLAGS -I$withval/include"
439 # with_pth="yes"
440 # fi
441 #], [with_pth="no"])
442 #if test "x$with_pth" = "xyes"
443 #then
444 # AC_CHECK_LIB(pth, pth_init,, [with_pth="no (libpth not found)"], [])
445 #fi
446 #if test "x$with_pth" = "xyes"
447 #then
448 # AC_CHECK_HEADERS(pth.h,, [with_pth="no (pth.h not found)"])
449 #fi
450 #if test "x$with_pth" = "xyes"
451 #then
452 # collect_pth=1
453 #else
454 # collect_pth=0
455 #fi
456 #AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
457 # [Wether or not to use pth (portable threads) library])
458 #AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
460 if test "$ac_system" = "Solaris"
461 then
462 with_kstat="yes"
463 else
464 with_kstat="no (Solaris only)"
465 fi
466 if test "x$with_kstat" = "xyes"
467 then
468 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (libkstat not found)"])
469 fi
470 if test "x$with_kstat" = "xyes"
471 then
472 AC_CHECK_LIB(devinfo, di_init)
473 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
474 fi
475 if test "x$with_kstat" = "xyes"
476 then
477 collect_kstat=1
478 else
479 collect_kstat=0
480 fi
481 AC_DEFINE_UNQUOTED(COLLECT_KSTAT, [$collect_kstat],
482 [Wether or not to use kstat library (Solaris)])
483 AM_CONDITIONAL(BUILD_WITH_KSTAT, test "x$with_kstat" = "xyes")
485 ### BEGIN of check for libcurl ###
486 with_curl_config="curl-config"
487 with_curl_prefix=0
488 with_curl_libs=""
489 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
490 [
491 if test "x$withval" != "xno" -a "x$withval" != "xyes"
492 then
493 if test -x "$withval/bin/curl-config"
494 then
495 with_curl_config="$withval/bin/curl-config"
496 with_curl_prefix=1
497 fi
498 fi
499 if test "x$withval" = "xno"
500 then
501 with_libcurl="no"
502 else
503 with_libcurl="yes"
504 fi
505 ],
506 [
507 with_libcurl="yes"
508 ])
509 if test "x$with_libcurl" = "xyes"
510 then
511 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
512 curl_config_status=$?
514 if test $curl_config_status -ne 0
515 then
516 with_libcurl="no"
517 else
518 AC_CHECK_LIB(curl, curl_easy_init,
519 [
520 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
521 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
522 ],
523 [
524 with_libcurl="no"
525 ],
526 [$with_curl_libs])
527 fi
528 fi
529 if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
530 then
531 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
532 curl_config_status=$?
534 if test $curl_config_status -ne 0
535 then
536 with_libcurl="no"
537 else
538 if test -d "$with_curl_prefix/include"
539 then
540 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
541 fi
542 fi
543 fi
545 with_libcurl_numeric=0
546 if test "x$with_libcurl" = "xyes"
547 then
548 with_libcurl_numeric=1
549 fi
550 AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
551 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
552 ### END of check for libcurl ###
554 with_libiokit="no"
555 collectd_libiokit=0
556 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
557 [
558 with_libiokit="yes"
559 collectd_libiokit=1
560 ],
561 [
562 with_libiokit="no"
563 collectd_libiokit=0
564 ])
565 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
566 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
568 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
569 [
570 if test "x$withval" != "xno" -a "x$withval" != "xyes"
571 then
572 LDFLAGS="$LDFLAGS -L$withval/lib"
573 CPPFLAGS="$CPPFLAGS -I$withval/include"
574 with_libstatgrab="yes"
575 fi
576 ],
577 [
578 if test "x$ac_system" == "xunknown"
579 then
580 with_libstatgrab="yes"
581 else
582 with_libstatgrab="no"
583 fi
584 ])
585 if test "x$with_libstatgrab" = "xyes"
586 then
587 AC_CHECK_LIB(devstat, getdevs)
588 AC_CHECK_LIB(kvm, kvm_getargv)
589 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (libstatgrab not found)"])
590 fi
591 if test "x$with_libstatgrab" = "xyes"
592 then
593 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
594 fi
595 if test "x$with_libstatgrab" = "xyes"
596 then
597 collect_libstatgrab=1
598 else
599 collect_libstatgrab=0
600 fi
601 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
602 [Wether or not to use statgrab library])
603 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
605 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
606 [
607 if test "x$withval" != "xno" && test "x$withval" != "xyes"
608 then
609 LDFLAGS="$LDFLAGS -L$withval/lib"
610 CPPFLAGS="$CPPFLAGS -I$withval/include"
611 with_lm_sensors="yes"
612 fi
613 ],
614 [
615 if test "x$ac_system" = "xLinux"
616 then
617 with_lm_sensors="yes"
618 else
619 with_lm_sensors="no"
620 fi
621 ])
622 if test "x$with_lm_sensors" = "xyes"
623 then
624 AC_CHECK_LIB(sensors, sensors_init,
625 [
626 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
627 ],
628 [with_lm_sensors="no (libsensors not found)"])
629 fi
630 if test "x$with_lm_sensors" = "xyes"
631 then
632 AC_CHECK_HEADERS(sensors/sensors.h,
633 [
634 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
635 ],
636 [with_lm_sensors="no (sensors/sensors.h not found)"])
637 fi
638 if test "x$with_lm_sensors" = "xyes"
639 then
640 collect_lm_sensors=1
641 else
642 collect_lm_sensors=0
643 fi
644 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
645 [Wether or not to use sensors library])
646 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
648 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
649 [
650 if test "x$withval" != "xno" && test "x$withval" != "xyes"
651 then
652 LDFLAGS="$LDFLAGS -L$withval/lib"
653 CPPFLAGS="$CPPFLAGS -I$withval/include"
654 with_libmysql="yes"
655 fi
656 ],
657 [
658 with_libmysql="yes"
659 ])
660 if test "x$with_libmysql" = "xyes"
661 then
662 AC_CHECK_LIB(mysqlclient, mysql_init,
663 [
664 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
665 ], [with_libmysql="no (libmysql not found)"])
666 fi
667 if test "x$with_libmysql" = "xyes"
668 then
669 AC_CHECK_HEADERS(mysql/mysql.h,
670 [
671 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
672 ], [with_libmysql="no (mysql/mysql.h not found)"])
673 fi
674 if test "x$with_libmysql" = "xyes"
675 then
676 collect_libmysql=1
677 else
678 collect_libmysql=0
679 fi
680 AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
681 [Wether or not to use mysql library])
682 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
684 # Define `step' and `hearbeat' values..
685 declare -i collectd_step=10
686 declare -i collectd_heartbeat=25
687 AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
688 [
689 if test "x$withval" != "xno" -a "x$withval" != "xyes"
690 then
691 declare -i tmp_collectd_step="$withval"
692 if test $tmp_collectd_step -gt 0
693 then
694 collectd_step=$tmp_collectd_step
695 let "collectd_heartbeat=$collectd_step*2"
696 fi
697 fi
698 ], [])
699 AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
700 [
701 if test "x$withval" != "xno" -a "x$withval" != "xyes"
702 then
703 declare -i tmp_collectd_heartbeat="$withval"
704 if test $tmp_collectd_heartbeat -gt 0
705 then
706 collectd_heartbeat=$tmp_collectd_heartbeat
707 fi
708 fi
709 ], [])
711 if test $collectd_step -ne 10
712 then
713 AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
714 fi
715 if test $collectd_heartbeat -ne 25
716 then
717 AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
718 fi
720 #
721 # Check for enabled/disabled features
722 #
724 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
725 # ------------------------------------------------------------
726 dnl
727 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
728 dnl
729 AC_DEFUN(
730 [AC_COLLECTD],
731 [
732 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
733 m4_if(
734 [$2],
735 [enable],
736 [dnl
737 m4_define([EnDis],[disabled])dnl
738 m4_define([YesNo],[no])dnl
739 ],dnl
740 [m4_if(
741 [$2],
742 [disable],
743 [dnl
744 m4_define([EnDis],[enabled])dnl
745 m4_define([YesNo],[yes])dnl
746 ],
747 [dnl
748 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
749 ]dnl
750 )]dnl
751 )dnl
752 m4_if([$3], [feature], [],
753 [m4_if(
754 [$3], [module], [],
755 [dnl
756 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
757 ]dnl
758 )]dnl
759 )dnl
760 AC_ARG_ENABLE(
761 [$1],
762 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
763 [],
764 enable_$1='[YesNo]'dnl
765 )# AC_ARG_ENABLE
766 if test "x$enable_$1" = "xno"
767 then
768 collectd_$1=0
769 else
770 if test "x$enable_$1" = "xyes"
771 then
772 collectd_$1=1
773 else
774 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
775 collectd_$1=1
776 enable_$1='yes'
777 fi
778 fi
779 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
780 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
781 ]dnl
782 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
784 m4_divert_once([HELP_ENABLE], [
785 collectd features:])
786 AC_COLLECTD([debug], [enable], [feature], [debugging])
787 AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
789 m4_divert_once([HELP_ENABLE], [
790 collectd modules:])
791 AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
792 AC_COLLECTD([battery], [disable], [module], [battery statistics])
793 AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
794 AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
795 AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
796 AC_COLLECTD([df], [disable], [module], [df statistics])
797 AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
798 AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
799 AC_COLLECTD([iokit], [disable], [module], [Apple's iokit hardware sensors])
800 AC_COLLECTD([load], [disable], [module], [system load statistics])
801 AC_COLLECTD([memory], [disable], [module], [memory statistics])
802 AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
803 AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
804 AC_COLLECTD([ping], [disable], [module], [ping statistics])
805 AC_COLLECTD([processes], [disable], [module], [processes statistics])
806 AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
807 AC_COLLECTD([serial], [disable], [module], [serial statistics])
808 AC_COLLECTD([swap], [disable], [module], [swap statistics])
809 AC_COLLECTD([tape], [disable], [module], [tape statistics])
810 AC_COLLECTD([traffic], [disable], [module], [system traffic statistics])
811 AC_COLLECTD([users], [disable], [module], [user count statistics])
812 AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
813 AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
815 #m4_divert_once([HELP_ENABLE], [
816 #collectd modules:])
817 #AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
818 #if test "x$enable_cpu" != "xno"
819 #then
820 # if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$have_sysctlbyname" = "xyes"
821 # then
822 # enable_cpu="yes"
823 # else
824 # enable_cpu="no"
825 # fi
826 #fi
827 #if test "x$enable_cpu" = "xno"
828 #then
829 # AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
830 #fi
831 #AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
833 #AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
834 #if test "x$enable_cpufreq" != "xno"
835 #then
836 # if test "x$ac_system" = "xLinux"
837 # then
838 # enable_cpufreq="yes"
839 # else
840 # enable_cpufreq="no"
841 # fi
842 #fi
843 #if test "x$enable_cpufreq" = "xno"
844 #then
845 # AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
846 #fi
847 #AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
849 #AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
850 #if test "x$enable_disk" != "xno"
851 #then
852 # if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
853 # then
854 # enable_disk="yes"
855 # else
856 # enable_disk="no"
857 # fi
858 #fi
859 #if test "x$enable_disk" = "xno"
860 #then
861 # AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
862 #fi
863 #AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
865 #AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
866 #if test "x$enable_hddtemp" = "xno"
867 #then
868 # AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
869 #fi
870 #AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
872 #AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
873 #if test "x$enable_load" != "xno"
874 #then
875 # if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
876 # then
877 # enable_load="yes"
878 # else
879 # enable_load="no"
880 # fi
881 #fi
882 #if test "x$enable_load" = "xno"
883 #then
884 # AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
885 #fi
886 #AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
888 #AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
889 #if test "x$enable_memory" != "xno"
890 #then
891 # if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
892 # then
893 # enable_memory="yes"
894 # else
895 # enable_memory="no"
896 # fi
897 #fi
898 #if test "x$enable_memory" = "xno"
899 #then
900 # AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
901 #fi
902 #AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
904 #AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
905 #if test "x$enable_nfs" != "xno"
906 #then
907 # if test "x$ac_system" = "xLinux"
908 # then
909 # enable_nfs="yes"
910 # else
911 # enable_nfs="no"
912 # fi
913 #fi
914 #if test "x$enable_nfs" = "xno"
915 #then
916 # AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
917 #fi
918 #AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
920 #AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
921 #if test "x$enable_ping" != "xno"
922 #then
923 # enable_ping="yes"
924 #fi
925 #if test "x$enable_ping" = "xno"
926 #then
927 # AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
928 #fi
929 #AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
931 #AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
932 #if test "x$enable_processes" != "xno"
933 #then
934 # if test "x$ac_system" = "xLinux"
935 # then
936 # enable_processes="yes"
937 # else
938 # enable_processes="no"
939 # fi
940 #fi
941 #if test "x$enable_processes" = "xno"
942 #then
943 # AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
944 #fi
945 #AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
947 ##AC_COLLECTD([quota], [enable], [module], [quota statistics (experimental)])
949 #AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
950 #if test "x$enable_sensors" != "xno"
951 #then
952 # if test "x$with_lm_sensors" = "xyes"
953 # then
954 # enable_sensors="yes"
955 # else
956 # enable_sensors="no"
957 # fi
958 #fi
959 #if test "x$enable_sensors" = "xno"
960 #then
961 # AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
962 #fi
963 #AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
965 #AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
966 #if test "x$enable_serial" != "xno"
967 #then
968 # if test "x$ac_system" = "xLinux"
969 # then
970 # enable_serial="yes"
971 # else
972 # enable_serial="no"
973 # fi
974 #fi
975 #if test "x$enable_serial" = "xno"
976 #then
977 # AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
978 #fi
979 #AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
981 #AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
982 #if test "x$enable_swap" != "xno"
983 #then
984 # if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
985 # then
986 # enable_swap="yes"
987 # else
988 # enable_swap="no"
989 # fi
990 #fi
991 #if test "x$enable_swap" = "xno"
992 #then
993 # AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
994 #fi
995 #AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
997 #AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
998 #if test "x$enable_tape" != "xno"
999 #then
1000 # if test "x$with_kstat" = "xyes"
1001 # then
1002 # enable_tape="yes"
1003 # else
1004 # enable_tape="no"
1005 # fi
1006 #fi
1007 #if test "x$enable_tape" = "xno"
1008 #then
1009 # AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
1010 #fi
1011 #AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
1013 #AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
1014 #if test "x$enable_traffic" != "xno"
1015 #then
1016 # if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
1017 # then
1018 # enable_traffic="yes"
1019 # else
1020 # enable_traffic="no"
1021 # fi
1022 #fi
1023 #if test "x$enable_traffic" = "xno"
1024 #then
1025 # AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
1026 #fi
1027 #AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
1029 #AC_COLLECTD([users], [disable], [module], [user count statistics])
1031 AC_OUTPUT(Makefile src/libconfig/Makefile src/liboping/Makefile src/Makefile)
1033 cat <<EOF;
1035 Configuration:
1036 Libraries:
1037 libcurl . . . . . . $with_libcurl
1038 libiokit . . . . . $with_libiokit
1039 librrd . . . . . . $with_rrdtool
1040 lm_sensors . . . . $with_lm_sensors
1041 libstatgrab . . . . $with_libstatgrab
1042 libkstat . . . . . $with_kstat
1043 libmysql . . . . . $with_libmysql
1045 Features:
1046 debug . . . . . . . $enable_debug
1047 daemon mode . . . . $enable_daemon
1048 step . . . . . . . $collectd_step seconds
1049 heartbeat . . . . . $collectd_heartbeat seconds
1051 Modules:
1052 battery . . . . . . $enable_battery
1053 cpu . . . . . . . . $enable_cpu
1054 cpufreq . . . . . . $enable_cpufreq
1055 df . . . . . . . . $enable_df
1056 disk . . . . . . . $enable_disk
1057 hddtemp . . . . . . $enable_hddtemp
1058 iokit . . . . . . . $enable_iokit
1059 load . . . . . . . $enable_load
1060 memory . . . . . . $enable_memory
1061 mysql . . . . . . . $enable_mysql
1062 nfs . . . . . . . . $enable_nfs
1063 ping . . . . . . . $enable_ping
1064 processes . . . . . $enable_processes
1065 sensors . . . . . . $enable_sensors
1066 serial . . . . . . $enable_serial
1067 swap . . . . . . . $enable_swap
1068 tape . . . . . . . $enable_tape
1069 traffic . . . . . . $enable_traffic
1070 users . . . . . . . $enable_users
1071 vserver . . . . . . $enable_vserver
1072 wireless . . . . . $enable_wireless
1074 EOF