ad43b17d34f8511f8cabdeb264743f3d87418a41
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)
39 AC_CHECK_HEADERS(utmpx.h)
41 dnl Checking for libraries
42 AC_CHECK_LIB(m, ext)
44 dnl Checks for typedefs, structures, and compiler characteristics.
45 AC_C_CONST
46 AC_TYPE_PID_T
47 AC_TYPE_SIZE_T
48 AC_HEADER_TIME
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)])
60 case $host_os in
61 *linux*)
62 AC_DEFINE([KERNEL_LINUX], [], [True if program is to be compiled for a Linux kernel])
63 ac_system="Linux"
64 ;;
65 *solaris*)
66 AC_DEFINE([KERNEL_SOLARIS], [], [True if program is to be compiled for a Solaris kernel])
67 ac_system="Solaris"
68 ;;
69 *)
70 ac_system="unknown"
71 esac
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"
82 then
83 LDFLAGS="$LDFLAGS -L$withval/lib"
84 CPPFLAGS="$CPPFLAGS -I$withval/include"
85 with_rrdtool="yes"
86 fi
87 ], [with_rrdtool="yes"])
88 if test "x$with_rrdtool" = "xyes"
89 then
90 AC_CHECK_LIB(rrd, rrd_update,, [with_rrdtool="no"], [-lm])
91 fi
92 if test "x$with_rrdtool" = "xyes"
93 then
94 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no"])
95 fi
96 AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
98 if test "$ac_system" = "Solaris"
99 then
100 with_kstat="yes"
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)"])
104 else
105 with_kstat="no (Solaris only)"
106 fi
108 AC_ARG_WITH(libstatgrab, AC_HELP_STRING([--with-libstatgrab@<:@=PFX@:>@], [Path to libstatgrab.]),
109 [
110 # given..
111 if test "x$withval" != "xno"
112 then
113 if test "x$withval" != "xyes"
114 then
115 LDFLAGS="$LDFLAGS -L$withval/lib"
116 CPPFLAGS="$CPPFLAGS -I$withval/include"
117 with_libstatgrab="yes"
118 fi
119 fi
120 ],
121 [
122 # not given..
123 if test "x$ac_system" != "xunknown"
124 then
125 with_libstatgrab="no"
126 else
127 with_libstatgrab="yes"
128 fi
129 ])
130 if test "x$with_libstatgrab" = "xyes"
131 then
132 AC_CHECK_LIB(statgrab, sg_init,, [with_libstatgrab="no (not found)"])
133 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (not found)"])
134 fi
136 AC_ARG_WITH(lm-sensors, AC_HELP_STRING([--with-lm-sensors@<:@=PFX@:>@], [Path to lm_sensors.]),
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_lm_sensors="yes"
146 fi
147 fi
148 ],
149 [
150 # not given..
151 if test "x$ac_system" = "xLinux"
152 then
153 with_lm_sensors="yes"
154 else
155 with_lm_sensors="no"
156 fi
157 ])
158 if test "x$with_lm_sensors" = "xyes"
159 then
160 AC_CHECK_LIB(sensors, sensors_init,
161 [
162 with_lm_sensors="yes"
163 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
164 ],
165 [with_lm_sensors="no (not found)"])
166 AC_CHECK_HEADERS(sensors/sensors.h,
167 [
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.])
170 ],
171 [with_lm_sensors="no (not found)"])
172 fi
176 #
177 # Check for enabled/disabled features
178 #
179 AC_ARG_ENABLE(cpu, AC_HELP_STRING([--disable-cpu], [Disable CPU usage statistics]),, [enable_cpu="yes"])
180 if test "x$enable_cpu" != "xno"
181 then
182 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
183 then
184 enable_cpu="yes"
185 else
186 enable_cpu="no"
187 fi
188 fi
189 if test "x$enable_cpu" = "xno"
190 then
191 AC_DEFINE(COLLECT_CPU, 0, [Wether or not to collect CPU usage statistics])
192 fi
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"
197 then
198 if test "x$ac_system" = "xLinux"
199 then
200 enable_cpufreq="yes"
201 else
202 enable_cpufreq="no"
203 fi
204 fi
205 if test "x$enable_cpufreq" = "xno"
206 then
207 AC_DEFINE(COLLECT_CPUFREQ, 0, [Wether or not to collect cpu frequency statistics])
208 fi
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"
213 then
214 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes"
215 then
216 enable_disk="yes"
217 else
218 enable_disk="no"
219 fi
220 fi
221 if test "x$enable_disk" = "xno"
222 then
223 AC_DEFINE(COLLECT_DISK, 0, [Wether or not to collect diskstats])
224 fi
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"
229 then
230 AC_DEFINE(COLLECT_HDDTEMP, 0, [Wether or not to collect hdd temperature statistics])
231 fi
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"
236 then
237 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
238 then
239 enable_load="yes"
240 else
241 enable_load="no"
242 fi
243 fi
244 if test "x$enable_load" = "xno"
245 then
246 AC_DEFINE(COLLECT_LOAD, 0, [Wether or not to collect system load statistics])
247 fi
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"
252 then
253 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
254 then
255 enable_memory="yes"
256 else
257 enable_memory="no"
258 fi
259 fi
260 if test "x$enable_memory" = "xno"
261 then
262 AC_DEFINE(COLLECT_MEMORY, 0, [Wether or not to collect memory statistics])
263 fi
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"
268 then
269 if test "x$ac_system" = "xLinux"
270 then
271 enable_nfs="yes"
272 else
273 enable_nfs="no"
274 fi
275 fi
276 if test "x$enable_nfs" = "xno"
277 then
278 AC_DEFINE(COLLECT_NFS, 0, [Wether or not to collect nfs statistics])
279 fi
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"
284 then
285 enable_ping="yes"
286 fi
287 if test "x$enable_ping" = "xno"
288 then
289 AC_DEFINE(COLLECT_PING, 0, [Wether or not to collect ping statistics])
290 fi
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"
295 then
296 if test "x$ac_system" = "xLinux"
297 then
298 enable_processes="yes"
299 else
300 enable_processes="no"
301 fi
302 fi
303 if test "x$enable_processes" = "xno"
304 then
305 AC_DEFINE(COLLECT_PROCESSES, 0, [Wether or not to collect processes statistics])
306 fi
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"
311 then
312 if test "x$with_lm_sensors" = "xyes"
313 then
314 enable_sensors="yes"
315 else
316 enable_sensors="no"
317 fi
318 fi
319 if test "x$enable_sensors" = "xno"
320 then
321 AC_DEFINE(COLLECT_SENSORS, 0, [Wether or not to collect lm_sensors statistics])
322 fi
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"
327 then
328 if test "x$ac_system" = "xLinux"
329 then
330 enable_serial="yes"
331 else
332 enable_serial="no"
333 fi
334 fi
335 if test "x$enable_serial" = "xno"
336 then
337 AC_DEFINE(COLLECT_SERIAL, 0, [Wether or not to collect serial statistics])
338 fi
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"
343 then
344 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
345 then
346 enable_swap="yes"
347 else
348 enable_swap="no"
349 fi
350 fi
351 if test "x$enable_swap" = "xno"
352 then
353 AC_DEFINE(COLLECT_SWAP, 0, [Wether or not to collect swap statistics])
354 fi
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"
359 then
360 if test "x$with_kstat" = "xyes"
361 then
362 enable_tape="yes"
363 else
364 enable_tape="no"
365 fi
366 fi
367 if test "x$enable_tape" = "xno"
368 then
369 AC_DEFINE(COLLECT_TAPE, 0, [Wether or not to collect tape statistics])
370 fi
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"
375 then
376 if test "x$ac_system" = "xLinux" -o "x$with_kstat" = "xyes" -o "x$with_libstatgrab" = "xyes"
377 then
378 enable_traffic="yes"
379 else
380 enable_traffic="no"
381 fi
382 fi
383 if test "x$enable_traffic" = "xno"
384 then
385 AC_DEFINE(COLLECT_TRAFFIC, 0, [Wether or not to collect network traffic statistics])
386 fi
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"
391 then
392 if test "x$ac_system" = "xLinux" -o "x$ac_system" = "xSolaris"
393 then
394 enable_users="yes"
395 else
396 enable_users="no"
397 fi
398 fi
399 if test "x$enable_users" = "xno"
400 then
401 AC_DEFINE(COLLECT_USERS, 0, [Wether or not to collect user count statistics])
402 fi
403 AM_CONDITIONAL(BUILD_MODULE_USERS, test "x$enable_users" = "xyes")
405 AC_OUTPUT(Makefile src/libping/Makefile src/Makefile)
407 cat <<EOF;
409 Configuration:
410 Libraries:
411 librrd . . . . . . $with_rrdtool
412 lm_sensors . . . . $with_lm_sensors
413 libstatgrab . . . . $with_libstatgrab
414 libkstat . . . . . $with_kstat
416 Features:
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
433 EOF