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