Merge branch 'pull/collectd-4' into collectd-4
[collectd.git] / src / Makefile.am
1 SUBDIRS = liboconfig
2 if BUILD_WITH_OWN_LIBOPING
3 SUBDIRS += liboping
4 endif
5
6 if COMPILER_IS_GCC
7 AM_CFLAGS = -Wall -Werror
8 endif
9
10 sbin_PROGRAMS = collectd
11 bin_PROGRAMS = collectd-nagios
12
13 collectd_SOURCES = collectd.c collectd.h \
14                    utils_avltree.c utils_avltree.h \
15                    utils_mount.c utils_mount.h \
16                    utils_llist.c utils_llist.h \
17                    utils_ignorelist.c utils_ignorelist.h \
18                    common.c common.h \
19                    plugin.c plugin.h \
20                    configfile.c configfile.h
21 collectd_CPPFLAGS = $(LTDLINCL)
22 collectd_CPPFLAGS += -DPREFIX='"${prefix}"'
23 collectd_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"'
24 collectd_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"'
25 if BUILD_FEATURE_DAEMON
26 collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
27 endif
28 collectd_CPPFLAGS += -DPLUGINDIR='"${pkglibdir}"'
29
30 # Link to these libraries..
31 collectd_LDFLAGS = -export-dynamic
32 if BUILD_WITH_LIBRT
33 collectd_LDFLAGS += -lrt
34 endif
35 if BUILD_WITH_LIBSOCKET
36 collectd_LDFLAGS += -lsocket
37 endif
38 if BUILD_WITH_LIBRESOLV
39 collectd_LDFLAGS += -lresolv
40 endif
41 if BUILD_WITH_LIBPTHREAD
42 collectd_LDFLAGS += -lpthread
43 endif
44 if BUILD_WITH_LIBKSTAT
45 collectd_LDFLAGS += -lkstat
46 endif
47 if BUILD_WITH_LIBDEVINFO
48 collectd_LDFLAGS += -ldevinfo
49 endif
50
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
60
61
62 collectd_LDADD = $(LIBLTDL) liboconfig/liboconfig.la "-dlopen" self
63 collectd_DEPENDENCIES = $(LIBLTDL) liboconfig/liboconfig.la
64
65 collectd_nagios_SOURCES = collectd-nagios.c
66 collectd_nagios_LDFLAGS =
67 if BUILD_WITH_LIBSOCKET
68 collectd_nagios_LDFLAGS += -lsocket
69 endif
70
71 pkglib_LTLIBRARIES = 
72
73 if BUILD_MODULE_APACHE
74 pkglib_LTLIBRARIES += apache.la
75 apache_la_SOURCES = apache.c
76 apache_la_LDFLAGS = -module -avoid-version
77 if BUILD_WITH_LIBCURL
78 apache_la_LDFLAGS += $(BUILD_WITH_LIBCURL_LIBS)
79 endif
80 collectd_LDADD += "-dlopen" apache.la
81 collectd_DEPENDENCIES += apache.la
82 endif
83
84 if BUILD_MODULE_APCUPS
85 pkglib_LTLIBRARIES += apcups.la
86 apcups_la_SOURCES = apcups.c
87 apcups_la_LDFLAGS = -module -avoid-version
88 if BUILD_WITH_LIBSOCKET
89 apcups_la_LDFLAGS += -lsocket
90 endif
91 collectd_LDADD += "-dlopen" apcups.la
92 collectd_DEPENDENCIES += apcups.la
93 endif
94
95 if BUILD_MODULE_APPLE_SENSORS
96 pkglib_LTLIBRARIES += apple_sensors.la
97 apple_sensors_la_SOURCES = apple_sensors.c
98 apple_sensors_la_LDFLAGS = -module -avoid-version
99 if BUILD_WITH_LIBIOKIT
100 apple_sensors_la_LDFLAGS += -lIOKit
101 endif
102 collectd_LDADD += "-dlopen" apple_sensors.la
103 collectd_DEPENDENCIES += apple_sensors.la
104 endif
105
106 if BUILD_MODULE_BATTERY
107 pkglib_LTLIBRARIES += battery.la
108 battery_la_SOURCES = battery.c
109 battery_la_LDFLAGS = -module -avoid-version
110 if BUILD_WITH_LIBIOKIT
111 battery_la_LDFLAGS += -lIOKit
112 endif
113 collectd_LDADD += "-dlopen" battery.la
114 collectd_DEPENDENCIES += battery.la
115 endif
116
117 if BUILD_MODULE_CPU
118 pkglib_LTLIBRARIES += cpu.la
119 cpu_la_SOURCES = cpu.c
120 cpu_la_LDFLAGS = -module -avoid-version
121 if BUILD_WITH_LIBKSTAT
122 cpu_la_LDFLAGS += -lkstat
123 endif
124 if BUILD_WITH_LIBDEVINFO
125 cpu_la_LDFLAGS += -ldevinfo
126 endif
127 collectd_LDADD += "-dlopen" cpu.la
128 collectd_DEPENDENCIES += cpu.la
129 endif
130
131 if BUILD_MODULE_CPUFREQ
132 pkglib_LTLIBRARIES += cpufreq.la
133 cpufreq_la_SOURCES = cpufreq.c
134 cpufreq_la_LDFLAGS = -module -avoid-version
135 collectd_LDADD += "-dlopen" cpufreq.la
136 collectd_DEPENDENCIES += cpufreq.la
137 endif
138
139 if BUILD_MODULE_CSV
140 pkglib_LTLIBRARIES += csv.la
141 csv_la_SOURCES = csv.c
142 csv_la_LDFLAGS = -module -avoid-version
143 collectd_LDADD += "-dlopen" csv.la
144 collectd_DEPENDENCIES += csv.la
145 endif
146
147 if BUILD_MODULE_DF
148 pkglib_LTLIBRARIES += df.la
149 df_la_SOURCES = df.c
150 df_la_LDFLAGS = -module -avoid-version
151 collectd_LDADD += "-dlopen" df.la
152 collectd_DEPENDENCIES += df.la
153 endif
154
155 if BUILD_MODULE_DISK
156 pkglib_LTLIBRARIES += disk.la
157 disk_la_SOURCES = disk.c
158 disk_la_LDFLAGS = -module -avoid-version
159 if BUILD_WITH_LIBKSTAT
160 disk_la_LDFLAGS += -lkstat
161 endif
162 if BUILD_WITH_LIBDEVINFO
163 disk_la_LDFLAGS += -ldevinfo
164 endif
165 if BUILD_WITH_LIBIOKIT
166 disk_la_LDFLAGS += -lIOKit
167 endif
168 collectd_LDADD += "-dlopen" disk.la
169 collectd_DEPENDENCIES += disk.la
170 endif
171
172 if BUILD_MODULE_DNS
173 pkglib_LTLIBRARIES += dns.la
174 dns_la_SOURCES = dns.c
175 if BUILD_WITH_LIBPCAP
176 if BUILD_WITH_LIBPTHREAD
177 dns_la_SOURCES += utils_dns.c utils_dns.h
178 endif
179 endif
180 dns_la_LDFLAGS = -module -avoid-version
181 if BUILD_WITH_LIBPCAP
182 dns_la_LDFLAGS += -lpcap
183 endif
184 if BUILD_WITH_LIBPTHREAD
185 dns_la_LDFLAGS += -lpthread
186 endif
187 collectd_LDADD += "-dlopen" dns.la
188 collectd_DEPENDENCIES += dns.la
189 endif
190
191 if BUILD_MODULE_EMAIL
192 pkglib_LTLIBRARIES += email.la
193 email_la_SOURCES = email.c
194 email_la_LDFLAGS = -module -avoid-version
195 if BUILD_WITH_LIBPTHREAD
196 email_la_LDFLAGS += -lpthread
197 endif
198 collectd_LDADD += "-dlopen" email.la
199 collectd_DEPENDENCIES += email.la
200 endif
201
202 if BUILD_MODULE_ENTROPY
203 pkglib_LTLIBRARIES += entropy.la
204 entropy_la_SOURCES = entropy.c
205 entropy_la_LDFLAGS = -module -avoid-version
206 collectd_LDADD += "-dlopen" entropy.la
207 collectd_DEPENDENCIES += entropy.la
208 endif
209
210 if BUILD_MODULE_EXEC
211 pkglib_LTLIBRARIES += exec.la
212 exec_la_SOURCES = exec.c
213 exec_la_LDFLAGS = -module -avoid-version
214 if BUILD_WITH_LIBPTHREAD
215 exec_la_LDFLAGS += -lpthread
216 endif
217 collectd_LDADD += "-dlopen" exec.la
218 collectd_DEPENDENCIES += exec.la
219 endif
220
221 if BUILD_MODULE_HDDTEMP
222 pkglib_LTLIBRARIES += hddtemp.la
223 hddtemp_la_SOURCES = hddtemp.c
224 hddtemp_la_LDFLAGS = -module -avoid-version
225 if BUILD_WITH_LIBSOCKET
226 hddtemp_la_LDFLAGS += -lsocket
227 endif
228 collectd_LDADD += "-dlopen" hddtemp.la
229 collectd_DEPENDENCIES += hddtemp.la
230 endif
231
232 if BUILD_MODULE_INTERFACE
233 pkglib_LTLIBRARIES += interface.la
234 interface_la_SOURCES = interface.c
235 interface_la_LDFLAGS = -module -avoid-version
236 collectd_LDADD += "-dlopen" interface.la
237 collectd_DEPENDENCIES += interface.la
238 if BUILD_WITH_LIBKSTAT
239 interface_la_LDFLAGS += -lkstat
240 endif
241 if BUILD_WITH_LIBDEVINFO
242 interface_la_LDFLAGS += -ldevinfo
243 endif
244 if BUILD_WITH_LIBSTATGRAB
245 if BUILD_WITH_LIBKVM
246 interface_la_LDFLAGS += -lkvm
247 endif
248 if BUILD_WITH_LIBDEVSTAT
249 interface_la_LDFLAGS += -ldevstat
250 endif
251 interface_la_LDFLAGS += -lstatgrab
252 endif
253 endif
254
255 if BUILD_MODULE_IPTABLES
256 pkglib_LTLIBRARIES += iptables.la
257 iptables_la_SOURCES = iptables.c
258 iptables_la_LDFLAGS = -module -avoid-version
259 if BUILD_WITH_LIBIPTC
260 iptables_la_LDFLAGS += -liptc
261 endif
262 collectd_LDADD += "-dlopen" iptables.la
263 collectd_DEPENDENCIES += iptables.la
264 endif
265
266 if BUILD_MODULE_IRQ
267 pkglib_LTLIBRARIES += irq.la
268 irq_la_SOURCES = irq.c
269 irq_la_LDFLAGS = -module -avoid-version
270 collectd_LDADD += "-dlopen" irq.la
271 collectd_DEPENDENCIES += irq.la
272 endif
273
274 if BUILD_MODULE_LOAD
275 pkglib_LTLIBRARIES += load.la
276 load_la_SOURCES = load.c
277 load_la_LDFLAGS = -module -avoid-version
278 collectd_LDADD += "-dlopen" load.la
279 collectd_DEPENDENCIES += load.la
280 if BUILD_WITH_LIBSTATGRAB
281 if BUILD_WITH_LIBKVM
282 load_la_LDFLAGS += -lkvm
283 endif
284 if BUILD_WITH_LIBDEVSTAT
285 load_la_LDFLAGS += -ldevstat
286 endif
287 load_la_LDFLAGS += -lstatgrab
288 endif
289 endif
290
291 if BUILD_MODULE_LOGFILE
292 pkglib_LTLIBRARIES += logfile.la
293 logfile_la_SOURCES = logfile.c
294 logfile_la_LDFLAGS = -module -avoid-version
295 collectd_LDADD += "-dlopen" logfile.la
296 collectd_DEPENDENCIES += logfile.la
297 endif
298
299 if BUILD_MODULE_MBMON
300 pkglib_LTLIBRARIES += mbmon.la
301 mbmon_la_SOURCES = mbmon.c
302 mbmon_la_LDFLAGS = -module -avoid-version
303 if BUILD_WITH_LIBSOCKET
304 mbmon_la_LDFLAGS += -lsocket
305 endif
306 collectd_LDADD += "-dlopen" mbmon.la
307 collectd_DEPENDENCIES += mbmon.la
308 endif
309
310 if BUILD_MODULE_MEMORY
311 pkglib_LTLIBRARIES += memory.la
312 memory_la_SOURCES = memory.c
313 memory_la_LDFLAGS = -module -avoid-version
314 collectd_LDADD += "-dlopen" memory.la
315 collectd_DEPENDENCIES += memory.la
316 if BUILD_WITH_LIBKSTAT
317 memory_la_LDFLAGS += -lkstat
318 endif
319 if BUILD_WITH_LIBDEVINFO
320 memory_la_LDFLAGS += -ldevinfo
321 endif
322 if BUILD_WITH_LIBSTATGRAB
323 if BUILD_WITH_LIBKVM
324 memory_la_LDFLAGS += -lkvm
325 endif
326 if BUILD_WITH_LIBDEVSTAT
327 memory_la_LDFLAGS += -ldevstat
328 endif
329 memory_la_LDFLAGS += -lstatgrab
330 endif
331 endif
332
333 if BUILD_MODULE_MULTIMETER
334 pkglib_LTLIBRARIES += multimeter.la
335 multimeter_la_SOURCES = multimeter.c
336 multimeter_la_LDFLAGS = -module -avoid-version
337 collectd_LDADD += "-dlopen" multimeter.la
338 collectd_DEPENDENCIES += multimeter.la
339 endif
340
341 if BUILD_MODULE_MYSQL
342 pkglib_LTLIBRARIES += mysql.la
343 mysql_la_SOURCES = mysql.c
344 mysql_la_LDFLAGS = -module -avoid-version
345 if BUILD_WITH_LIBMYSQL
346 mysql_la_LDFLAGS += -lmysqlclient
347 endif
348 collectd_LDADD += "-dlopen" mysql.la
349 collectd_DEPENDENCIES += mysql.la
350 endif
351
352 if BUILD_MODULE_NETWORK
353 pkglib_LTLIBRARIES += network.la
354 network_la_SOURCES = network.c network.h
355 network_la_LDFLAGS = -module -avoid-version
356 if BUILD_WITH_LIBSOCKET
357 network_la_LDFLAGS += -lsocket
358 endif
359 if BUILD_WITH_LIBPTHREAD
360 network_la_LDFLAGS += -lpthread
361 endif
362 collectd_LDADD += "-dlopen" network.la
363 collectd_DEPENDENCIES += network.la
364 endif
365
366 if BUILD_MODULE_NFS
367 pkglib_LTLIBRARIES += nfs.la
368 nfs_la_SOURCES = nfs.c
369 nfs_la_LDFLAGS = -module -avoid-version
370 collectd_LDADD += "-dlopen" nfs.la
371 collectd_DEPENDENCIES += nfs.la
372 endif
373
374 if BUILD_MODULE_NTPD
375 pkglib_LTLIBRARIES += ntpd.la
376 ntpd_la_SOURCES = ntpd.c
377 ntpd_la_LDFLAGS = -module -avoid-version
378 if BUILD_WITH_LIBSOCKET
379 ntpd_la_LDFLAGS += -lsocket
380 endif
381 collectd_LDADD += "-dlopen" ntpd.la
382 collectd_DEPENDENCIES += ntpd.la
383 endif
384
385 if BUILD_MODULE_NUT
386 pkglib_LTLIBRARIES += nut.la
387 nut_la_SOURCES = nut.c
388 nut_la_LDFLAGS = -module -avoid-version
389 if BUILD_WITH_LIBUPSCLIENT
390 nut_la_LDFLAGS += -lupsclient
391 if BUILD_WITH_LIBPTHREAD
392 nut_la_LDFLAGS += -lpthread
393 endif
394 endif
395 collectd_LDADD += "-dlopen" nut.la
396 collectd_DEPENDENCIES += nut.la
397 endif
398
399 if BUILD_WITH_LIBPERL
400 if BUILD_MODULE_PERL
401 pkglib_LTLIBRARIES += perl.la
402 perl_la_SOURCES = perl.c
403 perl_la_CFLAGS  = $(AM_CFLAGS) \
404                   $(shell perl -MExtUtils::Embed -e ccopts) \
405                   -DXS_VERSION=\"$(VERSION)\" -DVERSION=\"$(VERSION)\"
406 perl_la_LDFLAGS = -module -avoid-version \
407                   $(shell perl -MExtUtils::Embed -e ldopts)
408 collectd_LDADD += "-dlopen" perl.la
409 collectd_DEPENDENCIES += perl.la
410 endif
411 endif
412
413 if BUILD_MODULE_PING
414 pkglib_LTLIBRARIES += ping.la
415 ping_la_SOURCES = ping.c
416 ping_la_LDFLAGS = -module -avoid-version
417 if BUILD_WITH_LIBOPING
418 if BUILD_WITH_OWN_LIBOPING
419 ping_la_LIBADD  = liboping/liboping.la
420 ping_la_DEPENDENCIES = liboping/liboping.la
421 else
422 ping_la_LDFLAGS += -loping
423 endif
424 endif
425 collectd_LDADD += "-dlopen" ping.la
426 collectd_DEPENDENCIES += ping.la
427 endif
428
429 if BUILD_MODULE_PROCESSES
430 pkglib_LTLIBRARIES += processes.la
431 processes_la_SOURCES = processes.c
432 processes_la_LDFLAGS = -module -avoid-version
433 collectd_LDADD += "-dlopen" processes.la
434 collectd_DEPENDENCIES += processes.la
435 endif
436
437 if BUILD_WITH_RRDTOOL
438 pkglib_LTLIBRARIES += rrdtool.la
439 rrdtool_la_SOURCES = rrdtool.c
440 rrdtool_la_LDFLAGS = -module -avoid-version -lrrd
441 collectd_LDADD += "-dlopen" rrdtool.la
442 collectd_DEPENDENCIES += rrdtool.la
443 endif
444
445 if BUILD_MODULE_SENSORS
446 pkglib_LTLIBRARIES += sensors.la
447 sensors_la_SOURCES = sensors.c
448 sensors_la_LDFLAGS = -module -avoid-version
449 if BUILD_WITH_LM_SENSORS
450 sensors_la_LDFLAGS += -lsensors
451 endif
452 collectd_LDADD += "-dlopen" sensors.la
453 collectd_DEPENDENCIES += sensors.la
454 endif
455
456 if BUILD_MODULE_SERIAL
457 pkglib_LTLIBRARIES += serial.la
458 serial_la_SOURCES = serial.c
459 serial_la_LDFLAGS = -module -avoid-version
460 collectd_LDADD += "-dlopen" serial.la
461 collectd_DEPENDENCIES += serial.la
462 endif
463
464 if BUILD_MODULE_SWAP
465 pkglib_LTLIBRARIES += swap.la
466 swap_la_SOURCES = swap.c
467 swap_la_LDFLAGS = -module -avoid-version
468 collectd_LDADD += "-dlopen" swap.la
469 collectd_DEPENDENCIES += swap.la
470 if BUILD_WITH_LIBKSTAT
471 swap_la_LDFLAGS += -lkstat
472 endif
473 if BUILD_WITH_LIBDEVINFO
474 swap_la_LDFLAGS += -ldevinfo
475 endif
476 if BUILD_WITH_LIBKVM
477 swap_la_LDFLAGS += -lkvm
478 endif
479 if BUILD_WITH_LIBSTATGRAB
480 if BUILD_WITH_LIBDEVSTAT
481 swap_la_LDFLAGS += -ldevstat
482 endif
483 swap_la_LDFLAGS += -lstatgrab
484 endif
485 endif
486
487 if BUILD_MODULE_SYSLOG
488 pkglib_LTLIBRARIES += syslog.la
489 syslog_la_SOURCES = syslog.c
490 syslog_la_LDFLAGS = -module -avoid-version
491 collectd_LDADD += "-dlopen" syslog.la
492 collectd_DEPENDENCIES += syslog.la
493 endif
494
495 if BUILD_MODULE_TAPE
496 pkglib_LTLIBRARIES += tape.la
497 tape_la_SOURCES = tape.c
498 tape_la_LDFLAGS = -module -avoid-version
499 if BUILD_WITH_LIBKSTAT
500 tape_la_LDFLAGS += -lkstat
501 endif
502 if BUILD_WITH_LIBDEVINFO
503 tape_la_LDFLAGS += -ldevinfo
504 endif
505 collectd_LDADD += "-dlopen" tape.la
506 collectd_DEPENDENCIES += tape.la
507 endif
508
509 if BUILD_MODULE_UNIXSOCK
510 pkglib_LTLIBRARIES += unixsock.la
511 unixsock_la_SOURCES = unixsock.c
512 unixsock_la_LDFLAGS = -module -avoid-version
513 if BUILD_WITH_LIBPTHREAD
514 unixsock_la_LDFLAGS += -lpthread
515 endif
516 collectd_LDADD += "-dlopen" unixsock.la
517 collectd_DEPENDENCIES += unixsock.la
518 endif
519
520 if BUILD_MODULE_USERS
521 pkglib_LTLIBRARIES += users.la
522 users_la_SOURCES = users.c
523 users_la_LDFLAGS = -module -avoid-version
524 collectd_LDADD += "-dlopen" users.la
525 collectd_DEPENDENCIES += users.la
526 endif
527
528 if BUILD_MODULE_VSERVER
529 pkglib_LTLIBRARIES += vserver.la
530 vserver_la_SOURCES = vserver.c
531 vserver_la_LDFLAGS = -module -avoid-version
532 collectd_LDADD += "-dlopen" vserver.la
533 collectd_DEPENDENCIES += vserver.la
534 endif
535
536 if BUILD_MODULE_WIRELESS
537 pkglib_LTLIBRARIES += wireless.la
538 wireless_la_SOURCES = wireless.c
539 wireless_la_LDFLAGS = -module -avoid-version
540 collectd_LDADD += "-dlopen" wireless.la
541 collectd_DEPENDENCIES += wireless.la
542 endif
543
544 dist_man_MANS = collectd.1 collectd.conf.5
545 #collectd_1_SOURCES = collectd.pod
546
547 #EXTRA_DIST = $(man_MANS)
548
549 .pod.1:
550         pod2man --release=$(VERSION) --center=$(PACKAGE) $< >$@
551
552 .pod.5:
553         pod2man --section=5 --release=$(VERSION) --center=$(PACKAGE) $< >$@
554
555 install-exec-hook:
556         $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
557         if test -e $(DESTDIR)$(sysconfdir)/collectd.conf; \
558         then \
559                 $(INSTALL) -m 0640 collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf.pkg-orig; \
560         else \
561                 $(INSTALL) -m 0640 collectd.conf $(DESTDIR)$(sysconfdir)/collectd.conf; \
562         fi