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