1 SUBDIRS = libconfig
2 if BUILD_WITH_OWN_LIBOPING
3 SUBDIRS += liboping
4 endif
6 if COMPILER_IS_GCC
7 AM_CFLAGS = -Wall -Werror
8 endif
10 sbin_PROGRAMS = collectd
12 collectd_SOURCES = collectd.c collectd.h \
13 utils_debug.c utils_debug.h \
14 utils_mount.c utils_mount.h \
15 common.c common.h \
16 network.c network.h \
17 plugin.c plugin.h \
18 configfile.c configfile.h
19 collectd_CPPFLAGS = $(LTDLINCL)
20 collectd_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"'
21 collectd_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"'
22 if BUILD_FEATURE_DAEMON
23 collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
24 endif
25 collectd_CPPFLAGS += -DPLUGINDIR='"${pkglibdir}"'
26 if BUILD_FEATURE_DEBUG
27 collectd_CPPFLAGS += -DLOGFILE='"${localstatedir}/log/${PACKAGE_NAME}/collectd.log"'
28 endif
30 # Link to these libraries..
31 collectd_LDFLAGS = -export-dynamic
32 if BUILD_WITH_RRDTOOL
33 collectd_LDFLAGS += -lm -lrrd
34 endif
35 if BUILD_WITH_LIBRT
36 collectd_LDFLAGS += -lrt
37 endif
38 if BUILD_WITH_LIBSOCKET
39 collectd_LDFLAGS += -lsocket
40 endif
41 if BUILD_WITH_LIBRESOLV
42 collectd_LDFLAGS += -lresolv
43 endif
44 if BUILD_WITH_LIBKSTAT
45 collectd_LDFLAGS += -lkstat
46 endif
47 if BUILD_WITH_LIBDEVINFO
48 collectd_LDFLAGS += -ldevinfo
49 endif
51 if BUILD_WITH_LIBSTATGRAB
52 if BUILD_WITH_LIBKVM
53 collectd_LDFLAGS += -lkvm
54 endif
55 if BUILD_WITH_LIBDEVSTAT
56 collectd_LDFLAGS += -ldevstat
57 endif
58 collectd_LDFLAGS += -lstatgrab
59 endif
62 collectd_LDADD = $(LIBLTDL) libconfig/libconfig.la "-dlopen" self
63 collectd_DEPENDENCIES = $(LIBLTDL) libconfig/libconfig.la
65 pkglib_LTLIBRARIES =
67 if BUILD_MODULE_APACHE
68 pkglib_LTLIBRARIES += apache.la
69 apache_la_SOURCES = apache.c
70 apache_la_LDFLAGS = -module -avoid-version
71 if BUILD_WITH_LIBCURL
72 apache_la_LDFLAGS += $(BUILD_WITH_LIBCURL_LIBS)
73 endif
74 collectd_LDADD += "-dlopen" apache.la
75 collectd_DEPENDENCIES += apache.la
76 endif
78 if BUILD_MODULE_APCUPS
79 pkglib_LTLIBRARIES += apcups.la
80 apcups_la_SOURCES = apcups.c
81 apcups_la_LDFLAGS = -module -avoid-version
82 if BUILD_WITH_LIBSOCKET
83 apcups_la_LDFLAGS += -lsocket
84 endif
85 collectd_LDADD += "-dlopen" apcups.la
86 collectd_DEPENDENCIES += apcups.la
87 endif
89 if BUILD_MODULE_APPLE_SENSORS
90 pkglib_LTLIBRARIES += apple_sensors.la
91 apple_sensors_la_SOURCES = apple_sensors.c
92 apple_sensors_la_LDFLAGS = -module -avoid-version
93 if BUILD_WITH_LIBIOKIT
94 apple_sensors_la_LDFLAGS += -lIOKit
95 endif
96 collectd_LDADD += "-dlopen" apple_sensors.la
97 collectd_DEPENDENCIES += apple_sensors.la
98 endif
100 if BUILD_MODULE_BATTERY
101 pkglib_LTLIBRARIES += battery.la
102 battery_la_SOURCES = battery.c
103 battery_la_LDFLAGS = -module -avoid-version
104 if BUILD_WITH_LIBIOKIT
105 battery_la_LDFLAGS += -lIOKit
106 endif
107 collectd_LDADD += "-dlopen" battery.la
108 collectd_DEPENDENCIES += battery.la
109 endif
111 if BUILD_MODULE_CPU
112 pkglib_LTLIBRARIES += cpu.la
113 cpu_la_SOURCES = cpu.c
114 cpu_la_LDFLAGS = -module -avoid-version
115 if BUILD_WITH_LIBKSTAT
116 cpu_la_LDFLAGS += -lkstat
117 endif
118 if BUILD_WITH_LIBDEVINFO
119 cpu_la_LDFLAGS += -ldevinfo
120 endif
121 collectd_LDADD += "-dlopen" cpu.la
122 collectd_DEPENDENCIES += cpu.la
123 endif
125 if BUILD_MODULE_CPUFREQ
126 pkglib_LTLIBRARIES += cpufreq.la
127 cpufreq_la_SOURCES = cpufreq.c
128 cpufreq_la_LDFLAGS = -module -avoid-version
129 collectd_LDADD += "-dlopen" cpufreq.la
130 collectd_DEPENDENCIES += cpufreq.la
131 endif
133 if BUILD_MODULE_DF
134 pkglib_LTLIBRARIES += df.la
135 df_la_SOURCES = df.c
136 df_la_LDFLAGS = -module -avoid-version
137 collectd_LDADD += "-dlopen" df.la
138 collectd_DEPENDENCIES += df.la
139 endif
141 if BUILD_MODULE_DISK
142 pkglib_LTLIBRARIES += disk.la
143 disk_la_SOURCES = disk.c
144 disk_la_LDFLAGS = -module -avoid-version
145 if BUILD_WITH_LIBKSTAT
146 disk_la_LDFLAGS += -lkstat
147 endif
148 if BUILD_WITH_LIBDEVINFO
149 disk_la_LDFLAGS += -ldevinfo
150 endif
151 if BUILD_WITH_LIBIOKIT
152 disk_la_LDFLAGS += -lIOKit
153 endif
154 collectd_LDADD += "-dlopen" disk.la
155 collectd_DEPENDENCIES += disk.la
156 endif
158 #if BUILD_MODULE_QUOTA
159 #pkglib_LTLIBRARIES += quota.la
160 #quota_la_SOURCES = quota_plugin.c quota_plugin.h
161 #quota_la_SOURCES += quota_fs.c quota_fs.h
162 #quota_la_SOURCES += quota_mnt.c quota_mnt.h
163 #quota_la_LDFLAGS = -module -avoid-version
164 #quota_la_CFLAGS = -Werror
165 #collectd_LDADD += "-dlopen" quota.la
166 #collectd_DEPENDENCIES += quota.la
167 #endif
169 if BUILD_MODULE_HDDTEMP
170 pkglib_LTLIBRARIES += hddtemp.la
171 hddtemp_la_SOURCES = hddtemp.c
172 hddtemp_la_LDFLAGS = -module -avoid-version
173 if BUILD_WITH_LIBSOCKET
174 hddtemp_la_LDFLAGS += -lsocket
175 endif
176 collectd_LDADD += "-dlopen" hddtemp.la
177 collectd_DEPENDENCIES += hddtemp.la
178 endif
180 if BUILD_MODULE_LOAD
181 pkglib_LTLIBRARIES += load.la
182 load_la_SOURCES = load.c
183 load_la_LDFLAGS = -module -avoid-version
184 collectd_LDADD += "-dlopen" load.la
185 collectd_DEPENDENCIES += load.la
186 if BUILD_WITH_LIBSTATGRAB
187 if BUILD_WITH_LIBKVM
188 load_la_LDFLAGS += -lkvm
189 endif
190 if BUILD_WITH_LIBDEVSTAT
191 load_la_LDFLAGS += -ldevstat
192 endif
193 load_la_LDFLAGS += -lstatgrab
194 endif
195 endif
197 if BUILD_MODULE_MEMORY
198 pkglib_LTLIBRARIES += memory.la
199 memory_la_SOURCES = memory.c
200 memory_la_LDFLAGS = -module -avoid-version
201 collectd_LDADD += "-dlopen" memory.la
202 collectd_DEPENDENCIES += memory.la
203 if BUILD_WITH_LIBKSTAT
204 memory_la_LDFLAGS += -lkstat
205 endif
206 if BUILD_WITH_LIBDEVINFO
207 memory_la_LDFLAGS += -ldevinfo
208 endif
209 if BUILD_WITH_LIBSTATGRAB
210 if BUILD_WITH_LIBKVM
211 memory_la_LDFLAGS += -lkvm
212 endif
213 if BUILD_WITH_LIBDEVSTAT
214 memory_la_LDFLAGS += -ldevstat
215 endif
216 memory_la_LDFLAGS += -lstatgrab
217 endif
218 endif
220 if BUILD_MODULE_MULTIMETER
221 pkglib_LTLIBRARIES += multimeter.la
222 multimeter_la_SOURCES = multimeter.c
223 multimeter_la_LDFLAGS = -module -avoid-version
224 collectd_LDADD += "-dlopen" multimeter.la
225 collectd_DEPENDENCIES += multimeter.la
226 endif
228 if BUILD_MODULE_MYSQL
229 pkglib_LTLIBRARIES += mysql.la
230 mysql_la_SOURCES = mysql.c
231 mysql_la_LDFLAGS = -module -avoid-version
232 if BUILD_WITH_LIBMYSQL
233 mysql_la_LDFLAGS += -lmysqlclient
234 endif
235 collectd_LDADD += "-dlopen" mysql.la
236 collectd_DEPENDENCIES += mysql.la
237 endif
239 if BUILD_MODULE_NAMED
240 pkglib_LTLIBRARIES += named.la
241 named_la_SOURCES = named.c dnstop.c
242 named_la_LDFLAGS = -module -avoid-version
243 if BUILD_WITH_LIBPCAP
244 named_la_LDFLAGS += -lpcap
245 endif
246 collectd_LDADD += "-dlopen" named.la
247 collectd_DEPENDENCIES += named.la
248 endif
250 if BUILD_MODULE_NFS
251 pkglib_LTLIBRARIES += nfs.la
252 nfs_la_SOURCES = nfs.c
253 nfs_la_LDFLAGS = -module -avoid-version
254 collectd_LDADD += "-dlopen" nfs.la
255 collectd_DEPENDENCIES += nfs.la
256 endif
258 if BUILD_MODULE_NTPD
259 pkglib_LTLIBRARIES += ntpd.la
260 ntpd_la_SOURCES = ntpd.c
261 ntpd_la_LDFLAGS = -module -avoid-version
262 if BUILD_WITH_LIBSOCKET
263 ntpd_la_LDFLAGS += -lsocket
264 endif
265 collectd_LDADD += "-dlopen" ntpd.la
266 collectd_DEPENDENCIES += ntpd.la
267 endif
269 if BUILD_MODULE_PING
270 pkglib_LTLIBRARIES += ping.la
271 ping_la_SOURCES = ping.c
272 ping_la_LDFLAGS = -module -avoid-version
273 if BUILD_WITH_LIBOPING
274 if BUILD_WITH_OWN_LIBOPING
275 ping_la_LIBADD = liboping/liboping.la
276 ping_la_DEPENDENCIES = liboping/liboping.la
277 else
278 ping_la_LDFLAGS += -loping
279 endif
280 endif
281 collectd_LDADD += "-dlopen" ping.la
282 collectd_DEPENDENCIES += ping.la
283 endif
285 if BUILD_MODULE_PROCESSES
286 pkglib_LTLIBRARIES += processes.la
287 processes_la_SOURCES = processes.c
288 processes_la_LDFLAGS = -module -avoid-version
289 collectd_LDADD += "-dlopen" processes.la
290 collectd_DEPENDENCIES += processes.la
291 endif
293 if BUILD_MODULE_SENSORS
294 pkglib_LTLIBRARIES += sensors.la
295 sensors_la_SOURCES = sensors.c
296 sensors_la_LDFLAGS = -module -avoid-version
297 if BUILD_WITH_LM_SENSORS
298 sensors_la_LDFLAGS += -lsensors
299 endif
300 collectd_LDADD += "-dlopen" sensors.la
301 collectd_DEPENDENCIES += sensors.la
302 endif
304 if BUILD_MODULE_SERIAL
305 pkglib_LTLIBRARIES += serial.la
306 serial_la_SOURCES = serial.c
307 serial_la_LDFLAGS = -module -avoid-version
308 collectd_LDADD += "-dlopen" serial.la
309 collectd_DEPENDENCIES += serial.la
310 endif
312 if BUILD_MODULE_SWAP
313 pkglib_LTLIBRARIES += swap.la
314 swap_la_SOURCES = swap.c
315 swap_la_LDFLAGS = -module -avoid-version
316 collectd_LDADD += "-dlopen" swap.la
317 collectd_DEPENDENCIES += swap.la
318 if BUILD_WITH_LIBKSTAT
319 swap_la_LDFLAGS += -lkstat
320 endif
321 if BUILD_WITH_LIBDEVINFO
322 swap_la_LDFLAGS += -ldevinfo
323 endif
324 if BUILD_WITH_LIBKVM
325 swap_la_LDFLAGS += -lkvm
326 endif
327 if BUILD_WITH_LIBSTATGRAB
328 if BUILD_WITH_LIBDEVSTAT
329 swap_la_LDFLAGS += -ldevstat
330 endif
331 swap_la_LDFLAGS += -lstatgrab
332 endif
333 endif
335 if BUILD_MODULE_TAPE
336 pkglib_LTLIBRARIES += tape.la
337 tape_la_SOURCES = tape.c
338 tape_la_LDFLAGS = -module -avoid-version
339 if BUILD_WITH_LIBKSTAT
340 tape_la_LDFLAGS += -lkstat
341 endif
342 if BUILD_WITH_LIBDEVINFO
343 tape_la_LDFLAGS += -ldevinfo
344 endif
345 collectd_LDADD += "-dlopen" tape.la
346 collectd_DEPENDENCIES += tape.la
347 endif
349 if BUILD_MODULE_TRAFFIC
350 pkglib_LTLIBRARIES += traffic.la
351 traffic_la_SOURCES = traffic.c
352 traffic_la_LDFLAGS = -module -avoid-version
353 collectd_LDADD += "-dlopen" traffic.la
354 collectd_DEPENDENCIES += traffic.la
355 if BUILD_WITH_LIBKSTAT
356 traffic_la_LDFLAGS += -lkstat
357 endif
358 if BUILD_WITH_LIBDEVINFO
359 traffic_la_LDFLAGS += -ldevinfo
360 endif
361 if BUILD_WITH_LIBSTATGRAB
362 if BUILD_WITH_LIBKVM
363 traffic_la_LDFLAGS += -lkvm
364 endif
365 if BUILD_WITH_LIBDEVSTAT
366 traffic_la_LDFLAGS += -ldevstat
367 endif
368 traffic_la_LDFLAGS += -lstatgrab
369 endif
370 endif
372 if BUILD_MODULE_USERS
373 pkglib_LTLIBRARIES += users.la
374 users_la_SOURCES = users.c
375 users_la_LDFLAGS = -module -avoid-version
376 collectd_LDADD += "-dlopen" users.la
377 collectd_DEPENDENCIES += users.la
378 endif
380 if BUILD_MODULE_VSERVER
381 pkglib_LTLIBRARIES += vserver.la
382 vserver_la_SOURCES = vserver.c
383 vserver_la_LDFLAGS = -module -avoid-version
384 collectd_LDADD += "-dlopen" vserver.la
385 collectd_DEPENDENCIES += vserver.la
386 endif
388 if BUILD_MODULE_WIRELESS
389 pkglib_LTLIBRARIES += wireless.la
390 wireless_la_SOURCES = wireless.c
391 wireless_la_LDFLAGS = -module -avoid-version
392 collectd_LDADD += "-dlopen" wireless.la
393 collectd_DEPENDENCIES += wireless.la
394 endif
396 dist_man_MANS = collectd.1 collectd.conf.5
397 #collectd_1_SOURCES = collectd.pod
399 #EXTRA_DIST = $(man_MANS)
401 .pod.1:
402 pod2man --release=$(VERSION) --center=$(PACKAGE) $< >$@
404 .pod.5:
405 pod2man --section=5 --release=$(VERSION) --center=$(PACKAGE) $< >$@
407 install-exec-hook:
408 $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
409 if test -e $(DESTDIR)$(sysconfdir)/collectd.conf; \
410 then \
411 $(INSTALL_DATA) collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf.pkg-orig; \
412 else \
413 $(INSTALL_DATA) collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf; \
414 fi