1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(src/collectd.c)
3 AM_INIT_AUTOMAKE(collectd, 3.5.alpha0)
4 AM_CONFIG_HEADER(src/config.h src/libping/config.h)
7 AC_PREFIX_DEFAULT("/opt/collectd")
10 # Checks for programs.
25 # Checks for header files.
29 AC_CHECK_HEADERS(fcntl.h unistd.h)
30 AC_CHECK_HEADERS(signal.h)
31 AC_CHECK_HEADERS(sys/socket.h)
32 AC_CHECK_HEADERS(sys/select.h)
33 AC_CHECK_HEADERS(netdb.h)
34 AC_CHECK_HEADERS(sys/time.h sys/times.h)
35 AC_CHECK_HEADERS(sys/types.h)
36 AC_CHECK_HEADERS(sys/resource.h)
37 AC_CHECK_HEADERS(errno.h)
38 AC_CHECK_HEADERS(syslog.h)
39 AC_CHECK_HEADERS(dlfcn.h)
42 AC_CHECK_HEADERS(sys/loadavg.h)
45 AC_CHECK_HEADERS(arpa/inet.h)
46 AC_CHECK_HEADERS(netinet/in.h)
47 AC_CHECK_HEADERS(netdb.h)
50 AC_CHECK_HEADERS(utmp.h)
51 AC_CHECK_HEADERS(utmpx.h)
53 dnl Checking for libraries
57 # Checks for typedefs, structures, and compiler characteristics.
65 # Checks for library functions.
67 AC_PROG_GCC_TRADITIONAL
68 AC_CHECK_FUNCS(gettimeofday select socket strdup strstr strtol)
69 AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
70 AC_CHECK_FUNCS(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
71 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
72 AC_CHECK_FUNCS(strncasecmp strcasecmp strncmp)
75 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
79 AC_CHECK_FUNCS(getutent getutxent, [have_getutent="yes"])
81 AC_MSG_CHECKING([for kernel type ($host_os)])
84 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
88 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
94 AC_MSG_RESULT([$ac_system])
96 dnl Checks for libraries.
97 AC_CHECK_LIB(socket, socket)
98 AC_CHECK_LIB(resolv, res_search)
99 AC_CHECK_LIB(dl, dlopen)
101 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
102 AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
103 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
105 LDFLAGS="$LDFLAGS -L$withval/lib"
106 CPPFLAGS="$CPPFLAGS -I$withval/include"
109 ], [with_rrdtool="yes"])
110 if test "x$with_rrdtool" = "xyes"
112 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
114 if test "x$with_rrdtool" = "xyes"
116 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
118 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
120 if test "$ac_system" = "Solaris"
123 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
124 AC_CHECK_LIB(devinfo, di_init)
125 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
127 with_kstat="no (Solaris only)"
130 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
133 if test "x$withval" != "xno"
135 if test "x$withval" != "xyes"
137 LDFLAGS="$LDFLAGS -L$withval/lib"
138 CPPFLAGS="$CPPFLAGS -I$withval/include"
139 with_libstatgrab="yes"
145 if test "x$ac_system" != "xunknown"
147 with_libstatgrab="no"
149 with_libstatgrab="yes"
152 if test "x$with_libstatgrab" = "xyes"
154 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
155 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
158 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
161 if test "x$withval" != "xno"
163 if test "x$withval" != "xyes"
165 LDFLAGS="$LDFLAGS -L$withval/lib"
166 CPPFLAGS="$CPPFLAGS -I$withval/include"
167 with_lm_sensors="yes"
173 if test "x$ac_system" = "xLinux"
175 with_lm_sensors="yes"
180 if test "x$with_lm_sensors" = "xyes"
182 AC_CHECK_LIB(sensors, sensors_init,
184 with_lm_sensors="yes"
185 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
187 [with_lm_sensors="no (not found)"])
188 AC_CHECK_HEADERS(sensors/sensors.h,
190 with_lm_sensors="yes"
191 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
193 [with_lm_sensors="no (not found)"])
199 # Check for enabled/disabled features
201 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
202 if test "x$enable_cpu" != "xno"
204 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
211 if test "x$enable_cpu" = "xno"
213 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
215 AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
217 AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
218 if test "x$enable_cpufreq" != "xno"
220 if test "x$ac_system" = "xLinux"
227 if test "x$enable_cpufreq" = "xno"
229 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
231 AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
233 AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
234 if test "x$enable_disk" != "xno"
236 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
243 if test "x$enable_disk" = "xno"
245 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
247 AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
249 AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
250 if test "x$enable_hddtemp" = "xno"
252 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
254 AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
256 AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
257 if test "x$enable_load" != "xno"
259 if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
266 if test "x$enable_load" = "xno"
268 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
270 AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
272 AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
273 if test "x$enable_memory" != "xno"
275 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
282 if test "x$enable_memory" = "xno"
284 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
286 AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
288 AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
289 if test "x$enable_nfs" != "xno"
291 if test "x$ac_system" = "xLinux"
298 if test "x$enable_nfs" = "xno"
300 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
302 AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
304 AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
305 if test "x$enable_ping" != "xno"
309 if test "x$enable_ping" = "xno"
311 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
313 AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
315 AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
316 if test "x$enable_processes" != "xno"
318 if test "x$ac_system" = "xLinux"
320 enable_processes="yes"
322 enable_processes="no"
325 if test "x$enable_processes" = "xno"
327 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
329 AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
331 AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
332 if test "x$enable_sensors" != "xno"
334 if test "x$with_lm_sensors" = "xyes"
341 if test "x$enable_sensors" = "xno"
343 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
345 AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
347 AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
348 if test "x$enable_serial" != "xno"
350 if test "x$ac_system" = "xLinux"
357 if test "x$enable_serial" = "xno"
359 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
361 AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
363 AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
364 if test "x$enable_swap" != "xno"
366 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
373 if test "x$enable_swap" = "xno"
375 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
377 AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
379 AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
380 if test "x$enable_tape" != "xno"
382 if test "x$with_kstat" = "xyes"
389 if test "x$enable_tape" = "xno"
391 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
393 AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
395 AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
396 if test "x$enable_traffic" != "xno"
398 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
405 if test "x$enable_traffic" = "xno"
407 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
409 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
411 AC_ARG_ENABLE(users, AC_HELP_STRING([--disable-users], [Disable user count statistics]),, [enable_users="yes"])
412 if test "x$enable_users" != "xno"
414 if test "x$have_getutent" = "xyes"
421 if test "x$enable_users" = "xno"
423 AC_DEFINE(COLLECT_USERS, 0, [Wether or not to collect user count statistics])
425 AM_CONDITIONAL(BUILD_MODULE_USERS, test "x$enable_users" = "xyes")
427 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
433 librrd . . . . . . $with_rrdtool
434 lm_sensors . . . . $with_lm_sensors
435 libstatgrab . . . . $with_libstatgrab
436 libkstat . . . . . $with_kstat
439 cpu . . . . . . . . $enable_cpu
440 cpufreq . . . . . . $enable_cpufreq
441 disk . . . . . . . $enable_disk
442 hddtemp . . . . . . $enable_hddtemp
443 load . . . . . . . $enable_load
444 memory . . . . . . $enable_memory
445 nfs . . . . . . . . $enable_nfs
446 ping . . . . . . . $enable_ping
447 processes . . . . . $enable_processes
448 sensors . . . . . . $enable_sensors
449 serial . . . . . . $enable_serial
450 swap . . . . . . . $enable_swap
451 tape . . . . . . . $enable_tape
452 traffic . . . . . . $enable_traffic
453 users . . . . . . . $enable_users