690a623b9267d9f2e1c531ca2177ca0ddc031d0a
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)
5 AC_LANG(C)
7 AC_PREFIX_DEFAULT("/opt/collectd")
9 dnl Checks for programs.
10 AC_PROG_CC
11 AC_PROG_CPP
12 AC_PROG_INSTALL
13 AC_PROG_LN_S
14 AC_PROG_MAKE_SET
16 dnl configure libtool
17 AC_DISABLE_STATIC
18 AC_LIBTOOL_DLOPEN
19 AC_PROG_LIBTOOL
20 #AC_PROG_RANLIB
22 dnl Checks for header files.
23 AC_HEADER_STDC
24 AC_HEADER_SYS_WAIT
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
41 AC_CHECK_LIB(m, ext)
43 dnl Checks for typedefs, structures, and compiler characteristics.
44 AC_C_CONST
45 AC_TYPE_PID_T
46 AC_TYPE_SIZE_T
47 AC_HEADER_TIME
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)])
58 case $host_os in
59 *linux*)
60 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
61 ac_system="Linux"
62 ;;
63 *solaris*)
64 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
65 ac_system="Solaris"
66 ;;
67 *)
68 ac_system="unknown"
69 esac
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"
80 then
81 LDFLAGS="$LDFLAGS -L$withval/lib"
82 CPPFLAGS="$CPPFLAGS -I$withval/include"
83 with_rrdtool="yes"
84 fi
85 ], [with_rrdtool="yes"])
86 if test "x$with_rrdtool" = "xyes"
87 then
88 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
89 fi
90 if test "x$with_rrdtool" = "xyes"
91 then
92 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
93 fi
94 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
96 if test "$ac_system" = "Solaris"
97 then
98 with_kstat="yes"
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)"])
102 else
103 with_kstat="no (Solaris only)"
104 fi
106 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
107 [
108 # given..
109 if test "x$withval" != "xno"
110 then
111 if test "x$withval" != "xyes"
112 then
113 LDFLAGS="$LDFLAGS -L$withval/lib"
114 CPPFLAGS="$CPPFLAGS -I$withval/include"
115 with_libstatgrab="yes"
116 fi
117 fi
118 ],
119 [
120 # not given..
121 if test "x$ac_system" != "xunknown"
122 then
123 with_libstatgrab="no"
124 else
125 with_libstatgrab="yes"
126 fi
127 ])
128 if test "x$with_libstatgrab" = "xyes"
129 then
130 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
131 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
132 fi
134 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
135 [
136 # given..
137 if test "x$withval" != "xno"
138 then
139 if test "x$withval" != "xyes"
140 then
141 LDFLAGS="$LDFLAGS -L$withval/lib"
142 CPPFLAGS="$CPPFLAGS -I$withval/include"
143 with_lm_sensors="yes"
144 fi
145 fi
146 ],
147 [
148 # not given..
149 if test "x$ac_system" = "xLinux"
150 then
151 with_lm_sensors="yes"
152 else
153 with_lm_sensors="no"
154 fi
155 ])
156 if test "x$with_lm_sensors" = "xyes"
157 then
158 AC_CHECK_LIB(sensors, sensors_init,
159 [
160 with_lm_sensors="yes"
161 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
162 ],
163 [with_lm_sensors="no (not found)"])
164 AC_CHECK_HEADERS(sensors/sensors.h,
165 [
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.])
168 ],
169 [with_lm_sensors="no (not found)"])
170 fi
174 #
175 # Check for enabled/disabled features
176 #
177 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
178 if test "x$enable_cpu" != "xno"
179 then
180 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
181 then
182 enable_cpu="yes"
183 else
184 enable_cpu="no"
185 fi
186 fi
187 if test "x$enable_cpu" = "xno"
188 then
189 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
190 fi
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"
195 then
196 if test "x$ac_system" = "xLinux"
197 then
198 enable_cpufreq="yes"
199 else
200 enable_cpufreq="no"
201 fi
202 fi
203 if test "x$enable_cpufreq" = "xno"
204 then
205 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
206 fi
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"
211 then
212 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
213 then
214 enable_disk="yes"
215 else
216 enable_disk="no"
217 fi
218 fi
219 if test "x$enable_disk" = "xno"
220 then
221 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
222 fi
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"
227 then
228 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
229 fi
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"
234 then
235 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
236 then
237 enable_load="yes"
238 else
239 enable_load="no"
240 fi
241 fi
242 if test "x$enable_load" = "xno"
243 then
244 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
245 fi
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"
250 then
251 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
252 then
253 enable_memory="yes"
254 else
255 enable_memory="no"
256 fi
257 fi
258 if test "x$enable_memory" = "xno"
259 then
260 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
261 fi
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"
266 then
267 if test "x$ac_system" = "xLinux"
268 then
269 enable_nfs="yes"
270 else
271 enable_nfs="no"
272 fi
273 fi
274 if test "x$enable_nfs" = "xno"
275 then
276 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
277 fi
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"
282 then
283 enable_ping="yes"
284 fi
285 if test "x$enable_ping" = "xno"
286 then
287 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
288 fi
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"
293 then
294 if test "x$ac_system" = "xLinux"
295 then
296 enable_processes="yes"
297 else
298 enable_processes="no"
299 fi
300 fi
301 if test "x$enable_processes" = "xno"
302 then
303 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
304 fi
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"
309 then
310 if test "x$with_lm_sensors" = "xyes"
311 then
312 enable_sensors="yes"
313 else
314 enable_sensors="no"
315 fi
316 fi
317 if test "x$enable_sensors" = "xno"
318 then
319 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
320 fi
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"
325 then
326 if test "x$ac_system" = "xLinux"
327 then
328 enable_serial="yes"
329 else
330 enable_serial="no"
331 fi
332 fi
333 if test "x$enable_serial" = "xno"
334 then
335 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
336 fi
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"
341 then
342 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
343 then
344 enable_swap="yes"
345 else
346 enable_swap="no"
347 fi
348 fi
349 if test "x$enable_swap" = "xno"
350 then
351 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
352 fi
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"
357 then
358 if test "x$with_kstat" = "xyes"
359 then
360 enable_tape="yes"
361 else
362 enable_tape="no"
363 fi
364 fi
365 if test "x$enable_tape" = "xno"
366 then
367 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
368 fi
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"
373 then
374 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
375 then
376 enable_traffic="yes"
377 else
378 enable_traffic="no"
379 fi
380 fi
381 if test "x$enable_traffic" = "xno"
382 then
383 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
384 fi
385 AM_CONDITIONAL(BUILD_MODULE_TRAFFIC, test "x$enable_traffic" = "xyes")
387 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
389 cat <<EOF;
391 Configuration:
392 Libraries:
393 librrd . . . . . . $with_rrdtool
394 lm_sensors . . . . $with_lm_sensors
395 libstatgrab . . . . $with_libstatgrab
396 libkstat . . . . . $with_kstat
398 Features:
399 cpu . . . . . . . . $enable_cpu
400 cpufreq . . . . . . $enable_cpufreq
401 disk . . . . . . . $enable_disk
402 hddtemp . . . . . . $enable_hddtemp
403 load . . . . . . . $enable_load
404 memory . . . . . . $enable_memory
405 nfs . . . . . . . . $enable_nfs
406 ping . . . . . . . $enable_ping
407 processes . . . . . $enable_processes
408 sensors . . . . . . $enable_sensors
409 serial . . . . . . $enable_serial
410 swap . . . . . . . $enable_swap
411 tape . . . . . . . $enable_tape
412 traffic . . . . . . $enable_traffic
414 EOF