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)
40 dnl Checking for libraries
43 dnl Checks for typedefs, structures, and compiler characteristics.
49 dnl Checks for library functions.
50 AC_PROG_GCC_TRADITIONAL
51 AC_CHECK_FUNCS(gettimeofday select socket strdup strstr strtol)
52 AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
53 AC_CHECK_FUNCS(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
54 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
55 AC_CHECK_FUNCS(strncasecmp strcasecmp strncmp)
57 AC_MSG_CHECKING([for kernel type ($host_os)])
60 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
64 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
70 AC_MSG_RESULT([$ac_system])
72 dnl Checks for libraries.
73 AC_CHECK_LIB(socket, socket)
74 AC_CHECK_LIB(resolv, res_search)
75 AC_CHECK_LIB(dl, dlopen)
77 #if "x$localstatedir" != "x"
79 # CPPFLAGS="$CPPFLAGS -DLOCALSTATEDIR=\"$localstatedir\""
82 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
83 AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
84 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
86 LDFLAGS="$LDFLAGS -L$withval/lib"
87 CPPFLAGS="$CPPFLAGS -I$withval/include"
90 ], [with_rrdtool="yes"])
91 if test "x$with_rrdtool" = "xyes"
93 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
95 if test "x$with_rrdtool" = "xyes"
97 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
99 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
101 if test "$ac_system" = "Solaris"
104 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
105 AC_CHECK_LIB(devinfo, di_init)
106 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
108 with_kstat="no (Solaris only)"
111 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
114 if test "x$withval" != "xno"
116 if test "x$withval" != "xyes"
118 LDFLAGS="$LDFLAGS -L$withval/lib"
119 CPPFLAGS="$CPPFLAGS -I$withval/include"
120 with_libstatgrab="yes"
126 if test "x$ac_system" != "xunknown"
128 with_libstatgrab="no"
130 with_libstatgrab="yes"
133 if test "x$with_libstatgrab" = "xyes"
135 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
136 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
139 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
142 if test "x$withval" != "xno"
144 if test "x$withval" != "xyes"
146 LDFLAGS="$LDFLAGS -L$withval/lib"
147 CPPFLAGS="$CPPFLAGS -I$withval/include"
148 with_lm_sensors="yes"
154 if test "x$ac_system" = "xLinux"
156 with_lm_sensors="yes"
161 if test "x$with_lm_sensors" = "xyes"
163 AC_CHECK_LIB(sensors, sensors_init,
165 with_lm_sensors="yes"
166 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
168 [with_lm_sensors="no (not found)"])
169 AC_CHECK_HEADERS(sensors/sensors.h,
171 with_lm_sensors="yes"
172 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
174 [with_lm_sensors="no (not found)"])
180 # Check for enabled/disabled features
182 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
183 if test "x$enable_cpu" != "xno"
185 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
192 if test "x$enable_cpu" = "xno"
194 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
196 AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
198 AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
199 if test "x$enable_cpufreq" != "xno"
201 if test "x$ac_system" = "xLinux"
208 if test "x$enable_cpufreq" = "xno"
210 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
212 AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
214 AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
215 if test "x$enable_disk" != "xno"
217 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
224 if test "x$enable_disk" = "xno"
226 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
228 AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
230 AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
231 if test "x$enable_hddtemp" = "xno"
233 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
235 AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
237 AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
238 if test "x$enable_load" != "xno"
240 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
247 if test "x$enable_load" = "xno"
249 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
251 AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
253 AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
254 if test "x$enable_memory" != "xno"
256 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
263 if test "x$enable_memory" = "xno"
265 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
267 AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
269 AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
270 if test "x$enable_nfs" != "xno"
272 if test "x$ac_system" = "xLinux"
279 if test "x$enable_nfs" = "xno"
281 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
283 AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
285 AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
286 if test "x$enable_ping" != "xno"
290 if test "x$enable_ping" = "xno"
292 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
294 AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
296 AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
297 if test "x$enable_processes" != "xno"
299 if test "x$ac_system" = "xLinux"
301 enable_processes="yes"
303 enable_processes="no"
306 if test "x$enable_processes" = "xno"
308 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
310 AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
312 AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
313 if test "x$enable_sensors" != "xno"
315 if test "x$with_lm_sensors" = "xyes"
322 if test "x$enable_sensors" = "xno"
324 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
326 AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
328 AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
329 if test "x$enable_serial" != "xno"
331 if test "x$ac_system" = "xLinux"
338 if test "x$enable_serial" = "xno"
340 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
342 AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
344 AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
345 if test "x$enable_swap" != "xno"
347 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
354 if test "x$enable_swap" = "xno"
356 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
358 AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
360 AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
361 if test "x$enable_tape" != "xno"
363 if test "x$with_kstat" = "xyes"
370 if test "x$enable_tape" = "xno"
372 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
374 AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
376 AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
377 if test "x$enable_traffic" != "xno"
379 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
386 if test "x$enable_traffic" = "xno"
388 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
390 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
392 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
398 librrd . . . . . . $with_rrdtool
399 lm_sensors . . . . $with_lm_sensors
400 libstatgrab . . . . $with_libstatgrab
401 libkstat . . . . . $with_kstat
404 cpu . . . . . . . . $enable_cpu
405 cpufreq . . . . . . $enable_cpufreq
406 disk . . . . . . . $enable_disk
407 hddtemp . . . . . . $enable_hddtemp
408 load . . . . . . . $enable_load
409 memory . . . . . . $enable_memory
410 nfs . . . . . . . . $enable_nfs
411 ping . . . . . . . $enable_ping
412 processes . . . . . $enable_processes
413 sensors . . . . . . $enable_sensors
414 serial . . . . . . $enable_serial
415 swap . . . . . . . $enable_swap
416 tape . . . . . . . $enable_tape
417 traffic . . . . . . $enable_traffic