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