1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.5.alpha2)
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
8 AC_PREFIX_DEFAULT("/opt/collectd")
11 # Checks for programs.
21 AC_LIBLTDL_CONVENIENCE
27 AC_CONFIG_SUBDIRS(libltdl src/libconfig)
30 # Checks for header files.
34 AC_CHECK_HEADERS(fcntl.h)
35 AC_CHECK_HEADERS(signal.h)
36 AC_CHECK_HEADERS(sys/socket.h)
37 AC_CHECK_HEADERS(sys/select.h)
38 AC_CHECK_HEADERS(netdb.h)
39 AC_CHECK_HEADERS(sys/resource.h)
40 AC_CHECK_HEADERS(errno.h)
41 AC_CHECK_HEADERS(syslog.h)
44 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
47 AC_CHECK_HEADERS(sys/loadavg.h)
50 AC_CHECK_HEADERS(arpa/inet.h)
51 AC_CHECK_HEADERS(netinet/in.h)
54 AC_CHECK_HEADERS(utmp.h)
55 AC_CHECK_HEADERS(utmpx.h)
58 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
59 AC_CHECK_HEADERS(ctype.h)
60 AC_CHECK_HEADERS(limits.h)
61 AC_CHECK_HEADERS(sys/quota.h)
62 AC_CHECK_HEADERS(xfs/xqm.h)
65 AC_CHECK_HEADERS(fs_info.h)
66 AC_CHECK_HEADERS(fshelp.h)
67 AC_CHECK_HEADERS(paths.h)
68 AC_CHECK_HEADERS(mntent.h)
69 AC_CHECK_HEADERS(mnttab.h)
70 AC_CHECK_HEADERS(sys/fstyp.h)
71 AC_CHECK_HEADERS(sys/fs_types.h)
72 AC_CHECK_HEADERS(sys/mntent.h)
73 AC_CHECK_HEADERS(sys/mnttab.h)
74 AC_CHECK_HEADERS(sys/mount.h)
75 AC_CHECK_HEADERS(sys/statfs.h)
76 AC_CHECK_HEADERS(sys/vfs.h)
77 AC_CHECK_HEADERS(sys/vfstab.h)
79 # For debugging interface (variable number of arguments)
80 AC_CHECK_HEADERS(stdarg.h)
82 dnl Checking for libraries
86 # Checks for typedefs, structures, and compiler characteristics.
95 # Checks for library functions.
97 AC_PROG_GCC_TRADITIONAL
98 AC_CHECK_FUNCS(gettimeofday select strdup strtol)
99 AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
100 AC_CHECK_FUNCS(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
101 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
102 AC_CHECK_FUNCS(strncasecmp strcasecmp)
105 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
108 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
112 AC_CHECK_FUNCS(getutent getutxent, [have_getutent="yes"])
115 AC_CHECK_FUNCS(quotactl)
116 AC_CHECK_FUNCS(getgrgid getpwuid)
118 # For mount interface
119 AC_CHECK_FUNCS(getfsent getvfsent listmntent)
121 if test "x$ac_cv_func_getmntent" = 'xyes'; then
123 CFLAGS="-Wall -Werror $CFLAGS"
124 AC_CACHE_CHECK([whether getmntent takes one argument],
127 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
128 #include "$srcdir/src/utils_mount.h"]],
129 [[(void)getmntent((FILE *)NULL);]]
131 [fu_cv_getmntent1=yes],
132 [fu_cv_getmntent1=no]
135 if test "x$fu_cv_getmntent1" = 'xno'; then
136 AC_CACHE_CHECK([whether getmntent takes two arguments],
139 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
140 #include "$srcdir/src/utils_mount.h"]],
141 [[(void)getmntent((FILE *)NULL,
142 (struct mnttab *)NULL);]]
144 [fu_cv_getmntent2=yes],
145 [fu_cv_getmntent2=no]
151 if test "x$fu_cv_getmntent1" = 'xyes'; then
152 AC_DEFINE(HAVE_GETMNTENT1,
154 [Define if there is a function named getmntent
155 for reading the list of mounted filesystems, and
156 that function takes a single argument. (4.3BSD,
157 SunOS, HP-UX, Dynix, Irix, Linux)]
160 if test "x$fu_cv_getmntent2" = 'xyes'; then
161 AC_DEFINE(HAVE_GETMNTENT2,
163 [Define if there is a function named getmntent
164 for reading the list of mounted filesystems, and
165 that function takes two arguments. (SVR4)]
169 AC_MSG_CHECKING([for kernel type ($host_os)])
172 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
176 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
182 AC_MSG_RESULT([$ac_system])
184 dnl Checks for libraries.
185 AC_CHECK_LIB(socket, socket)
186 AC_CHECK_LIB(resolv, res_search)
188 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
189 AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
190 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
192 LDFLAGS="$LDFLAGS -L$withval/lib"
193 CPPFLAGS="$CPPFLAGS -I$withval/include"
196 ], [with_rrdtool="yes"])
197 if test "x$with_rrdtool" = "xyes"
199 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
201 if test "x$with_rrdtool" = "xyes"
203 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
205 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
207 #AC_ARG_WITH(pth, AC_HELP_STRING([--with-pth=PFX], [Path to pth (experimental).]),
208 #[ if test "x$withval" != "xno" -a "x$withval" != "xyes"
210 # LDFLAGS="$LDFLAGS -L$withval/lib"
211 # CPPFLAGS="$CPPFLAGS -I$withval/include"
215 #if test "x$with_pth" = "xyes"
217 # AC_CHECK_LIB(pth, pth_init,, [with_pth="no"], [])
219 #if test "x$with_pth" = "xyes"
221 # AC_CHECK_HEADERS(pth.h,, [with_pth="no"])
223 #if test "x$with_pth" = "xyes"
229 #AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
230 # [Wether or not to use pth (portable threads) library])
231 #AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
233 if test "$ac_system" = "Solaris"
236 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
237 AC_CHECK_LIB(devinfo, di_init)
238 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
240 with_kstat="no (Solaris only)"
243 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
246 if test "x$withval" != "xno"
248 if test "x$withval" != "xyes"
250 LDFLAGS="$LDFLAGS -L$withval/lib"
251 CPPFLAGS="$CPPFLAGS -I$withval/include"
252 with_libstatgrab="yes"
258 if test "x$ac_system" != "xunknown"
260 with_libstatgrab="no"
262 with_libstatgrab="yes"
265 if test "x$with_libstatgrab" = "xyes"
267 AC_CHECK_LIB(devstat, getdevs)
268 AC_CHECK_LIB(kvm, kvm_getargv)
269 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
270 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
273 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
276 if test "x$withval" != "xno"
278 if test "x$withval" != "xyes"
280 LDFLAGS="$LDFLAGS -L$withval/lib"
281 CPPFLAGS="$CPPFLAGS -I$withval/include"
282 with_lm_sensors="yes"
288 if test "x$ac_system" = "xLinux"
290 with_lm_sensors="yes"
295 if test "x$with_lm_sensors" = "xyes"
297 AC_CHECK_LIB(sensors, sensors_init,
299 with_lm_sensors="yes"
300 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
302 [with_lm_sensors="no (not found)"])
303 AC_CHECK_HEADERS(sensors/sensors.h,
305 with_lm_sensors="yes"
306 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
308 [with_lm_sensors="no (not found)"])
314 # Check for enabled/disabled features
316 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
317 [Enable debugging (disabled by default)]),
318 [], [enable_debug="no"])
319 if test "x$enable_debug" = "xno"
323 if test "x$enable_debug" = "xyes"
327 AC_MSG_NOTICE([Please specify either --enable-debug or --disable-debug; Enabling debugging.])
332 AC_DEFINE_UNQUOTED(COLLECT_DEBUG, [$collect_debug],
333 [Wether or not to enable debugging])
334 AM_CONDITIONAL(BUILD_DEBUG, test "x$enable_debug" = "xyes")
336 AC_ARG_ENABLE(daemon, AC_HELP_STRING([--disable-daemon],
337 [Disable daemon mode (enabled by default)]),
338 [], [enable_daemon="yes"])
339 if test "x$enable_daemon" = "xno"
343 if test "x$enable_daemon" = "xyes"
347 AC_MSG_NOTICE([Please specify either --enable-daemon or --disable-daemon; Enabling daemon mode.])
352 AC_DEFINE_UNQUOTED(COLLECT_DAEMON, [$collect_daemon],
353 [Wether or not to enable daemon mode])
354 AM_CONDITIONAL(BUILD_DAEMON, test "x$enable_daemon" = "xyes")
356 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
357 if test "x$enable_cpu" != "xno"
359 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$have_sysctlbyname" = "xyes"
366 if test "x$enable_cpu" = "xno"
368 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
370 AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
372 AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
373 if test "x$enable_cpufreq" != "xno"
375 if test "x$ac_system" = "xLinux"
382 if test "x$enable_cpufreq" = "xno"
384 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
386 AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
388 AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
389 if test "x$enable_disk" != "xno"
391 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
398 if test "x$enable_disk" = "xno"
400 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
402 AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
404 AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
405 if test "x$enable_hddtemp" = "xno"
407 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
409 AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
411 AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
412 if test "x$enable_load" != "xno"
414 if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
421 if test "x$enable_load" = "xno"
423 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
425 AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
427 AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
428 if test "x$enable_memory" != "xno"
430 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
437 if test "x$enable_memory" = "xno"
439 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
441 AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
443 AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
444 if test "x$enable_nfs" != "xno"
446 if test "x$ac_system" = "xLinux"
453 if test "x$enable_nfs" = "xno"
455 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
457 AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
459 AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
460 if test "x$enable_ping" != "xno"
464 if test "x$enable_ping" = "xno"
466 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
468 AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
470 AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
471 if test "x$enable_processes" != "xno"
473 if test "x$ac_system" = "xLinux"
475 enable_processes="yes"
477 enable_processes="no"
480 if test "x$enable_processes" = "xno"
482 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
484 AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
486 #AC_ARG_ENABLE(quota, AC_HELP_STRING([--enable-quota],
487 # [Enable quota statistics (experimental, disabled by default)]),
488 # [], [enable_quota="no"])
489 #if test "x$enable_quota" = "xno"
493 # if test "x$enable_quota" = "xyes"
497 # AC_MSG_NOTICE([Please specify either --enable-quota or --disable-quota; Enabling quota statistics.])
502 #AC_DEFINE_UNQUOTED(COLLECT_QUOTA, [$collect_quota],
503 # [Wether or not to collect quota statistics])
504 #AM_CONDITIONAL(BUILD_MODULE_QUOTA, test "x$enable_quota" = "xyes")
506 AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
507 if test "x$enable_sensors" != "xno"
509 if test "x$with_lm_sensors" = "xyes"
516 if test "x$enable_sensors" = "xno"
518 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
520 AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
522 AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
523 if test "x$enable_serial" != "xno"
525 if test "x$ac_system" = "xLinux"
532 if test "x$enable_serial" = "xno"
534 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
536 AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
538 AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
539 if test "x$enable_swap" != "xno"
541 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
548 if test "x$enable_swap" = "xno"
550 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
552 AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
554 AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
555 if test "x$enable_tape" != "xno"
557 if test "x$with_kstat" = "xyes"
564 if test "x$enable_tape" = "xno"
566 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
568 AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
570 AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
571 if test "x$enable_traffic" != "xno"
573 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
580 if test "x$enable_traffic" = "xno"
582 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
584 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
586 AC_ARG_ENABLE(users, AC_HELP_STRING([--disable-users], [Disable user count statistics]),, [enable_users="yes"])
587 if test "x$enable_users" != "xno"
589 if test "x$have_getutent" = "xyes"
596 if test "x$enable_users" = "xno"
598 AC_DEFINE(COLLECT_USERS, 0, [Wether or not to collect user count statistics])
600 AM_CONDITIONAL(BUILD_MODULE_USERS, test "x$enable_users" = "xyes")
602 AC_OUTPUT(Makefile src/libconfig/Makefile src/libping/Makefile src/Makefile)
608 librrd . . . . . . $with_rrdtool
609 lm_sensors . . . . $with_lm_sensors
610 libstatgrab . . . . $with_libstatgrab
611 libkstat . . . . . $with_kstat
614 debug . . . . . . . $enable_debug
615 daemon mode . . . . $enable_daemon
618 cpu . . . . . . . . $enable_cpu
619 cpufreq . . . . . . $enable_cpufreq
620 disk . . . . . . . $enable_disk
621 hddtemp . . . . . . $enable_hddtemp
622 load . . . . . . . $enable_load
623 memory . . . . . . $enable_memory
624 nfs . . . . . . . . $enable_nfs
625 ping . . . . . . . $enable_ping
626 processes . . . . . $enable_processes
627 sensors . . . . . . $enable_sensors
628 serial . . . . . . $enable_serial
629 swap . . . . . . . $enable_swap
630 tape . . . . . . . $enable_tape
631 traffic . . . . . . $enable_traffic
632 users . . . . . . . $enable_users