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