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")
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"])
78 AC_CHECK_FUNCS(getutent getutxent)
80 AC_MSG_CHECKING([for kernel type ($host_os)])
83 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
87 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
93 AC_MSG_RESULT([$ac_system])
95 dnl Checks for libraries.
96 AC_CHECK_LIB(socket, socket)
97 AC_CHECK_LIB(resolv, res_search)
98 AC_CHECK_LIB(dl, dlopen)
100 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
101 AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
102 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
104 LDFLAGS="$LDFLAGS -L$withval/lib"
105 CPPFLAGS="$CPPFLAGS -I$withval/include"
108 ], [with_rrdtool="yes"])
109 if test "x$with_rrdtool" = "xyes"
111 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
113 if test "x$with_rrdtool" = "xyes"
115 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
117 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
119 if test "$ac_system" = "Solaris"
122 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
123 AC_CHECK_LIB(devinfo, di_init)
124 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
126 with_kstat="no (Solaris only)"
129 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
132 if test "x$withval" != "xno"
134 if test "x$withval" != "xyes"
136 LDFLAGS="$LDFLAGS -L$withval/lib"
137 CPPFLAGS="$CPPFLAGS -I$withval/include"
138 with_libstatgrab="yes"
144 if test "x$ac_system" != "xunknown"
146 with_libstatgrab="no"
148 with_libstatgrab="yes"
151 if test "x$with_libstatgrab" = "xyes"
153 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
154 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
157 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
160 if test "x$withval" != "xno"
162 if test "x$withval" != "xyes"
164 LDFLAGS="$LDFLAGS -L$withval/lib"
165 CPPFLAGS="$CPPFLAGS -I$withval/include"
166 with_lm_sensors="yes"
172 if test "x$ac_system" = "xLinux"
174 with_lm_sensors="yes"
179 if test "x$with_lm_sensors" = "xyes"
181 AC_CHECK_LIB(sensors, sensors_init,
183 with_lm_sensors="yes"
184 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
186 [with_lm_sensors="no (not found)"])
187 AC_CHECK_HEADERS(sensors/sensors.h,
189 with_lm_sensors="yes"
190 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
192 [with_lm_sensors="no (not found)"])
198 # Check for enabled/disabled features
200 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
201 if test "x$enable_cpu" != "xno"
203 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
210 if test "x$enable_cpu" = "xno"
212 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
214 AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
216 AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
217 if test "x$enable_cpufreq" != "xno"
219 if test "x$ac_system" = "xLinux"
226 if test "x$enable_cpufreq" = "xno"
228 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
230 AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
232 AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
233 if test "x$enable_disk" != "xno"
235 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
242 if test "x$enable_disk" = "xno"
244 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
246 AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
248 AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
249 if test "x$enable_hddtemp" = "xno"
251 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
253 AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
255 AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
256 if test "x$enable_load" != "xno"
258 if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
265 if test "x$enable_load" = "xno"
267 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
269 AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
271 AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
272 if test "x$enable_memory" != "xno"
274 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
281 if test "x$enable_memory" = "xno"
283 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
285 AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
287 AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
288 if test "x$enable_nfs" != "xno"
290 if test "x$ac_system" = "xLinux"
297 if test "x$enable_nfs" = "xno"
299 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
301 AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
303 AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
304 if test "x$enable_ping" != "xno"
308 if test "x$enable_ping" = "xno"
310 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
312 AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
314 AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
315 if test "x$enable_processes" != "xno"
317 if test "x$ac_system" = "xLinux"
319 enable_processes="yes"
321 enable_processes="no"
324 if test "x$enable_processes" = "xno"
326 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
328 AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
330 AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
331 if test "x$enable_sensors" != "xno"
333 if test "x$with_lm_sensors" = "xyes"
340 if test "x$enable_sensors" = "xno"
342 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
344 AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
346 AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
347 if test "x$enable_serial" != "xno"
349 if test "x$ac_system" = "xLinux"
356 if test "x$enable_serial" = "xno"
358 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
360 AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
362 AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
363 if test "x$enable_swap" != "xno"
365 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
372 if test "x$enable_swap" = "xno"
374 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
376 AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
378 AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
379 if test "x$enable_tape" != "xno"
381 if test "x$with_kstat" = "xyes"
388 if test "x$enable_tape" = "xno"
390 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
392 AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
394 AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
395 if test "x$enable_traffic" != "xno"
397 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
404 if test "x$enable_traffic" = "xno"
406 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
408 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
410 AC_ARG_ENABLE(users, AC_HELP_STRING([--disable-users], [Disable user count statistics]),, [enable_users="yes"])
411 if test "x$enable_users" != "xno"
413 if test "x$ac_system" = "xLinux" -o "x$ac_system" = "xSolaris"
420 if test "x$enable_users" = "xno"
422 AC_DEFINE(COLLECT_USERS, 0, [Wether or not to collect user count statistics])
424 AM_CONDITIONAL(BUILD_MODULE_USERS, test "x$enable_users" = "xyes")
426 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
432 librrd . . . . . . $with_rrdtool
433 lm_sensors . . . . $with_lm_sensors
434 libstatgrab . . . . $with_libstatgrab
435 libkstat . . . . . $with_kstat
438 cpu . . . . . . . . $enable_cpu
439 cpufreq . . . . . . $enable_cpufreq
440 disk . . . . . . . $enable_disk
441 hddtemp . . . . . . $enable_hddtemp
442 load . . . . . . . $enable_load
443 memory . . . . . . $enable_memory
444 nfs . . . . . . . . $enable_nfs
445 ping . . . . . . . $enable_ping
446 processes . . . . . $enable_processes
447 sensors . . . . . . $enable_sensors
448 serial . . . . . . $enable_serial
449 swap . . . . . . . $enable_swap
450 tape . . . . . . . $enable_tape
451 traffic . . . . . . $enable_traffic
452 users . . . . . . . $enable_users