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