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 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
78 AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
79 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
81 LDFLAGS="$LDFLAGS -L$withval/lib"
82 CPPFLAGS="$CPPFLAGS -I$withval/include"
85 ], [with_rrdtool="yes"])
86 if test "x$with_rrdtool" = "xyes"
88 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
90 if test "x$with_rrdtool" = "xyes"
92 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
94 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
96 if test "$ac_system" = "Solaris"
99 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
100 AC_CHECK_LIB(devinfo, di_init)
101 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
103 with_kstat="no (Solaris only)"
106 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
109 if test "x$withval" != "xno"
111 if test "x$withval" != "xyes"
113 LDFLAGS="$LDFLAGS -L$withval/lib"
114 CPPFLAGS="$CPPFLAGS -I$withval/include"
115 with_libstatgrab="yes"
121 if test "x$ac_system" != "xunknown"
123 with_libstatgrab="no"
125 with_libstatgrab="yes"
128 if test "x$with_libstatgrab" = "xyes"
130 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
131 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
134 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
137 if test "x$withval" != "xno"
139 if test "x$withval" != "xyes"
141 LDFLAGS="$LDFLAGS -L$withval/lib"
142 CPPFLAGS="$CPPFLAGS -I$withval/include"
143 with_lm_sensors="yes"
149 if test "x$ac_system" = "xLinux"
151 with_lm_sensors="yes"
156 if test "x$with_lm_sensors" = "xyes"
158 AC_CHECK_LIB(sensors, sensors_init,
160 with_lm_sensors="yes"
161 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
163 [with_lm_sensors="no (not found)"])
164 AC_CHECK_HEADERS(sensors/sensors.h,
166 with_lm_sensors="yes"
167 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
169 [with_lm_sensors="no (not found)"])
175 # Check for enabled/disabled features
177 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
178 if test "x$enable_cpu" != "xno"
180 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
187 if test "x$enable_cpu" = "xno"
189 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
191 AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
193 AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
194 if test "x$enable_cpufreq" != "xno"
196 if test "x$ac_system" = "xLinux"
203 if test "x$enable_cpufreq" = "xno"
205 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
207 AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
209 AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
210 if test "x$enable_disk" != "xno"
212 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
219 if test "x$enable_disk" = "xno"
221 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
223 AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
225 AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
226 if test "x$enable_hddtemp" = "xno"
228 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
230 AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
232 AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
233 if test "x$enable_load" != "xno"
235 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
242 if test "x$enable_load" = "xno"
244 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
246 AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
248 AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
249 if test "x$enable_memory" != "xno"
251 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
258 if test "x$enable_memory" = "xno"
260 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
262 AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
264 AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
265 if test "x$enable_nfs" != "xno"
267 if test "x$ac_system" = "xLinux"
274 if test "x$enable_nfs" = "xno"
276 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
278 AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
280 AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
281 if test "x$enable_ping" != "xno"
285 if test "x$enable_ping" = "xno"
287 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
289 AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
291 AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
292 if test "x$enable_processes" != "xno"
294 if test "x$ac_system" = "xLinux"
296 enable_processes="yes"
298 enable_processes="no"
301 if test "x$enable_processes" = "xno"
303 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
305 AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
307 AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
308 if test "x$enable_sensors" != "xno"
310 if test "x$with_lm_sensors" = "xyes"
317 if test "x$enable_sensors" = "xno"
319 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
321 AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
323 AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
324 if test "x$enable_serial" != "xno"
326 if test "x$ac_system" = "xLinux"
333 if test "x$enable_serial" = "xno"
335 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
337 AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
339 AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
340 if test "x$enable_swap" != "xno"
342 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
349 if test "x$enable_swap" = "xno"
351 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
353 AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
355 AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
356 if test "x$enable_tape" != "xno"
358 if test "x$with_kstat" = "xyes"
365 if test "x$enable_tape" = "xno"
367 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
369 AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
371 AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
372 if test "x$enable_traffic" != "xno"
374 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
381 if test "x$enable_traffic" = "xno"
383 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
385 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
387 AC_ARG_ENABLE(users, AC_HELP_STRING([--disable-users], [Disable user count statistics]),, [enable_users="yes"])
388 if test "x$enable_users" != "xno"
390 if test "x$ac_system" = "xLinux"
397 if test "x$enable_users" = "xno"
399 AC_DEFINE(COLLECT_USERS, 0, [Wether or not to collect user count statistics])
401 AM_CONDITIONAL(BUILD_MODULE_USERS, test "x$enable_users" = "xyes")
403 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
409 librrd . . . . . . $with_rrdtool
410 lm_sensors . . . . $with_lm_sensors
411 libstatgrab . . . . $with_libstatgrab
412 libkstat . . . . . $with_kstat
415 cpu . . . . . . . . $enable_cpu
416 cpufreq . . . . . . $enable_cpufreq
417 disk . . . . . . . $enable_disk
418 hddtemp . . . . . . $enable_hddtemp
419 load . . . . . . . $enable_load
420 memory . . . . . . $enable_memory
421 nfs . . . . . . . . $enable_nfs
422 ping . . . . . . . $enable_ping
423 processes . . . . . $enable_processes
424 sensors . . . . . . $enable_sensors
425 serial . . . . . . $enable_serial
426 swap . . . . . . . $enable_swap
427 tape . . . . . . . $enable_tape
428 traffic . . . . . . $enable_traffic
429 users . . . . . . . $enable_users