1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, 3.5.0)
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)
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(sys/param.h)
41 AC_CHECK_HEADERS(errno.h)
42 AC_CHECK_HEADERS(syslog.h)
45 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
48 AC_CHECK_HEADERS(sys/loadavg.h)
51 AC_CHECK_HEADERS(arpa/inet.h)
52 AC_CHECK_HEADERS(netinet/in.h)
55 AC_CHECK_HEADERS(utmp.h)
56 AC_CHECK_HEADERS(utmpx.h)
59 AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
60 AC_CHECK_HEADERS(ctype.h)
61 AC_CHECK_HEADERS(limits.h)
62 AC_CHECK_HEADERS(sys/quota.h)
63 AC_CHECK_HEADERS(xfs/xqm.h)
66 AC_CHECK_HEADERS(fs_info.h)
67 AC_CHECK_HEADERS(fshelp.h)
68 AC_CHECK_HEADERS(paths.h)
69 AC_CHECK_HEADERS(mntent.h)
70 AC_CHECK_HEADERS(mnttab.h)
71 AC_CHECK_HEADERS(sys/fstyp.h)
72 AC_CHECK_HEADERS(sys/fs_types.h)
73 AC_CHECK_HEADERS(sys/mntent.h)
74 AC_CHECK_HEADERS(sys/mnttab.h)
75 AC_CHECK_HEADERS(sys/mount.h)
76 AC_CHECK_HEADERS(sys/statfs.h)
77 AC_CHECK_HEADERS(sys/vfs.h)
78 AC_CHECK_HEADERS(sys/vfstab.h)
80 # For debugging interface (variable number of arguments)
81 AC_CHECK_HEADERS(stdarg.h)
83 dnl Checking for libraries
87 # 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)
103 AC_CHECK_FUNCS(openlog syslog closelog)
106 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
109 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
113 AC_CHECK_FUNCS(getutent getutxent, [have_getutent="yes"])
116 AC_CHECK_FUNCS(quotactl)
117 AC_CHECK_FUNCS(getgrgid getpwuid)
119 # For mount interface
120 AC_CHECK_FUNCS(getfsent getvfsent listmntent)
122 if test "x$ac_cv_func_getmntent" = 'xyes'; then
124 CFLAGS="-Wall -Werror $CFLAGS"
125 AC_CACHE_CHECK([whether getmntent takes one argument],
128 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
129 #include "$srcdir/src/utils_mount.h"]],
130 [[(void)getmntent((FILE *)NULL);]]
132 [fu_cv_getmntent1=yes],
133 [fu_cv_getmntent1=no]
136 if test "x$fu_cv_getmntent1" = 'xno'; then
137 AC_CACHE_CHECK([whether getmntent takes two arguments],
140 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
141 #include "$srcdir/src/utils_mount.h"]],
142 [[(void)getmntent((FILE *)NULL,
143 (struct mnttab *)NULL);]]
145 [fu_cv_getmntent2=yes],
146 [fu_cv_getmntent2=no]
152 if test "x$fu_cv_getmntent1" = 'xyes'; then
153 AC_DEFINE(HAVE_GETMNTENT1,
155 [Define if there is a function named getmntent
156 for reading the list of mounted filesystems, and
157 that function takes a single argument. (4.3BSD,
158 SunOS, HP-UX, Dynix, Irix, Linux)]
161 if test "x$fu_cv_getmntent2" = 'xyes'; then
162 AC_DEFINE(HAVE_GETMNTENT2,
164 [Define if there is a function named getmntent
165 for reading the list of mounted filesystems, and
166 that function takes two arguments. (SVR4)]
170 AC_MSG_CHECKING([for kernel type ($host_os)])
173 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
177 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
183 AC_MSG_RESULT([$ac_system])
185 dnl Checks for libraries.
186 AC_CHECK_LIB(socket, socket)
187 AC_CHECK_LIB(resolv, res_search)
189 m4_divert_once([HELP_WITH], [
190 collectd additional packages:])
192 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
193 AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
194 [ if test "x$withval" != "xno" && test "x$withval" != "xyes"
196 LDFLAGS="$LDFLAGS -L$withval/lib"
197 CPPFLAGS="$CPPFLAGS -I$withval/include"
200 ], [with_rrdtool="yes"])
201 if test "x$with_rrdtool" = "xyes"
203 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
205 if test "x$with_rrdtool" = "xyes"
207 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
209 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
211 #AC_ARG_WITH(pth, AC_HELP_STRING([--with-pth=PFX], [Path to pth (experimental).]),
212 #[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
214 # LDFLAGS="$LDFLAGS -L$withval/lib"
215 # CPPFLAGS="$CPPFLAGS -I$withval/include"
219 #if test "x$with_pth" = "xyes"
221 # AC_CHECK_LIB(pth, pth_init,, [with_pth="no"], [])
223 #if test "x$with_pth" = "xyes"
225 # AC_CHECK_HEADERS(pth.h,, [with_pth="no"])
227 #if test "x$with_pth" = "xyes"
233 #AC_DEFINE_UNQUOTED(COLLECT_PTH, [$collect_pth],
234 # [Wether or not to use pth (portable threads) library])
235 #AM_CONDITIONAL(BUILD_WITH_PTH, test "x$with_pth" = "xyes")
237 if test "$ac_system" = "Solaris"
240 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
241 AC_CHECK_LIB(devinfo, di_init)
242 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
244 with_kstat="no (Solaris only)"
247 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
250 if test "x$withval" != "xno" && test "x$withval" != "xyes"
252 LDFLAGS="$LDFLAGS -L$withval/lib"
253 CPPFLAGS="$CPPFLAGS -I$withval/include"
254 with_libstatgrab="yes"
259 if test "x$ac_system" != "xunknown"
261 with_libstatgrab="no"
263 with_libstatgrab="yes"
266 if test "x$with_libstatgrab" = "xyes"
268 AC_CHECK_LIB(devstat, getdevs)
269 AC_CHECK_LIB(kvm, kvm_getargv)
270 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
271 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
274 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
277 if test "x$withval" != "xno"
279 if test "x$withval" != "xyes"
281 LDFLAGS="$LDFLAGS -L$withval/lib"
282 CPPFLAGS="$CPPFLAGS -I$withval/include"
283 with_lm_sensors="yes"
289 if test "x$ac_system" = "xLinux"
291 with_lm_sensors="yes"
296 if test "x$with_lm_sensors" = "xyes"
298 AC_CHECK_LIB(sensors, sensors_init,
300 with_lm_sensors="yes"
301 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
303 [with_lm_sensors="no (not found)"])
304 AC_CHECK_HEADERS(sensors/sensors.h,
306 with_lm_sensors="yes"
307 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
309 [with_lm_sensors="no (not found)"])
315 # Check for enabled/disabled features
317 m4_divert_once([HELP_ENABLE], [
319 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
320 [Enable debugging (disabled by default)]),
321 [], [enable_debug="no"])
322 if test "x$enable_debug" = "xno"
326 if test "x$enable_debug" = "xyes"
330 AC_MSG_NOTICE([Please specify either --enable-debug or --disable-debug; Enabling debugging.])
335 AC_DEFINE_UNQUOTED(COLLECT_DEBUG, [$collect_debug],
336 [Wether or not to enable debugging])
337 AM_CONDITIONAL(BUILD_DEBUG, test "x$enable_debug" = "xyes")
339 AC_ARG_ENABLE(daemon, AC_HELP_STRING([--disable-daemon],
340 [Disable daemon mode (enabled by default)]),
341 [], [enable_daemon="yes"])
342 if test "x$enable_daemon" = "xno"
346 if test "x$enable_daemon" = "xyes"
350 AC_MSG_NOTICE([Please specify either --enable-daemon or --disable-daemon; Enabling daemon mode.])
355 AC_DEFINE_UNQUOTED(COLLECT_DAEMON, [$collect_daemon],
356 [Wether or not to enable daemon mode])
357 AM_CONDITIONAL(BUILD_DAEMON, test "x$enable_daemon" = "xyes")
359 m4_divert_once([HELP_ENABLE], [
361 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
362 if test "x$enable_cpu" != "xno"
364 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$have_sysctlbyname" = "xyes"
371 if test "x$enable_cpu" = "xno"
373 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
375 AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
377 AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
378 if test "x$enable_cpufreq" != "xno"
380 if test "x$ac_system" = "xLinux"
387 if test "x$enable_cpufreq" = "xno"
389 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
391 AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
393 AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
394 if test "x$enable_disk" != "xno"
396 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
403 if test "x$enable_disk" = "xno"
405 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
407 AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
409 AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
410 if test "x$enable_hddtemp" = "xno"
412 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
414 AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
416 AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
417 if test "x$enable_load" != "xno"
419 if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
426 if test "x$enable_load" = "xno"
428 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
430 AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
432 AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
433 if test "x$enable_memory" != "xno"
435 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
442 if test "x$enable_memory" = "xno"
444 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
446 AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
448 AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
449 if test "x$enable_nfs" != "xno"
451 if test "x$ac_system" = "xLinux"
458 if test "x$enable_nfs" = "xno"
460 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
462 AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
464 AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
465 if test "x$enable_ping" != "xno"
469 if test "x$enable_ping" = "xno"
471 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
473 AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
475 AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
476 if test "x$enable_processes" != "xno"
478 if test "x$ac_system" = "xLinux"
480 enable_processes="yes"
482 enable_processes="no"
485 if test "x$enable_processes" = "xno"
487 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
489 AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
491 #AC_ARG_ENABLE(quota, AC_HELP_STRING([--enable-quota],
492 # [Enable quota statistics (experimental, disabled by default)]),
493 # [], [enable_quota="no"])
494 #if test "x$enable_quota" = "xno"
498 # if test "x$enable_quota" = "xyes"
502 # AC_MSG_NOTICE([Please specify either --enable-quota or --disable-quota; Enabling quota statistics.])
507 #AC_DEFINE_UNQUOTED(COLLECT_QUOTA, [$collect_quota],
508 # [Wether or not to collect quota statistics])
509 #AM_CONDITIONAL(BUILD_MODULE_QUOTA, test "x$enable_quota" = "xyes")
511 AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
512 if test "x$enable_sensors" != "xno"
514 if test "x$with_lm_sensors" = "xyes"
521 if test "x$enable_sensors" = "xno"
523 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
525 AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
527 AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
528 if test "x$enable_serial" != "xno"
530 if test "x$ac_system" = "xLinux"
537 if test "x$enable_serial" = "xno"
539 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
541 AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
543 AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
544 if test "x$enable_swap" != "xno"
546 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
553 if test "x$enable_swap" = "xno"
555 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
557 AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
559 AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
560 if test "x$enable_tape" != "xno"
562 if test "x$with_kstat" = "xyes"
569 if test "x$enable_tape" = "xno"
571 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
573 AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
575 AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
576 if test "x$enable_traffic" != "xno"
578 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
585 if test "x$enable_traffic" = "xno"
587 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
589 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
591 AC_ARG_ENABLE(users, AC_HELP_STRING([--disable-users], [Disable user count statistics]),, [enable_users="yes"])
592 if test "x$enable_users" != "xno"
594 if test "x$have_getutent" = "xyes"
601 if test "x$enable_users" = "xno"
603 AC_DEFINE(COLLECT_USERS, 0, [Wether or not to collect user count statistics])
605 AM_CONDITIONAL(BUILD_MODULE_USERS, test "x$enable_users" = "xyes")
607 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
613 librrd . . . . . . $with_rrdtool
614 lm_sensors . . . . $with_lm_sensors
615 libstatgrab . . . . $with_libstatgrab
616 libkstat . . . . . $with_kstat
619 debug . . . . . . . $enable_debug
620 daemon mode . . . . $enable_daemon
623 cpu . . . . . . . . $enable_cpu
624 cpufreq . . . . . . $enable_cpufreq
625 disk . . . . . . . $enable_disk
626 hddtemp . . . . . . $enable_hddtemp
627 load . . . . . . . $enable_load
628 memory . . . . . . $enable_memory
629 nfs . . . . . . . . $enable_nfs
630 ping . . . . . . . $enable_ping
631 processes . . . . . $enable_processes
632 sensors . . . . . . $enable_sensors
633 serial . . . . . . $enable_serial
634 swap . . . . . . . $enable_swap
635 tape . . . . . . . $enable_tape
636 traffic . . . . . . $enable_traffic
637 users . . . . . . . $enable_users