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