1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(src/collectd.c)
3 AM_INIT_AUTOMAKE(collectd, 3.5.alpha1)
4 AM_CONFIG_HEADER(src/config.h src/libping/config.h)
5 AC_LANG(C)
7 AC_PREFIX_DEFAULT("/opt/collectd")
9 #
10 # Checks for programs.
11 #
12 AC_PROG_CC
13 AC_PROG_CPP
14 AC_PROG_INSTALL
15 AC_PROG_LN_S
16 AC_PROG_MAKE_SET
18 dnl configure libtool
19 AC_DISABLE_STATIC
20 AC_LIBTOOL_DLOPEN
21 AC_PROG_LIBTOOL
22 #AC_PROG_RANLIB
24 #
25 # Checks for header files.
26 #
27 AC_HEADER_STDC
28 AC_HEADER_SYS_WAIT
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)
41 # For cpu modules
42 AC_CHECK_HEADERS(sys/sysctl.h sys/dkstat.h)
44 # For load module
45 AC_CHECK_HEADERS(sys/loadavg.h)
47 # For ping module
48 AC_CHECK_HEADERS(arpa/inet.h)
49 AC_CHECK_HEADERS(netinet/in.h)
50 AC_CHECK_HEADERS(netdb.h)
52 # For users module
53 AC_CHECK_HEADERS(utmp.h)
54 AC_CHECK_HEADERS(utmpx.h)
56 dnl Checking for libraries
57 AC_CHECK_LIB(m, ext)
59 #
60 # Checks for typedefs, structures, and compiler characteristics.
61 #
62 AC_C_CONST
63 AC_TYPE_PID_T
64 AC_TYPE_SIZE_T
65 AC_HEADER_TIME
67 #
68 # Checks for library functions.
69 #
70 AC_PROG_GCC_TRADITIONAL
71 AC_CHECK_FUNCS(gettimeofday select socket strdup strstr strtol)
72 AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
73 AC_CHECK_FUNCS(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
74 AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
75 AC_CHECK_FUNCS(strncasecmp strcasecmp strncmp)
77 # For cpu module
78 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
80 # For load module
81 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
83 # For users module
84 have_getutent="no"
85 AC_CHECK_FUNCS(getutent getutxent, [have_getutent="yes"])
87 AC_MSG_CHECKING([for kernel type ($host_os)])
88 case $host_os in
89 *linux*)
90 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
91 ac_system="Linux"
92 ;;
93 *solaris*)
94 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
95 ac_system="Solaris"
96 ;;
97 *)
98 ac_system="unknown"
99 esac
100 AC_MSG_RESULT([$ac_system])
102 dnl Checks for libraries.
103 AC_CHECK_LIB(socket, socket)
104 AC_CHECK_LIB(resolv, res_search)
105 AC_CHECK_LIB(dl, dlopen)
107 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
108 AC_ARG_WITH(rrdtool, AC_HELP_STRING([--with-rrdtool=PFX], [Path to rrdtool.]),
109 [ if test "x$withval" != "xno" -a "x$withval" != "xyes"
110 then
111 LDFLAGS="$LDFLAGS -L$withval/lib"
112 CPPFLAGS="$CPPFLAGS -I$withval/include"
113 with_rrdtool="yes"
114 fi
115 ], [with_rrdtool="yes"])
116 if test "x$with_rrdtool" = "xyes"
117 then
118 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
119 fi
120 if test "x$with_rrdtool" = "xyes"
121 then
122 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
123 fi
124 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
126 if test "$ac_system" = "Solaris"
127 then
128 with_kstat="yes"
129 AC_CHECK_LIB(kstat, kstat_open,, [with_kstat="no (not found)"])
130 AC_CHECK_LIB(devinfo, di_init)
131 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
132 else
133 with_kstat="no (Solaris only)"
134 fi
136 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
137 [
138 # given..
139 if test "x$withval" != "xno"
140 then
141 if test "x$withval" != "xyes"
142 then
143 LDFLAGS="$LDFLAGS -L$withval/lib"
144 CPPFLAGS="$CPPFLAGS -I$withval/include"
145 with_libstatgrab="yes"
146 fi
147 fi
148 ],
149 [
150 # not given..
151 if test "x$ac_system" != "xunknown"
152 then
153 with_libstatgrab="no"
154 else
155 with_libstatgrab="yes"
156 fi
157 ])
158 if test "x$with_libstatgrab" = "xyes"
159 then
160 AC_CHECK_LIB(devstat, getdevs)
161 AC_CHECK_LIB(kvm, kvm_getargv)
162 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
163 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
164 fi
166 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
167 [
168 # given..
169 if test "x$withval" != "xno"
170 then
171 if test "x$withval" != "xyes"
172 then
173 LDFLAGS="$LDFLAGS -L$withval/lib"
174 CPPFLAGS="$CPPFLAGS -I$withval/include"
175 with_lm_sensors="yes"
176 fi
177 fi
178 ],
179 [
180 # not given..
181 if test "x$ac_system" = "xLinux"
182 then
183 with_lm_sensors="yes"
184 else
185 with_lm_sensors="no"
186 fi
187 ])
188 if test "x$with_lm_sensors" = "xyes"
189 then
190 AC_CHECK_LIB(sensors, sensors_init,
191 [
192 with_lm_sensors="yes"
193 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
194 ],
195 [with_lm_sensors="no (not found)"])
196 AC_CHECK_HEADERS(sensors/sensors.h,
197 [
198 with_lm_sensors="yes"
199 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
200 ],
201 [with_lm_sensors="no (not found)"])
202 fi
206 #
207 # Check for enabled/disabled features
208 #
209 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
210 if test "x$enable_cpu" != "xno"
211 then
212 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$have_sysctlbyname" = "xyes"
213 then
214 enable_cpu="yes"
215 else
216 enable_cpu="no"
217 fi
218 fi
219 if test "x$enable_cpu" = "xno"
220 then
221 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
222 fi
223 AM_CONDITIONAL(BUILD_MODULE_CPU, test "x$enable_cpu" = "xyes")
225 AC_ARG_ENABLE(cpufreq, AC_HELP_STRING([--disable-cpufreq], [Disable system cpu frequency statistics]),, [enable_cpufreq="yes"])
226 if test "x$enable_cpufreq" != "xno"
227 then
228 if test "x$ac_system" = "xLinux"
229 then
230 enable_cpufreq="yes"
231 else
232 enable_cpufreq="no"
233 fi
234 fi
235 if test "x$enable_cpufreq" = "xno"
236 then
237 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
238 fi
239 AM_CONDITIONAL(BUILD_MODULE_CPUFREQ, test "x$enable_cpufreq" = "xyes")
241 AC_ARG_ENABLE(disk, AC_HELP_STRING([--disable-disk], [Disable disk/partition statistics]),, [enable_disk="yes"])
242 if test "x$enable_disk" != "xno"
243 then
244 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
245 then
246 enable_disk="yes"
247 else
248 enable_disk="no"
249 fi
250 fi
251 if test "x$enable_disk" = "xno"
252 then
253 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
254 fi
255 AM_CONDITIONAL(BUILD_MODULE_DISK, test "x$enable_disk" = "xyes")
257 AC_ARG_ENABLE(hddtemp, AC_HELP_STRING([--disable-hddtemp], [Disable hdd temperature statistics]),, [enable_hddtemp="yes"])
258 if test "x$enable_hddtemp" = "xno"
259 then
260 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
261 fi
262 AM_CONDITIONAL(BUILD_MODULE_HDDTEMP, test "x$enable_hddtemp" = "xyes")
264 AC_ARG_ENABLE(load, AC_HELP_STRING([--disable-load], [Disable system load statistics]),, [enable_load="yes"])
265 if test "x$enable_load" != "xno"
266 then
267 if test "x$have_getloadavg" = "xyes" -o "x$ac_system" = "xLinux" -o "x$with_libstatgrab" = "xyes"
268 then
269 enable_load="yes"
270 else
271 enable_load="no"
272 fi
273 fi
274 if test "x$enable_load" = "xno"
275 then
276 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
277 fi
278 AM_CONDITIONAL(BUILD_MODULE_LOAD, test "x$enable_load" = "xyes")
280 AC_ARG_ENABLE(memory, AC_HELP_STRING([--disable-memory], [Disable memory statistics]),, [enable_memory="yes"])
281 if test "x$enable_memory" != "xno"
282 then
283 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
284 then
285 enable_memory="yes"
286 else
287 enable_memory="no"
288 fi
289 fi
290 if test "x$enable_memory" = "xno"
291 then
292 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
293 fi
294 AM_CONDITIONAL(BUILD_MODULE_MEMORY, test "x$enable_memory" = "xyes")
296 AC_ARG_ENABLE(nfs, AC_HELP_STRING([--disable-nfs], [Disable nfs statistics]),, [enable_nfs="yes"])
297 if test "x$enable_nfs" != "xno"
298 then
299 if test "x$ac_system" = "xLinux"
300 then
301 enable_nfs="yes"
302 else
303 enable_nfs="no"
304 fi
305 fi
306 if test "x$enable_nfs" = "xno"
307 then
308 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
309 fi
310 AM_CONDITIONAL(BUILD_MODULE_NFS, test "x$enable_nfs" = "xyes")
312 AC_ARG_ENABLE(ping, AC_HELP_STRING([--disable-ping], [Disable ping statistics]),, [enable_ping="yes"])
313 if test "x$enable_ping" != "xno"
314 then
315 enable_ping="yes"
316 fi
317 if test "x$enable_ping" = "xno"
318 then
319 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
320 fi
321 AM_CONDITIONAL(BUILD_MODULE_PING, test "x$enable_ping" = "xyes")
323 AC_ARG_ENABLE(processes, AC_HELP_STRING([--disable-processes], [Disable processes statistics]),, [enable_processes="yes"])
324 if test "x$enable_processes" != "xno"
325 then
326 if test "x$ac_system" = "xLinux"
327 then
328 enable_processes="yes"
329 else
330 enable_processes="no"
331 fi
332 fi
333 if test "x$enable_processes" = "xno"
334 then
335 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
336 fi
337 AM_CONDITIONAL(BUILD_MODULE_PROCESSES, test "x$enable_processes" = "xyes")
339 AC_ARG_ENABLE(sensors, AC_HELP_STRING([--disable-sensors], [Disable lm_sensors statistics]),, [enable_sensors=$with_lm_sensors])
340 if test "x$enable_sensors" != "xno"
341 then
342 if test "x$with_lm_sensors" = "xyes"
343 then
344 enable_sensors="yes"
345 else
346 enable_sensors="no"
347 fi
348 fi
349 if test "x$enable_sensors" = "xno"
350 then
351 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
352 fi
353 AM_CONDITIONAL(BUILD_MODULE_SENSORS, test "x$enable_sensors" = "xyes")
355 AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [Disable serial statistics]),, [enable_serial="yes"])
356 if test "x$enable_serial" != "xno"
357 then
358 if test "x$ac_system" = "xLinux"
359 then
360 enable_serial="yes"
361 else
362 enable_serial="no"
363 fi
364 fi
365 if test "x$enable_serial" = "xno"
366 then
367 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
368 fi
369 AM_CONDITIONAL(BUILD_MODULE_SERIAL, test "x$enable_serial" = "xyes")
371 AC_ARG_ENABLE(swap, AC_HELP_STRING([--disable-swap], [Disable swap statistics]),, [enable_swap="yes"])
372 if test "x$enable_swap" != "xno"
373 then
374 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
375 then
376 enable_swap="yes"
377 else
378 enable_swap="no"
379 fi
380 fi
381 if test "x$enable_swap" = "xno"
382 then
383 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
384 fi
385 AM_CONDITIONAL(BUILD_MODULE_SWAP, test "x$enable_swap" = "xyes")
387 AC_ARG_ENABLE(tape, AC_HELP_STRING([--disable-tape], [Disable tape statistics]),, [enable_tape="yes"])
388 if test "x$enable_tape" != "xno"
389 then
390 if test "x$with_kstat" = "xyes"
391 then
392 enable_tape="yes"
393 else
394 enable_tape="no"
395 fi
396 fi
397 if test "x$enable_tape" = "xno"
398 then
399 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
400 fi
401 AM_CONDITIONAL(BUILD_MODULE_TAPE, test "x$enable_tape" = "xyes")
403 AC_ARG_ENABLE(traffic, AC_HELP_STRING([--disable-traffic], [Disable system traffic statistics]),, [enable_traffic="yes"])
404 if test "x$enable_traffic" != "xno"
405 then
406 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
407 then
408 enable_traffic="yes"
409 else
410 enable_traffic="no"
411 fi
412 fi
413 if test "x$enable_traffic" = "xno"
414 then
415 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
416 fi
417 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
419 AC_ARG_ENABLE(users, AC_HELP_STRING([--disable-users], [Disable user count statistics]),, [enable_users="yes"])
420 if test "x$enable_users" != "xno"
421 then
422 if test "x$have_getutent" = "xyes"
423 then
424 enable_users="yes"
425 else
426 enable_users="no"
427 fi
428 fi
429 if test "x$enable_users" = "xno"
430 then
431 AC_DEFINE(COLLECT_USERS, 0, [Wether or not to collect user count statistics])
432 fi
433 AM_CONDITIONAL(BUILD_MODULE_USERS, test "x$enable_users" = "xyes")
435 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
437 cat <<EOF;
439 Configuration:
440 Libraries:
441 librrd . . . . . . $with_rrdtool
442 lm_sensors . . . . $with_lm_sensors
443 libstatgrab . . . . $with_libstatgrab
444 libkstat . . . . . $with_kstat
446 Features:
447 cpu . . . . . . . . $enable_cpu
448 cpufreq . . . . . . $enable_cpufreq
449 disk . . . . . . . $enable_disk
450 hddtemp . . . . . . $enable_hddtemp
451 load . . . . . . . $enable_load
452 memory . . . . . . $enable_memory
453 nfs . . . . . . . . $enable_nfs
454 ping . . . . . . . $enable_ping
455 processes . . . . . $enable_processes
456 sensors . . . . . . $enable_sensors
457 serial . . . . . . $enable_serial
458 swap . . . . . . . $enable_swap
459 tape . . . . . . . $enable_tape
460 traffic . . . . . . $enable_traffic
461 users . . . . . . . $enable_users
463 EOF