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(utmpx.h)
41 dnl Checking for libraries
44 dnl Checks for typedefs, structures, and compiler characteristics.
50 dnl Checks for library functions.
51 AC_PROG_GCC_TRADITIONAL
52 AC_CHECK_FUNCS(gettimeofday select socket strdup strstr strtol)
53 AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
54 AC_CHECK_FUNCS(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
55 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
56 AC_CHECK_FUNCS(strncasecmp strcasecmp strncmp)
57 AC_CHECK_FUNCS(getutxent)
59 AC_MSG_CHECKING([for kernel type ($host_os)])
62 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
66 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
72 AC_MSG_RESULT([$ac_system])
74 dnl Checks for libraries.
75 AC_CHECK_LIB(socket, socket)
76 AC_CHECK_LIB(resolv, res_search)
77 AC_CHECK_LIB(dl, dlopen)
79 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
80 AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
81 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
83 LDFLAGS="$LDFLAGS -L$withval/lib"
84 CPPFLAGS="$CPPFLAGS -I$withval/include"
87 ], [with_rrdtool="yes"])
88 if test "x$with_rrdtool" = "xyes"
90 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
92 if test "x$with_rrdtool" = "xyes"
94 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
96 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
98 if test "$ac_system" = "Solaris"
101 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
102 AC_CHECK_LIB(devinfo, di_init)
103 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
105 with_kstat="no (Solaris only)"
108 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
111 if test "x$withval" != "xno"
113 if test "x$withval" != "xyes"
115 LDFLAGS="$LDFLAGS -L$withval/lib"
116 CPPFLAGS="$CPPFLAGS -I$withval/include"
117 with_libstatgrab="yes"
123 if test "x$ac_system" != "xunknown"
125 with_libstatgrab="no"
127 with_libstatgrab="yes"
130 if test "x$with_libstatgrab" = "xyes"
132 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
133 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
136 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
139 if test "x$withval" != "xno"
141 if test "x$withval" != "xyes"
143 LDFLAGS="$LDFLAGS -L$withval/lib"
144 CPPFLAGS="$CPPFLAGS -I$withval/include"
145 with_lm_sensors="yes"
151 if test "x$ac_system" = "xLinux"
153 with_lm_sensors="yes"
158 if test "x$with_lm_sensors" = "xyes"
160 AC_CHECK_LIB(sensors, sensors_init,
162 with_lm_sensors="yes"
163 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
165 [with_lm_sensors="no (not found)"])
166 AC_CHECK_HEADERS(sensors/sensors.h,
168 with_lm_sensors="yes"
169 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
171 [with_lm_sensors="no (not found)"])
177 # Check for enabled/disabled features
179 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
180 if test "x$enable_cpu" != "xno"
182 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
189 if test "x$enable_cpu" = "xno"
191 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
193 AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
195 AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
196 if test "x$enable_cpufreq" != "xno"
198 if test "x$ac_system" = "xLinux"
205 if test "x$enable_cpufreq" = "xno"
207 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
209 AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
211 AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
212 if test "x$enable_disk" != "xno"
214 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
221 if test "x$enable_disk" = "xno"
223 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
225 AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
227 AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
228 if test "x$enable_hddtemp" = "xno"
230 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
232 AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
234 AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
235 if test "x$enable_load" != "xno"
237 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
244 if test "x$enable_load" = "xno"
246 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
248 AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
250 AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
251 if test "x$enable_memory" != "xno"
253 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
260 if test "x$enable_memory" = "xno"
262 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
264 AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
266 AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
267 if test "x$enable_nfs" != "xno"
269 if test "x$ac_system" = "xLinux"
276 if test "x$enable_nfs" = "xno"
278 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
280 AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
282 AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
283 if test "x$enable_ping" != "xno"
287 if test "x$enable_ping" = "xno"
289 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
291 AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
293 AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
294 if test "x$enable_processes" != "xno"
296 if test "x$ac_system" = "xLinux"
298 enable_processes="yes"
300 enable_processes="no"
303 if test "x$enable_processes" = "xno"
305 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
307 AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
309 AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
310 if test "x$enable_sensors" != "xno"
312 if test "x$with_lm_sensors" = "xyes"
319 if test "x$enable_sensors" = "xno"
321 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
323 AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
325 AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
326 if test "x$enable_serial" != "xno"
328 if test "x$ac_system" = "xLinux"
335 if test "x$enable_serial" = "xno"
337 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
339 AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
341 AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
342 if test "x$enable_swap" != "xno"
344 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
351 if test "x$enable_swap" = "xno"
353 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
355 AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
357 AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
358 if test "x$enable_tape" != "xno"
360 if test "x$with_kstat" = "xyes"
367 if test "x$enable_tape" = "xno"
369 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
371 AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
373 AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
374 if test "x$enable_traffic" != "xno"
376 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
383 if test "x$enable_traffic" = "xno"
385 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
387 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
389 AC_ARG_ENABLE(users, AC_HELP_STRING([--disable-users], [Disable user count statistics]),, [enable_users="yes"])
390 if test "x$enable_users" != "xno"
392 if test "x$ac_system" = "xLinux" -o "x$ac_system" = "xSolaris"
399 if test "x$enable_users" = "xno"
401 AC_DEFINE(COLLECT_USERS, 0, [Wether or not to collect user count statistics])
403 AM_CONDITIONAL(BUILD_MODULE_USERS, test "x$enable_users" = "xyes")
405 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
411 librrd . . . . . . $with_rrdtool
412 lm_sensors . . . . $with_lm_sensors
413 libstatgrab . . . . $with_libstatgrab
414 libkstat . . . . . $with_kstat
417 cpu . . . . . . . . $enable_cpu
418 cpufreq . . . . . . $enable_cpufreq
419 disk . . . . . . . $enable_disk
420 hddtemp . . . . . . $enable_hddtemp
421 load . . . . . . . $enable_load
422 memory . . . . . . $enable_memory
423 nfs . . . . . . . . $enable_nfs
424 ping . . . . . . . $enable_ping
425 processes . . . . . $enable_processes
426 sensors . . . . . . $enable_sensors
427 serial . . . . . . $enable_serial
428 swap . . . . . . . $enable_swap
429 tape . . . . . . . $enable_tape
430 traffic . . . . . . $enable_traffic
431 users . . . . . . . $enable_users