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