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