1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(src/collectd.c)
3 AM_INIT_AUTOMAKE(collectd, 3.4.0)
4 AM_CONFIG_HEADER(src/config.h src/libping/config.h)
7 AC_PREFIX_DEFAULT("/opt/collectd")
9 dnl Checks for programs.
22 dnl Checks for header files.
25 AC_CHECK_HEADERS(fcntl.h unistd.h)
26 AC_CHECK_HEADERS(signal.h)
27 AC_CHECK_HEADERS(sys/socket.h)
28 AC_CHECK_HEADERS(sys/select.h)
29 AC_CHECK_HEADERS(netdb.h)
30 AC_CHECK_HEADERS(sys/time.h sys/times.h)
31 AC_CHECK_HEADERS(sys/types.h)
32 AC_CHECK_HEADERS(sys/resource.h)
33 AC_CHECK_HEADERS(errno.h)
34 AC_CHECK_HEADERS(arpa/inet.h)
35 AC_CHECK_HEADERS(netinet/in.h)
36 AC_CHECK_HEADERS(netdb.h)
37 AC_CHECK_HEADERS(syslog.h)
38 AC_CHECK_HEADERS(dlfcn.h)
39 AC_CHECK_HEADERS(utmp.h)
40 AC_CHECK_HEADERS(utmpx.h)
42 dnl Checking for libraries
45 dnl Checks for typedefs, structures, and compiler characteristics.
51 dnl Checks for library functions.
52 AC_PROG_GCC_TRADITIONAL
53 AC_CHECK_FUNCS(gettimeofday select socket strdup strstr strtol)
54 AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
55 AC_CHECK_FUNCS(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
56 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
57 AC_CHECK_FUNCS(strncasecmp strcasecmp strncmp)
58 AC_CHECK_FUNCS(getutent getutxent)
60 AC_MSG_CHECKING([for kernel type ($host_os)])
63 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
67 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
73 AC_MSG_RESULT([$ac_system])
75 dnl Checks for libraries.
76 AC_CHECK_LIB(socket, socket)
77 AC_CHECK_LIB(resolv, res_search)
78 AC_CHECK_LIB(dl, dlopen)
80 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
81 AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
82 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
84 LDFLAGS="$LDFLAGS -L$withval/lib"
85 CPPFLAGS="$CPPFLAGS -I$withval/include"
88 ], [with_rrdtool="yes"])
89 if test "x$with_rrdtool" = "xyes"
91 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
93 if test "x$with_rrdtool" = "xyes"
95 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
97 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
99 if test "$ac_system" = "Solaris"
102 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
103 AC_CHECK_LIB(devinfo, di_init)
104 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
106 with_kstat="no (Solaris only)"
109 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
112 if test "x$withval" != "xno"
114 if test "x$withval" != "xyes"
116 LDFLAGS="$LDFLAGS -L$withval/lib"
117 CPPFLAGS="$CPPFLAGS -I$withval/include"
118 with_libstatgrab="yes"
124 if test "x$ac_system" != "xunknown"
126 with_libstatgrab="no"
128 with_libstatgrab="yes"
131 if test "x$with_libstatgrab" = "xyes"
133 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
134 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
137 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
140 if test "x$withval" != "xno"
142 if test "x$withval" != "xyes"
144 LDFLAGS="$LDFLAGS -L$withval/lib"
145 CPPFLAGS="$CPPFLAGS -I$withval/include"
146 with_lm_sensors="yes"
152 if test "x$ac_system" = "xLinux"
154 with_lm_sensors="yes"
159 if test "x$with_lm_sensors" = "xyes"
161 AC_CHECK_LIB(sensors, sensors_init,
163 with_lm_sensors="yes"
164 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
166 [with_lm_sensors="no (not found)"])
167 AC_CHECK_HEADERS(sensors/sensors.h,
169 with_lm_sensors="yes"
170 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
172 [with_lm_sensors="no (not found)"])
178 # Check for enabled/disabled features
180 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
181 if test "x$enable_cpu" != "xno"
183 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
190 if test "x$enable_cpu" = "xno"
192 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
194 AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
196 AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
197 if test "x$enable_cpufreq" != "xno"
199 if test "x$ac_system" = "xLinux"
206 if test "x$enable_cpufreq" = "xno"
208 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
210 AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
212 AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
213 if test "x$enable_disk" != "xno"
215 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
222 if test "x$enable_disk" = "xno"
224 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
226 AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
228 AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
229 if test "x$enable_hddtemp" = "xno"
231 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
233 AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
235 AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
236 if test "x$enable_load" != "xno"
238 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
245 if test "x$enable_load" = "xno"
247 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
249 AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
251 AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
252 if test "x$enable_memory" != "xno"
254 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
261 if test "x$enable_memory" = "xno"
263 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
265 AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
267 AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
268 if test "x$enable_nfs" != "xno"
270 if test "x$ac_system" = "xLinux"
277 if test "x$enable_nfs" = "xno"
279 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
281 AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
283 AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
284 if test "x$enable_ping" != "xno"
288 if test "x$enable_ping" = "xno"
290 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
292 AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
294 AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
295 if test "x$enable_processes" != "xno"
297 if test "x$ac_system" = "xLinux"
299 enable_processes="yes"
301 enable_processes="no"
304 if test "x$enable_processes" = "xno"
306 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
308 AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
310 AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
311 if test "x$enable_sensors" != "xno"
313 if test "x$with_lm_sensors" = "xyes"
320 if test "x$enable_sensors" = "xno"
322 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
324 AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
326 AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
327 if test "x$enable_serial" != "xno"
329 if test "x$ac_system" = "xLinux"
336 if test "x$enable_serial" = "xno"
338 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
340 AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
342 AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
343 if test "x$enable_swap" != "xno"
345 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
352 if test "x$enable_swap" = "xno"
354 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
356 AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
358 AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
359 if test "x$enable_tape" != "xno"
361 if test "x$with_kstat" = "xyes"
368 if test "x$enable_tape" = "xno"
370 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
372 AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
374 AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
375 if test "x$enable_traffic" != "xno"
377 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
384 if test "x$enable_traffic" = "xno"
386 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
388 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
390 AC_ARG_ENABLE(users, AC_HELP_STRING([--disable-users], [Disable user count statistics]),, [enable_users="yes"])
391 if test "x$enable_users" != "xno"
393 if test "x$ac_system" = "xLinux" -o "x$ac_system" = "xSolaris"
400 if test "x$enable_users" = "xno"
402 AC_DEFINE(COLLECT_USERS, 0, [Wether or not to collect user count statistics])
404 AM_CONDITIONAL(BUILD_MODULE_USERS, test "x$enable_users" = "xyes")
406 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
412 librrd . . . . . . $with_rrdtool
413 lm_sensors . . . . $with_lm_sensors
414 libstatgrab . . . . $with_libstatgrab
415 libkstat . . . . . $with_kstat
418 cpu . . . . . . . . $enable_cpu
419 cpufreq . . . . . . $enable_cpufreq
420 disk . . . . . . . $enable_disk
421 hddtemp . . . . . . $enable_hddtemp
422 load . . . . . . . $enable_load
423 memory . . . . . . $enable_memory
424 nfs . . . . . . . . $enable_nfs
425 ping . . . . . . . $enable_ping
426 processes . . . . . $enable_processes
427 sensors . . . . . . $enable_sensors
428 serial . . . . . . $enable_serial
429 swap . . . . . . . $enable_swap
430 tape . . . . . . . $enable_tape
431 traffic . . . . . . $enable_traffic
432 users . . . . . . . $enable_users