]> git.ipfire.org Git - thirdparty/collectd.git/blame - configure.in
unixsock plugin: Do not unregister a write-callback in us_shutdown().
[thirdparty/collectd.git] / configure.in
CommitLineData
86ca149a 1dnl Process this file with autoconf to produce a configure script.
1b739da9 2AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
6e765a02
FF
3AC_CONFIG_SRCDIR(src/collectd.c)
4AC_CONFIG_HEADERS(src/config.h)
5AM_INIT_AUTOMAKE(dist-bzip2)
86ca149a
FF
6AC_LANG(C)
7
8AC_PREFIX_DEFAULT("/opt/collectd")
9
9e7918de
SH
10AC_SYS_LARGEFILE
11
15996f86
FF
12#
13# Checks for programs.
14#
86ca149a
FF
15AC_PROG_CC
16AC_PROG_CPP
17AC_PROG_INSTALL
18AC_PROG_LN_S
19AC_PROG_MAKE_SET
586eed68 20AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
86ca149a
FF
21
22dnl configure libtool
23AC_DISABLE_STATIC
6e765a02
FF
24AC_LIBLTDL_CONVENIENCE
25AC_SUBST(LTDLINCL)
26AC_SUBST(LIBLTDL)
86ca149a
FF
27AC_LIBTOOL_DLOPEN
28AC_PROG_LIBTOOL
108c20b2
FF
29AC_PROG_LEX
30AC_PROG_YACC
bcd78ed9 31AC_CONFIG_SUBDIRS(libltdl)
86ca149a 32
af18c7e0
FF
33AC_MSG_CHECKING([for kernel type ($host_os)])
34case $host_os in
35 *linux*)
36 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
37 ac_system="Linux"
38 ;;
39 *solaris*)
40 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
41 ac_system="Solaris"
42 ;;
29f72849
FF
43 *darwin*)
44 ac_system="Darwin"
af18c7e0
FF
45 ;;
46 *)
47 ac_system="unknown"
48esac
49AC_MSG_RESULT([$ac_system])
50
15996f86
FF
51#
52# Checks for header files.
53#
e708ae9b 54AC_HEADER_STDC
86ca149a 55AC_HEADER_SYS_WAIT
6e765a02 56AC_HEADER_DIRENT
a905d397 57
c42a2315 58AC_CHECK_HEADERS(stdint.h stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h)
15996f86 59
c9a5b034 60# For ping library
6934b3d0
FF
61AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
62[#if HAVE_STDINT_H
63# include <stdint.h>
64#endif
ac491e03
FF
65#if HAVE_SYS_TYPES_H
66# include <sys/types.h>
67#endif
6934b3d0 68])
c9a5b034 69AC_CHECK_HEADERS(netinet/in.h, [], [],
6934b3d0
FF
70[#if HAVE_STDINT_H
71# include <stdint.h>
72#endif
ac491e03
FF
73#if HAVE_SYS_TYPES_H
74# include <sys/types.h>
75#endif
6934b3d0 76#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
77# include <netinet/in_systm.h>
78#endif
79])
80AC_CHECK_HEADERS(netinet/ip.h, [], [],
6934b3d0
FF
81[#if HAVE_STDINT_H
82# include <stdint.h>
83#endif
ac491e03
FF
84#if HAVE_SYS_TYPES_H
85# include <sys/types.h>
86#endif
6934b3d0 87#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
88# include <netinet/in_systm.h>
89#endif
90#if HAVE_NETINET_IN_H
91# include <netinet/in.h>
92#endif
93])
94AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
6934b3d0
FF
95[#if HAVE_STDINT_H
96# include <stdint.h>
97#endif
ac491e03
FF
98#if HAVE_SYS_TYPES_H
99# include <sys/types.h>
100#endif
6934b3d0 101#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
102# include <netinet/in_systm.h>
103#endif
104#if HAVE_NETINET_IN_H
105# include <netinet/in.h>
106#endif
107#if HAVE_NETINET_IP_H
108# include <netinet/ip.h>
109#endif
110])
111AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
6934b3d0
FF
112[#if HAVE_STDINT_H
113# include <stdint.h>
114#endif
ac491e03
FF
115#if HAVE_SYS_TYPES_H
116# include <sys/types.h>
117#endif
6934b3d0 118#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
119# include <netinet/in_systm.h>
120#endif
121#if HAVE_NETINET_IN_H
122# include <netinet/in.h>
123#endif
124#if HAVE_NETINET_IP_H
125# include <netinet/ip.h>
126#endif
127])
128AC_CHECK_HEADERS(netinet/ip6.h, [], [],
6934b3d0
FF
129[#if HAVE_STDINT_H
130# include <stdint.h>
131#endif
6fe07031
FF
132#if HAVE_SYS_TYPES_H
133# include <sys/types.h>
134#endif
6934b3d0 135#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
136# include <netinet/in_systm.h>
137#endif
138#if HAVE_NETINET_IN_H
139# include <netinet/in.h>
140#endif
141])
142AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
6934b3d0
FF
143[#if HAVE_STDINT_H
144# include <stdint.h>
145#endif
6fe07031
FF
146#if HAVE_SYS_TYPES_H
147# include <sys/types.h>
148#endif
6934b3d0 149#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
150# include <netinet/in_systm.h>
151#endif
152#if HAVE_NETINET_IN_H
153# include <netinet/in.h>
154#endif
155#if HAVE_NETINET_IP6_H
156# include <netinet/ip6.h>
157#endif
158])
79d36d9e
FF
159AC_CHECK_HEADERS(netinet/tcp.h, [], [],
160[#if HAVE_STDINT_H
161# include <stdint.h>
162#endif
163#if HAVE_SYS_TYPES_H
164# include <sys/types.h>
165#endif
166#if HAVE_NETINET_IN_SYSTM_H
167# include <netinet/in_systm.h>
168#endif
169#if HAVE_NETINET_IN_H
170# include <netinet/in.h>
171#endif
172#if HAVE_NETINET_IP_H
173# include <netinet/ip.h>
174#endif
175])
5b9d0a2b
FF
176AC_CHECK_HEADERS(netinet/udp.h, [], [],
177[#if HAVE_STDINT_H
178# include <stdint.h>
179#endif
180#if HAVE_SYS_TYPES_H
181# include <sys/types.h>
182#endif
183#if HAVE_NETINET_IN_SYSTM_H
184# include <netinet/in_systm.h>
185#endif
186#if HAVE_NETINET_IN_H
187# include <netinet/in.h>
188#endif
189#if HAVE_NETINET_IP_H
190# include <netinet/ip.h>
191#endif
192])
c9a5b034 193
e1d497b7 194# For cpu modules
af18c7e0 195AC_CHECK_HEADERS(sys/dkstat.h)
29f72849 196if test "x$ac_system" = "xDarwin"
af18c7e0
FF
197then
198 AC_CHECK_HEADERS(mach/mach_init.h mach/host_priv.h mach/mach_error.h mach/mach_host.h mach/mach_port.h mach/mach_types.h mach/message.h mach/processor_set.h mach/processor.h mach/processor_info.h mach/task.h mach/thread_act.h mach/vm_region.h mach/vm_map.h mach/vm_prot.h mach/vm_statistics.h mach/kern_return.h)
199 AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
200fi
d4b36462
FF
201AC_CHECK_HEADERS(sys/sysctl.h, [], [],
202[
203#if HAVE_SYS_TYPES_H
204# include <sys/types.h>
205#endif
206#if HAVE_SYS_PARAM_H
207# include <sys/param.h>
208#endif
209])
e1d497b7 210
46ed2804 211# For hddtemp module
a905d397 212AC_CHECK_HEADERS(linux/major.h libgen.h)
46ed2804 213
11265296
FF
214# For the battery plugin
215AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
216[
217#if HAVE_IOKIT_IOKITLIB_H
218# include <IOKit/IOKitLib.h>
219#endif
220#if HAVE_IOKIT_IOTYPES_H
221# include <IOKit/IOTypes.h>
222#endif
223])
ce5ce8ad 224
daedf582 225# For the swap module
d4b36462
FF
226AC_CHECK_HEADERS(sys/swap.h, [], [],
227[
228#if HAVE_SYS_TYPES_H
229# include <sys/types.h>
230#endif
231#if HAVE_SYS_PARAM_H
232# include <sys/param.h>
233#endif
234])
daedf582 235
15996f86 236# For load module
44a3f33a 237# For the processes plugin
15996f86 238# For users module
e4080f7a 239AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
86ca149a 240
3268a333 241# For interface plugin
a05e34a0 242AC_CHECK_HEADERS(ifaddrs.h)
cd377858
FF
243AC_CHECK_HEADERS(net/if.h, [], [],
244[
245#if HAVE_SYS_TYPES_H
246# include <sys/types.h>
247#endif
248#if HAVE_SYS_SOCKET_H
249# include <sys/socket.h>
250#endif
251])
a05e34a0
FF
252AC_CHECK_HEADERS(linux/if.h, [], [],
253[
254#if HAVE_SYS_TYPES_H
255# include <sys/types.h>
256#endif
257#if HAVE_SYS_SOCKET_H
258# include <sys/socket.h>
259#endif
260])
261AC_CHECK_HEADERS(linux/netdevice.h, [], [],
262[
263#if HAVE_SYS_TYPES_H
264# include <sys/types.h>
265#endif
266#if HAVE_SYS_SOCKET_H
267# include <sys/socket.h>
268#endif
269#if HAVE_LINUX_IF_H
270# include <linux/if.h>
271#endif
272])
273
fb3a07dc
SH
274# For ipvs module
275have_net_ip_vs_h="no"
276have_ip_vs_h="no"
277if test "x$ac_system" = "xLinux"
278then
279 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
280 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
281fi
282
6e765a02 283# For quota module
d4b36462
FF
284AC_CHECK_HEADERS(sys/ucred.h, [], [],
285[
286#if HAVE_SYS_TYPES_H
287# include <sys/types.h>
288#endif
289#if HAVE_SYS_PARAM_H
290# include <sys/param.h>
291#endif
292])
6e765a02
FF
293
294# For mount interface
d4b36462
FF
295AC_CHECK_HEADERS(sys/mount.h, [], [],
296[
297#if HAVE_SYS_TYPES_H
298# include <sys/types.h>
299#endif
300#if HAVE_SYS_PARAM_H
301# include <sys/param.h>
302#endif
303])
28c5e282 304
fc257d86
SH
305# For the email plugin
306AC_CHECK_HEADERS(linux/un.h, [], [],
307[
308#if HAVE_SYS_SOCKET_H
309# include <sys/socket.h>
310#endif
311])
fc257d86 312
af18c7e0 313AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.h sys/quota.h xfs/xqm.h fs_info.h fshelp.h paths.h mntent.h mnttab.h sys/fstyp.h sys/fs_types.h sys/mntent.h sys/mnttab.h sys/statfs.h sys/statvfs.h sys/vfs.h sys/vfstab.h kvm.h)
ec88fb0e 314
fdfbf887 315# For the dns plugin
e0a11961
FF
316AC_CHECK_HEADERS(arpa/nameser.h)
317AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
318[
319#if HAVE_ARPA_NAMESER_H
320# include <arpa/nameser.h>
321#endif
322])
c4377c1e 323
e94efcbe
FF
324AC_CHECK_HEADERS(net/if_arp.h, [], [],
325[#if HAVE_SYS_SOCKET_H
326# include <sys/socket.h>
327#endif
328])
e40574f3
FF
329AC_CHECK_HEADERS(net/ppp_defs.h)
330AC_CHECK_HEADERS(net/if_ppp.h, [], [],
331[#if HAVE_NET_PPP_DEFS_H
332# include <net/ppp_defs.h>
333#endif
334])
e94efcbe
FF
335AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
336[#if HAVE_STDINT_H
337# include <stdint.h>
338#endif
339#if HAVE_SYS_TYPES_H
340# include <sys/types.h>
341#endif
342#if HAVE_SYS_SOCKET_H
343# include <sys/socket.h>
344#endif
345#if HAVE_NET_IF_H
346# include <net/if.h>
347#endif
348#if HAVE_NETINET_IN_H
349# include <netinet/in.h>
350#endif
351])
dd7a9bc9 352
51e70a99 353# For the multimeter plugin
3fc0feb6
FF
354have_termios_h="no"
355AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
51e70a99 356
15996f86
FF
357#
358# Checks for typedefs, structures, and compiler characteristics.
359#
86ca149a
FF
360AC_C_CONST
361AC_TYPE_PID_T
362AC_TYPE_SIZE_T
7df03651 363AC_TYPE_UID_T
86ca149a
FF
364AC_HEADER_TIME
365
15996f86
FF
366#
367# Checks for library functions.
368#
86ca149a 369AC_PROG_GCC_TRADITIONAL
a905d397 370AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog)
15996f86 371
fa7db5e9
SH
372AC_FUNC_STRERROR_R
373
b5c58909 374AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
d6bb65ee 375
d89f6dc3
FF
376socket_needs_socket="no"
377AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
378AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
379
4ca5457f
FF
380nanosleep_needs_rt="no"
381AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
382AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
383
e1d497b7 384AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
a905d397
FF
385AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
386AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
387AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
388AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
389AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
390AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
391AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
392AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
393AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
2d03e4e3 394
15996f86
FF
395# For load module
396AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
397
e91c40b8 398# Check for NAN
18fdfeca
FF
399AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
400[
401 if test "x$withval" = "xno"; then
402 nan_type="none"
403 else if test "x$withval" = "xyes"; then
404 nan_type="zero"
405 else
406 nan_type="$withval"
407 fi; fi
408],
409[nan_type="none"])
e91c40b8
FF
410if test "x$nan_type" = "xnone"; then
411 AC_CACHE_CHECK([whether NAN is defined by default],
412 [have_nan_default],
413 AC_COMPILE_IFELSE(
414 AC_LANG_PROGRAM(
415 [[
416#include <stdlib.h>
417#include <math.h>
418static float foo = NAN;
419 ]],
420 [[
421 if (isnan (foo))
422 return 0;
423 else
424 return 1;
425 ]]),
426 [have_nan_default="yes"],
427 [have_nan_default="no"]
428 )
429 )
430 if test "x$have_nan_default" = "xyes"
431 then
18fdfeca 432 nan_type="default"
e91c40b8
FF
433 fi
434fi
435if test "x$nan_type" = "xnone"; then
436 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
437 [have_nan_isoc],
438 AC_COMPILE_IFELSE(
439 AC_LANG_PROGRAM(
440 [[
441#include <stdlib.h>
442#define __USE_ISOC99 1
443#include <math.h>
444static float foo = NAN;
445 ]],
446 [[
447 if (isnan (foo))
448 return 0;
449 else
450 return 1;
451 ]]),
452 [have_nan_isoc="yes"],
453 [have_nan_isoc="no"]
454 )
455 )
456 if test "x$have_nan_isoc" = "xyes"
457 then
18fdfeca 458 nan_type="isoc99"
e91c40b8
FF
459 fi
460fi
461if test "x$nan_type" = "xnone"; then
462 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
463 [have_nan_zero],
464 AC_RUN_IFELSE(
465 AC_LANG_PROGRAM(
466 [[
467#include <stdlib.h>
468#include <math.h>
dcc46cbc
FF
469#ifdef NAN
470# undef NAN
471#endif
e91c40b8
FF
472#define NAN (0.0 / 0.0)
473#ifndef isnan
474# define isnan(f) ((f) != (f))
475#endif
476static float foo = NAN;
477 ]],
478 [[
479 if (isnan (foo))
480 return 0;
481 else
482 return 1;
483 ]]),
484 [have_nan_zero="yes"],
485 [have_nan_zero="no"]
486 )
487 )
488 if test "x$have_nan_zero" = "xyes"
489 then
18fdfeca 490 nan_type="zero"
e91c40b8
FF
491 fi
492fi
18fdfeca
FF
493
494if test "x$nan_type" = "xdefault"; then
495 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
496 [Define if NAN is defined by default and can initialize static variables.])
497else if test "x$nan_type" = "xisoc99"; then
498 AC_DEFINE(NAN_STATIC_ISOC, 1,
499 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
500else if test "x$nan_type" = "xzero"; then
501 AC_DEFINE(NAN_ZERO_ZERO, 1,
502 [Define if NAN can be defined as (0.0 / 0.0)])
503else
e91c40b8 504 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
18fdfeca 505fi; fi; fi
e91c40b8 506
b365f4e3
FF
507AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
508[
509 if test "x$withval" = "xnothing"; then
510 fp_layout_type="nothing"
511 else if test "x$withval" = "xendianflip"; then
512 fp_layout_type="endianflip"
513 else if test "x$withval" = "xintswap"; then
514 fp_layout_type="intswap"
515 else
516 AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
517fi; fi; fi
518],
519[fp_layout_type="unknown"])
520
521if test "x$fp_layout_type" = "xunknown"; then
522 AC_CACHE_CHECK([if doubles are stored in x86 representation],
523 [fp_layout_need_nothing],
524 AC_RUN_IFELSE(
525 AC_LANG_PROGRAM(
526 [[[[
527#include <stdlib.h>
528#include <stdio.h>
529#include <stdint.h>
530#include <string.h>
531 ]]]],
532 [[[[
533 uint64_t i0;
534 uint64_t i1;
535 uint8_t c[8];
536 double d;
537
538 d = 8.642135e130;
539 memcpy ((void *) &i0, (void *) &d, 8);
540
541 i1 = i0;
542 memcpy ((void *) c, (void *) &i1, 8);
543
544 if ((c[0] == 0x2f) && (c[1] == 0x25)
545 && (c[2] == 0xc0) && (c[3] == 0xc7)
546 && (c[4] == 0x43) && (c[5] == 0x2b)
547 && (c[6] == 0x1f) && (c[7] == 0x5b))
548 return (0);
549 else
550 return (1);
551 ]]]]),
552 [fp_layout_need_nothing="yes"],
553 [fp_layout_need_nothing="no"]
554 )
555 )
556 if test "x$fp_layout_need_nothing" = "xyes"; then
557 fp_layout_type="nothing"
558 fi
559fi
560if test "x$fp_layout_type" = "xunknown"; then
561 AC_CACHE_CHECK([if endianflip converts to x86 representation],
562 [fp_layout_need_endianflip],
563 AC_RUN_IFELSE(
564 AC_LANG_PROGRAM(
565 [[[[
566#include <stdlib.h>
567#include <stdio.h>
568#include <stdint.h>
569#include <string.h>
570#define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
571 (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
572 (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
573 (((uint64_t)(A) & 0x000000ff00000000LL) >> 8) | \
574 (((uint64_t)(A) & 0x00000000ff000000LL) << 8) | \
575 (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
576 (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
577 (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
578 ]]]],
579 [[[[
580 uint64_t i0;
581 uint64_t i1;
582 uint8_t c[8];
583 double d;
584
585 d = 8.642135e130;
586 memcpy ((void *) &i0, (void *) &d, 8);
587
588 i1 = endianflip (i0);
589 memcpy ((void *) c, (void *) &i1, 8);
590
591 if ((c[0] == 0x2f) && (c[1] == 0x25)
592 && (c[2] == 0xc0) && (c[3] == 0xc7)
593 && (c[4] == 0x43) && (c[5] == 0x2b)
594 && (c[6] == 0x1f) && (c[7] == 0x5b))
595 return (0);
596 else
597 return (1);
598 ]]]]),
599 [fp_layout_need_endianflip="yes"],
600 [fp_layout_need_endianflip="no"]
601 )
602 )
603 if test "x$fp_layout_need_endianflip" = "xyes"; then
604 fp_layout_type="endianflip"
605 fi
606fi
607if test "x$fp_layout_type" = "xunknown"; then
608 AC_CACHE_CHECK([if intswap converts to x86 representation],
609 [fp_layout_need_intswap],
610 AC_RUN_IFELSE(
611 AC_LANG_PROGRAM(
612 [[[[
613#include <stdlib.h>
614#include <stdio.h>
615#include <stdint.h>
616#include <string.h>
617#define intswap(A) ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
618 (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
619 ]]]],
620 [[[[
621 uint64_t i0;
622 uint64_t i1;
623 uint8_t c[8];
624 double d;
625
626 d = 8.642135e130;
627 memcpy ((void *) &i0, (void *) &d, 8);
628
629 i1 = intswap (i0);
630 memcpy ((void *) c, (void *) &i1, 8);
631
632 if ((c[0] == 0x2f) && (c[1] == 0x25)
633 && (c[2] == 0xc0) && (c[3] == 0xc7)
634 && (c[4] == 0x43) && (c[5] == 0x2b)
635 && (c[6] == 0x1f) && (c[7] == 0x5b))
636 return (0);
637 else
638 return (1);
639 ]]]]),
640 [fp_layout_need_intswap="yes"],
641 [fp_layout_need_intswap="no"]
642 )
643 )
644 if test "x$fp_layout_need_intswap" = "xyes"; then
645 fp_layout_type="intswap"
646 fi
647fi
648
649if test "x$fp_layout_type" = "xnothing"; then
650 AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
651 [Define if doubles are stored in x86 representation.])
652else if test "x$fp_layout_type" = "xendianflip"; then
653 AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
654 [Define if endianflip is needed to convert to x86 representation.])
655else if test "x$fp_layout_type" = "xintswap"; then
656 AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
657 [Define if intswap is needed to convert to x86 representation.])
658else
659 AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
660fi; fi; fi
2dc3f07b
FF
661
662have_getfsstat="no"
663AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
664have_getvfsstat="no"
665AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
666have_listmntent="no"
667AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
668
669have_getmntent="no"
670AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
671if test "x$have_getmntent" = "xno"; then
672 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
c9a5b034 673fi
2dc3f07b
FF
674if test "x$have_getmntent" = "xno"; then
675 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
c9a5b034 676fi
2dc3f07b
FF
677if test "x$have_getmntent" = "xno"; then
678 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
c9a5b034
FF
679fi
680
2dc3f07b 681if test "x$have_getmntent" = "xc"; then
6e765a02 682 AC_CACHE_CHECK([whether getmntent takes one argument],
2dc3f07b 683 [have_one_getmntent],
6e765a02
FF
684 AC_COMPILE_IFELSE(
685 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
2dc3f07b 686#include <mntent.h>
6e765a02 687#include "$srcdir/src/utils_mount.h"]],
2dc3f07b
FF
688 [[
689 FILE *fh;
690 struct mntent *me;
691 fh = setmntent ("/etc/mtab", "r");
692 me = getmntent (fh);
693 ]]
6e765a02 694 ),
2dc3f07b
FF
695 [have_one_getmntent="yes"],
696 [have_one_getmntent="no"]
6e765a02
FF
697 )
698 )
2dc3f07b
FF
699 AC_CACHE_CHECK([whether getmntent takes two arguments],
700 [have_two_getmntent],
701 AC_COMPILE_IFELSE(
702 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
703#include <sys/mnttab.h>
6e765a02 704#include "$srcdir/src/utils_mount.h"]],
2dc3f07b
FF
705 [[
706 FILE *fh;
707 struct mnttab mt;
708 int status;
709 fh = fopen ("/etc/mnttab", "r");
710 status = getmntent (fh, &mt);
711 ]]
712 ),
713 [have_two_getmntent="yes"],
714 [have_two_getmntent="no"]
6e765a02 715 )
2dc3f07b
FF
716 )
717fi
718
719# Check for different versions of `getmntent' here..
720
721if test "x$have_getmntent" = "xc"; then
722 if test "x$have_one_getmntent" = "xyes"; then
723 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
724 [Define if the function getmntent exists and takes one argument.])
725 fi
726 if test "x$have_two_getmntent" = "xyes"; then
727 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
728 [Define if the function getmntent exists and takes two arguments.])
6e765a02 729 fi
6e765a02 730fi
2dc3f07b
FF
731if test "x$have_getmntent" = "xsun"; then
732 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
733 [Define if the function getmntent exists. It's the version from libsun.])
6e765a02 734fi
2dc3f07b
FF
735if test "x$have_getmntent" = "xseq"; then
736 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
737 [Define if the function getmntent exists. It's the version from libseq.])
738fi
739if test "x$have_getmntent" = "xgen"; then
740 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
741 [Define if the function getmntent exists. It's the version from libgen.])
6e765a02
FF
742fi
743
a05e34a0 744# Check for structures
906bea76 745AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
a05e34a0
FF
746 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
747 [],
cd377858
FF
748 [
749 #include <sys/types.h>
750 #include <sys/socket.h>
751 #include <net/if.h>
752 ])
906bea76 753AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
a05e34a0
FF
754 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
755 [],
756 [
757 #include <sys/types.h>
758 #include <sys/socket.h>
759 #include <linux/if.h>
760 #include <linux/netdevice.h>
761 ])
762
5b9d0a2b
FF
763AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
764[#if HAVE_STDINT_H
765# include <stdint.h>
766#endif
767#if HAVE_SYS_TYPES_H
768# include <sys/types.h>
769#endif
770#if HAVE_NETINET_IN_SYSTM_H
771# include <netinet/in_systm.h>
772#endif
773#if HAVE_NETINET_IN_H
774# include <netinet/in.h>
775#endif
776#if HAVE_NETINET_IP_H
777# include <netinet/ip.h>
778#endif
779#if HAVE_NETINET_UDP_H
780# include <netinet/udp.h>
781#endif
782])
783AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
784[#if HAVE_STDINT_H
785# include <stdint.h>
786#endif
787#if HAVE_SYS_TYPES_H
788# include <sys/types.h>
789#endif
790#if HAVE_NETINET_IN_SYSTM_H
791# include <netinet/in_systm.h>
792#endif
793#if HAVE_NETINET_IN_H
794# include <netinet/in.h>
795#endif
796#if HAVE_NETINET_IP_H
797# include <netinet/ip.h>
798#endif
799#if HAVE_NETINET_UDP_H
800# include <netinet/udp.h>
801#endif
802])
2aff261d 803
e94efcbe
FF
804AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
805 [],
806 [],
807 [
808#if HAVE_KSTAT_H
809# include <kstat.h>
810#endif
811 ])
812
a58af051
FF
813with_libresolv="yes"
814AC_CHECK_LIB(resolv, res_search,
815[
816 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
817],
818[with_libresolv="no"])
819AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
86ca149a 820
125bdc00 821
c27cdba8
NW
822m4_divert_once([HELP_WITH], [
823collectd additional packages:])
824
86ca149a 825# AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
ac9cdb55
FF
826librrd_cflags=""
827librrd_ldflags=""
828librrd_threadsafe="yes"
3c12e8a6 829AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
42e281c5 830[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
86ca149a 831 then
ac9cdb55
FF
832 librrd_cflags="-I$withval/include"
833 librrd_ldflags="-L$withval/lib"
86ca149a
FF
834 with_rrdtool="yes"
835 fi
836], [with_rrdtool="yes"])
837if test "x$with_rrdtool" = "xyes"
838then
4c67453e 839 SAVE_CPPFLAGS="$CPPFLAGS"
ac9cdb55
FF
840 SAVE_LDFLAGS="$LDFLAGS"
841
4c67453e 842 CPPFLAGS="$CPPFLAGS $librrd_cflags"
ac9cdb55
FF
843 LDFLAGS="$LDFLAGS $librrd_ldflags"
844
845 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
846
4c67453e 847 CPPFLAGS="$SAVE_CPPFLAGS"
ac9cdb55 848 LDFLAGS="$SAVE_LDFLAGS"
86ca149a
FF
849fi
850if test "x$with_rrdtool" = "xyes"
851then
4c67453e
FF
852 SAVE_CPPFLAGS="$CPPFLAGS"
853 SAVE_LDFLAGS="$LDFLAGS"
854
855 CPPFLAGS="$CPPFLAGS $librrd_cflags"
856 LDFLAGS="$LDFLAGS $librrd_ldflags"
857
ac9cdb55
FF
858 AC_CHECK_LIB(rrd_th, rrd_update_r,
859 [with_rrdtool="yes"
860 librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
861 ],
862 [librrd_threadsafe="no"
863 AC_CHECK_LIB(rrd, rrd_update,
864 [with_rrdtool="yes"
865 librrd_ldflags="$librrd_ldflags -lrrd -lm"
866 ],
867 [with_rrdtool="no (symbol 'rrd_update' not found)"],
868 [-lm])
2b63c8ca 869 ],
ac9cdb55 870 [-lm])
4c67453e
FF
871
872 CPPFLAGS="$SAVE_CPPFLAGS"
873 LDFLAGS="$SAVE_LDFLAGS"
86ca149a 874fi
b898eac6
NW
875if test "x$with_rrdtool" = "xyes"
876then
ac9cdb55
FF
877 BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
878 BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
879 AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
880 AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
881fi
882if test "x$librrd_threadsafe" = "xyes"
883then
884 AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
b898eac6 885fi
86ca149a 886
c4377c1e
FF
887AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
888[ if test "x$withval" != "xno" -a "x$withval" != "xyes"
9e137cdb
FF
889 then
890 LDFLAGS="$LDFLAGS -L$withval/lib"
891 CPPFLAGS="$CPPFLAGS -I$withval/include"
c4377c1e
FF
892 with_libpthread="yes"
893 else
894 if test "x$withval" = "xno"
895 then
896 with_libpthread="no (disabled)"
897 fi
9e137cdb 898 fi
06bafec5 899], [with_libpthread="yes"])
c4377c1e 900if test "x$with_libpthread" = "xyes"
9e137cdb 901then
c4377c1e 902 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
9e137cdb 903fi
c4377c1e 904if test "x$with_libpthread" = "xyes"
9e137cdb 905then
c4377c1e 906 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
9e137cdb 907fi
c4377c1e 908if test "x$with_libpthread" = "xyes"
9e137cdb
FF
909then
910 collect_pthread=1
911else
912 collect_pthread=0
913fi
914AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
915 [Wether or not to use pthread (POSIX threads) library])
c4377c1e 916AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
6e765a02 917
29f72849 918if test "x$ac_system" = "xSolaris"
86ca149a
FF
919then
920 with_kstat="yes"
d89f6dc3 921 with_devinfo="yes"
3c12e8a6
NW
922else
923 with_kstat="no (Solaris only)"
d89f6dc3 924 with_devinfo="no (Solaris only)"
3c12e8a6 925fi
d89f6dc3 926
3c12e8a6
NW
927if test "x$with_kstat" = "xyes"
928then
080df026 929 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
3c12e8a6
NW
930fi
931if test "x$with_kstat" = "xyes"
932then
080df026 933 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
86ca149a 934 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
86ca149a 935fi
b898eac6
NW
936if test "x$with_kstat" = "xyes"
937then
27adc320
FF
938 AC_DEFINE(HAVE_LIBKSTAT, 1,
939 [Define to 1 if you have the 'kstat' library (-lkstat)])
b898eac6 940fi
d89f6dc3
FF
941AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
942AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
86ca149a 943
1842a7a7
FF
944### BEGIN of check for libcurl ###
945with_curl_config="curl-config"
8f6c03d5 946with_curl_cflags=""
1842a7a7
FF
947with_curl_libs=""
948AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
949[
1842a7a7
FF
950 if test "x$withval" = "xno"
951 then
952 with_libcurl="no"
8f6c03d5
FF
953 else if test "x$withval" = "xyes"
954 then
1842a7a7 955 with_libcurl="yes"
8f6c03d5 956 else
a3cd4630 957 if test -f "$withval" && test -x "$withval"
8f6c03d5
FF
958 then
959 with_curl_config="$withval"
c39428ae 960 with_libcurl="yes"
8f6c03d5
FF
961 else if test -x "$withval/bin/curl-config"
962 then
963 with_curl_config="$withval/bin/curl-config"
c39428ae 964 with_libcurl="yes"
8f6c03d5 965 fi; fi
a3cd4630 966 with_libcurl="yes"
8f6c03d5 967 fi; fi
1842a7a7
FF
968],
969[
970 with_libcurl="yes"
971])
972if test "x$with_libcurl" = "xyes"
973then
8f6c03d5 974 with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1842a7a7
FF
975 curl_config_status=$?
976
977 if test $curl_config_status -ne 0
978 then
48bc4be8 979 with_libcurl="no ($with_curl_config failed)"
1842a7a7 980 else
06c09fee
FF
981 SAVE_CPPFLAGS="$CPPFLAGS"
982 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
8f6c03d5
FF
983
984 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
985
06c09fee 986 CPPFLAGS="$SAVE_CPPFLAGS"
1842a7a7
FF
987 fi
988fi
8f6c03d5 989if test "x$with_libcurl" = "xyes"
1842a7a7 990then
8f6c03d5 991 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1842a7a7
FF
992 curl_config_status=$?
993
994 if test $curl_config_status -ne 0
995 then
48bc4be8 996 with_libcurl="no ($with_curl_config failed)"
1842a7a7 997 else
8f6c03d5 998 AC_CHECK_LIB(curl, curl_easy_init,
48bc4be8 999 [with_libcurl="yes"],
8f6c03d5
FF
1000 [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1001 [$with_curl_libs])
1842a7a7
FF
1002 fi
1003fi
1842a7a7
FF
1004if test "x$with_libcurl" = "xyes"
1005then
8f6c03d5
FF
1006 BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1007 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1008 AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1009 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1842a7a7 1010fi
1842a7a7
FF
1011AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1012### END of check for libcurl ###
1013
adaf6ca0
FF
1014with_libiokit="no"
1015collectd_libiokit=0
1016AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1017[
1018 with_libiokit="yes"
1019 collectd_libiokit=1
1020],
1021[
1022 with_libiokit="no"
1023 collectd_libiokit=0
1024])
1025AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
1026AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1027
3c12e8a6 1028AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
86ca149a 1029[
1842a7a7 1030 if test "x$withval" != "xno" -a "x$withval" != "xyes"
86ca149a 1031 then
42e281c5
NW
1032 LDFLAGS="$LDFLAGS -L$withval/lib"
1033 CPPFLAGS="$CPPFLAGS -I$withval/include"
1034 with_libstatgrab="yes"
86ca149a
FF
1035 fi
1036],
1037[
f830bd02 1038 if test "x$ac_system" == "xunknown"
86ca149a 1039 then
86ca149a 1040 with_libstatgrab="yes"
f830bd02
NW
1041 else
1042 with_libstatgrab="no"
86ca149a
FF
1043 fi
1044])
1045if test "x$with_libstatgrab" = "xyes"
1046then
0aa63f0c 1047 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
3c12e8a6
NW
1048fi
1049if test "x$with_libstatgrab" = "xyes"
1050then
176d5f79 1051 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
86ca149a 1052fi
176d5f79 1053if test "x$with_libstatgrab" = "xyes"
0aa63f0c
FF
1054then
1055 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
0aa63f0c
FF
1056fi
1057if test "x$with_libstatgrab" = "xyes"
176d5f79
NW
1058then
1059 collect_libstatgrab=1
1060else
1061 collect_libstatgrab=0
1062fi
1063AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
1064 [Wether or not to use statgrab library])
1065AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
0aa63f0c 1066AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
28c5e282
FF
1067
1068AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
1069if test "x$with_libkvm" = "xyes"
1070then
1071 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
1072fi
1073AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
86ca149a 1074
14ffdba9
FF
1075with_sensors_cflags=""
1076with_sensors_ldflags=""
3c12e8a6 1077AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
86ca149a 1078[
14ffdba9 1079 if test "x$withval" = "xno"
86ca149a 1080 then
14ffdba9
FF
1081 with_lm_sensors="no"
1082 else
56a554e8 1083 with_lm_sensors="yes"
14ffdba9
FF
1084 if test "x$withval" != "xyes"
1085 then
1086 with_sensors_cflags="-I$withval/include"
1087 with_sensors_ldflags="-L$withval/lib"
1088 with_lm_sensors="yes"
1089 fi
86ca149a
FF
1090 fi
1091],
1092[
86ca149a
FF
1093 if test "x$ac_system" = "xLinux"
1094 then
1095 with_lm_sensors="yes"
1096 else
af18c7e0 1097 with_lm_sensors="no (Linux only library)"
86ca149a
FF
1098 fi
1099])
1100if test "x$with_lm_sensors" = "xyes"
1101then
14ffdba9
FF
1102 SAVE_CPPFLAGS="$CPPFLAGS"
1103 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1104
1105# AC_CHECK_HEADERS(sensors/sensors.h,
1106# [
1107# AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
1108# ],
1109# [with_lm_sensors="no (sensors/sensors.h not found)"])
1110 AC_CHECK_HEADERS(sensors/sensors.h, [], [with_lm_sensors="no (sensors/sensors.h not found)"])
1111
1112 CPPFLAGS="$SAVE_CPPFLAGS"
3c12e8a6
NW
1113fi
1114if test "x$with_lm_sensors" = "xyes"
1115then
14ffdba9
FF
1116 SAVE_CPPFLAGS="$CPPFLAGS"
1117 SAVE_LDFLAGS="$LDFLAGS"
1118 CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
1119 LDFLAGS="$LDFLAGS $with_sensors_ldflags"
1120
1121 AC_CHECK_LIB(sensors, sensors_init,
86ca149a 1122 [
14ffdba9 1123 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
86ca149a 1124 ],
14ffdba9
FF
1125 [with_lm_sensors="no (libsensors not found)"])
1126
1127 CPPFLAGS="$SAVE_CPPFLAGS"
1128 LDFLAGS="$SAVE_LDFLAGS"
56a554e8
NW
1129fi
1130if test "x$with_lm_sensors" = "xyes"
1131then
14ffdba9
FF
1132 BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
1133 BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
1134 AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
1135 AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
86ca149a 1136fi
56a554e8 1137AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
86ca149a 1138
805c4940 1139with_mysql_config="mysql_config"
805c4940
FF
1140with_mysql_cflags=""
1141with_mysql_libs=""
e4303e15
FF
1142AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1143[
805c4940
FF
1144 if test "x$withval" = "xno"
1145 then
1146 with_libmysql="no"
8f6c03d5 1147 else if test "x$withval" = "xyes"
e4303e15 1148 then
e4303e15 1149 with_libmysql="yes"
8f6c03d5 1150 else
a3cd4630 1151 if test -f "$withval" && test -x "$withval";
8f6c03d5
FF
1152 then
1153 with_mysql_config="$withval"
1154 else if test -x "$withval/bin/mysql_config"
1155 then
1156 with_mysql_config="$withval/bin/mysql_config"
1157 fi; fi
a3cd4630 1158 with_libmysql="yes"
8f6c03d5 1159 fi; fi
e4303e15
FF
1160],
1161[
1162 with_libmysql="yes"
1163])
1164if test "x$with_libmysql" = "xyes"
1165then
805c4940
FF
1166 with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1167 mysql_config_status=$?
1168
1169 if test $mysql_config_status -ne 0
1170 then
1171 with_libmysql="no"
1172 else
06c09fee
FF
1173 SAVE_CPPFLAGS="$CPPFLAGS"
1174 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
805c4940
FF
1175
1176 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1177
06c09fee 1178 CPPFLAGS="$SAVE_CPPFLAGS"
805c4940 1179 fi
e4303e15
FF
1180fi
1181if test "x$with_libmysql" = "xyes"
1182then
805c4940 1183 with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
8f6c03d5
FF
1184 mysql_config_status=$?
1185
1186 if test $mysql_config_status -ne 0
1187 then
1188 with_libmysql="no"
1189 else
1190 AC_CHECK_LIB(mysqlclient, mysql_init,
48bc4be8
FF
1191 [with_libmysql="yes"],
1192 [with_libmysql="no (symbol 'mysql_init' not found)"],
8f6c03d5
FF
1193 [$with_mysql_libs])
1194 fi
e4303e15
FF
1195fi
1196if test "x$with_libmysql" = "xyes"
1197then
805c4940
FF
1198 BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1199 BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1200 AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1201 AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
e4303e15 1202fi
e4303e15 1203AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
86ca149a 1204
c64b3f3b
SH
1205with_own_liboconfig="no"
1206liboconfig_LDFLAGS="$LDFLAGS"
1207liboconfig_CPPFLAGS="$CPPFLAGS"
1208AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1209[
1210 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1211 then
1212 if test -d "$withval/lib"
1213 then
1214 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1215 fi
1216 if test -d "$withval/include"
1217 then
1218 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1219 fi
1220 fi
1221 if test "x$withval" = "xno"
1222 then
1223 AC_MSG_ERROR("liboconfig is required")
1224 fi
1225],
1226[
1227 with_liboconfig="yes"
1228])
1229
1230save_LDFLAGS="$LDFLAGS"
1231save_CPPFLAGS="$CPPFLAGS"
1232LDFLAGS="$liboconfig_LDFLAGS"
1233CPPFLAGS="$liboconfig_CPPFLAGS"
1234AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1235[
1236 with_liboconfig="yes"
1237 with_own_liboconfig="no"
1238],
1239[
1240 with_liboconfig="yes"
1241 with_own_liboconfig="yes"
1242 LDFLAGS="$save_LDFLAGS"
1243 CPPFLAGS="$save_CPPFLAGS"
1244])
1245
1246AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1247if test "x$with_own_liboconfig" = "xyes"
1248then
1249 with_liboconfig="yes (shipped version)"
1250fi
1251
6997fb33
FF
1252#with_liboping="yes"
1253with_own_liboping="no"
1254liboping_LDFLAGS="$LDFLAGS"
1255liboping_CPPFLAGS="$CPPFLAGS"
1256AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1257[
1258 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1259 then
1260 if test -d "$withval/lib"
1261 then
1262 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1263 fi
1264 if test -d "$withval/include"
1265 then
1266 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1267 fi
1268 fi
1269 if test "x$withval" = "xno"
1270 then
1271 with_liboping="no"
1272 with_own_liboping="no"
1273 fi
1274],
1275[
1276 #753
1277 with_liboping="yes"
1278])
1279
1280if test "x$with_liboping" = "xyes"
1281then
1282 save_LDFLAGS="$LDFLAGS"
1283 save_CPPFLAGS="$CPPFLAGS"
1284 LDFLAGS="$liboping_LDFLAGS"
1285 CPPFLAGS="$liboping_CPPFLAGS"
1286 AC_CHECK_LIB(oping, ping_construct,
1287 [
1288 with_liboping="yes"
1289 with_own_liboping="no"
1290 ],
1291 [
1292 with_liboping="yes"
1293 with_own_liboping="yes"
1294 LDFLAGS="$save_LDFLAGS"
1295 CPPFLAGS="$save_CPPFLAGS"
1296 ])
1297fi
1298AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1299AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
6997fb33 1300
dd7a9bc9
FF
1301AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1302[
1303 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1304 then
1305 LDFLAGS="$LDFLAGS -L$withval/lib"
1306 CPPFLAGS="$CPPFLAGS -I$withval/include"
1307 with_libpcap="yes"
1308 fi
1309],
1310[
1311 with_libpcap="yes"
1312])
1313if test "x$with_libpcap" = "xyes"
1314then
1315 AC_CHECK_LIB(pcap, pcap_open_live,
1316 [
1317 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1318 ], [with_libpcap="no (libpcap not found)"])
1319fi
1320if test "x$with_libpcap" = "xyes"
1321then
1322 AC_CHECK_HEADERS(pcap.h,
1323 [
1324 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1325 ], [with_libpcap="no (pcap.h not found)"])
1326fi
1327if test "x$with_libpcap" = "xyes"
1328then
1329 collect_libpcap=1
1330else
1331 collect_libpcap=0
1332fi
92f43553 1333AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
dd7a9bc9 1334 [Wether or not to use the pcap library])
92f43553 1335AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
dd7a9bc9 1336
3acac9b0 1337perl_interpreter="perl"
a432a981
FF
1338AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1339[
1340 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1341 then
1342 LDFLAGS="$LDFLAGS -L$withval/lib"
1343 CPPFLAGS="$CPPFLAGS -I$withval/include"
3acac9b0 1344 perl_interpreter="$withval/bin/perl"
a432a981
FF
1345 with_libperl="yes"
1346 fi
1347],
1348[
1349 with_libperl="yes"
1350])
a459afe5
SH
1351
1352AC_SUBST(PERL, "$perl_interpreter")
1353
a432a981
FF
1354if test "x$with_libperl" = "xyes"
1355then
1356 SAVE_CFLAGS=$CFLAGS
1357 SAVE_LDFLAGS=$LDFLAGS
3acac9b0
FF
1358 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1359 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1360 CFLAGS="$CFLAGS $PERL_CFLAGS"
1361 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
a432a981
FF
1362
1363 AC_CACHE_CHECK([for libperl],
1364 [have_libperl],
1365 AC_LINK_IFELSE(
1366 AC_LANG_PROGRAM(
1367 [[
1368#include <EXTERN.h>
1369#include <perl.h>
1370#include <XSUB.h>
1371 ]],
1372 [[
1373 PerlInterpreter *perl = NULL;
1374 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
3acac9b0 1375 newSVpv ("Collectd::Plugin::FooBar", 24),
a432a981
FF
1376 Nullsv);
1377 ]]),
1378 [have_libperl="yes"],
1379 [have_libperl="no"]
1380 )
1381 )
1382
1383 if test "x$have_libperl" = "xyes"
1384 then
1385 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3acac9b0
FF
1386 AC_SUBST(PERL_CFLAGS)
1387 AC_SUBST(PERL_LDFLAGS)
a432a981
FF
1388 else
1389 with_libperl="no"
1390 fi
1391
1392 CFLAGS=$SAVE_CFLAGS
1393 LDFLAGS=$SAVE_LDFLAGS
1394fi
1395AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1396
8de91034
FF
1397AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1398[
1399 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1400 then
1401 LDFLAGS="$LDFLAGS -L$withval/lib"
1402 CPPFLAGS="$CPPFLAGS -I$withval/include"
1403 with_libiptc="yes"
1404 fi
1405],
1406[
1407 if test "x$ac_system" = "xLinux"
1408 then
1409 with_libiptc="yes"
1410 else
1411 with_libiptc="no (Linux only)"
1412 fi
1413])
1414if test "x$with_libiptc" = "xyes"
1415then
1416 AC_CHECK_LIB(iptc, iptc_init,
1417 [
1418 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1419 ], [with_libiptc="no (libiptc not found)"])
1420fi
1421if test "x$with_libiptc" = "xyes"
1422then
1423 AC_CHECK_HEADERS(libiptc/libiptc.h,
1424 [
1425 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1426 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1427fi
1428if test "x$with_libiptc" = "xyes"
1429then
1430 collect_libiptc=1
1431else
1432 collect_libiptc=0
1433fi
1434AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1435
c39428ae
FF
1436with_snmp_config="net-snmp-config"
1437with_snmp_cflags=""
1438with_snmp_libs=""
c02ba630
FF
1439AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1440[
c39428ae
FF
1441 if test "x$withval" = "xno"
1442 then
1443 with_libnetsnmp="no"
ae03d749 1444 else if test "x$withval" = "xyes"
c02ba630 1445 then
c02ba630 1446 with_libnetsnmp="yes"
c39428ae
FF
1447 else
1448 if test -x "$withval"
1449 then
1450 with_snmp_config="$withval"
1451 with_libnetsnmp="yes"
1452 else
1453 with_snmp_config="$withval/bin/net-snmp-config"
1454 with_libnetsnmp="yes"
1455 fi
1456 fi; fi
c02ba630
FF
1457],
1458[with_libnetsnmp="yes"])
1459if test "x$with_libnetsnmp" = "xyes"
1460then
00ff99d8 1461 with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
c39428ae
FF
1462 snmp_config_status=$?
1463
1464 if test $snmp_config_status -ne 0
1465 then
1466 with_libnetsnmp="no ($with_snmp_config failed)"
1467 else
06c09fee
FF
1468 SAVE_CPPFLAGS="$CPPFLAGS"
1469 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
c39428ae
FF
1470
1471 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1472
06c09fee 1473 CPPFLAGS="$SAVE_CPPFLAGS"
c39428ae 1474 fi
c02ba630
FF
1475fi
1476if test "x$with_libnetsnmp" = "xyes"
1477then
00ff99d8 1478 with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
c39428ae
FF
1479 snmp_config_status=$?
1480
1481 if test $snmp_config_status -ne 0
1482 then
1483 with_libnetsnmp="no ($with_snmp_config failed)"
1484 else
1485 AC_CHECK_LIB(netsnmp, init_snmp,
1486 [with_libnetsnmp="yes"],
1487 [with_libnetsnmp="no (libnetsnmp not found)"],
1488 [$with_snmp_libs])
1489 fi
1490fi
00ff99d8 1491if test "x$with_libnetsnmp" = "xyes"
c39428ae
FF
1492then
1493 BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1494 BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1495 AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1496 AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
c02ba630
FF
1497fi
1498AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1499
3fc0feb6
FF
1500with_upsclient_config="libupsclient-config"
1501with_upsclient_cflags=""
1502with_upsclient_libs=""
bc2d9402
FF
1503AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1504[
3fc0feb6 1505 if test "x$withval" = "xno"
bc2d9402 1506 then
3fc0feb6
FF
1507 with_libupsclient="no"
1508 else
395e2cc2 1509 if test "x$withval" != "xyes"
3fc0feb6 1510 then
a3cd4630 1511 if test -f "$withval" && test -x "$withval";
1398c68c
FF
1512 then
1513 with_upsclient_config="$withval"
1514 else
1515 with_upsclient_config="$withval/bin/libupsclient-config"
1516 fi
3fc0feb6 1517 fi
a3cd4630 1518 with_libupsclient="yes"
bc2d9402
FF
1519 fi
1520],
1521[
1522 with_libupsclient="yes"
1523])
1524if test "x$with_libupsclient" = "xyes"
3fc0feb6
FF
1525then
1526 with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1527 upsclient_config_status=$?
1528
1529 if test $upsclient_config_status -ne 0
1530 then
1398c68c 1531 with_libupsclient="no ($with_upsclient_config failed)"
3fc0feb6
FF
1532 fi
1533fi
1534if test "x$with_libupsclient" = "xyes"
1398c68c 1535then
06c09fee
FF
1536 SAVE_CPPFLAGS="$CPPFLAGS"
1537 CPPFLAGS="$CPPFLAGS $with_upsclient_cflags"
1398c68c
FF
1538
1539 AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1540
06c09fee 1541 CPPFLAGS="$SAVE_CPPFLAGS"
1398c68c
FF
1542fi
1543if test "x$with_libupsclient" = "xyes"
3fc0feb6
FF
1544then
1545 with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1546 upsclient_config_status=$?
1547
1548 if test $upsclient_config_status -ne 0
1549 then
1398c68c 1550 with_libupsclient="no ($with_upsclient_config failed)"
3fc0feb6
FF
1551 fi
1552fi
1553if test "x$with_libupsclient" = "xyes"
bc2d9402
FF
1554then
1555 AC_CHECK_LIB(upsclient, upscli_connect,
1556 [
3fc0feb6
FF
1557 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1558 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1559 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1560 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1561 ],
1562 [
1398c68c
FF
1563 with_libupsclient="no (symbol 'upscli_connect' not found)"
1564 ], [$with_upsclient_libs])
bc2d9402 1565fi
8f6c03d5
FF
1566if test "x$with_libupsclient" = "xyes"
1567then
06c09fee
FF
1568 SAVE_CPPFLAGS="$CPPFLAGS"
1569 CPPFLAGS="$CPPFLAGS $with_upsclient_cflags"
1570
8f6c03d5
FF
1571 AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1572[#include <stdlib.h>
1573#include <stdio.h>
1574#include <upsclient.h>])
06c09fee
FF
1575
1576 CPPFLAGS="$SAVE_CPPFLAGS"
8f6c03d5 1577fi
bc2d9402
FF
1578AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1579
558a6a1c
FF
1580### BEGIN of check for libxmms ###
1581with_xmms_config="xmms-config"
558a6a1c
FF
1582with_xmms_cflags=""
1583with_xmms_libs=""
1584AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1585[
1586 if test "x$withval" != "xno" -a "x$withval" != "xyes"
1587 then
a3cd4630
FF
1588 if test -f "$withval" && test -x "$withval";
1589 then
1590 with_xmms_config="$withval"
1591 else if test -x "$withval/bin/xmms-config"
558a6a1c
FF
1592 then
1593 with_xmms_config="$withval/bin/xmms-config"
a3cd4630
FF
1594 fi; fi
1595 with_libxmms="yes"
1596 else if test "x$withval" = "xno"
558a6a1c
FF
1597 then
1598 with_libxmms="no"
1599 else
1600 with_libxmms="yes"
a3cd4630 1601 fi; fi
558a6a1c
FF
1602],
1603[
1604 with_libxmms="yes"
1605])
1606if test "x$with_libxmms" = "xyes"
1607then
1608 with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1609 xmms_config_status=$?
1610
1611 if test $xmms_config_status -ne 0
1612 then
1613 with_libxmms="no"
1614 fi
1615fi
1616if test "x$with_libxmms" = "xyes"
1617then
1618 with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1619 xmms_config_status=$?
1620
1621 if test $xmms_config_status -ne 0
1622 then
1623 with_libxmms="no"
1624 fi
1625fi
1626if test "x$with_libxmms" = "xyes"
1627then
1628 AC_CHECK_LIB(xmms, xmms_remote_get_info,
1629 [
1630 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1631 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1632 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1633 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1634 ],
1635 [
1636 with_libxmms="no"
1637 ],
1638 [$with_xmms_libs])
1639fi
1640with_libxmms_numeric=0
1641if test "x$with_libxmms" = "xyes"
1642then
1643 with_libxmms_numeric=1
1644fi
1645AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1646AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1647### END of check for libxmms ###
1648
c1406acc
FF
1649with_libnetlink_cflags=""
1650with_libnetlink_libs="-lnetlink"
1651AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1652[
1653 echo "libnetlink: withval = $withval"
1654 if test "x$withval" = "xyes"
1655 then
1656 with_libnetlink="yes"
1657 else if test "x$withval" = "xno"
1658 then
1659 with_libnetlink="no"
1660 else
1661 if test -d "$withval/include"
1662 then
1663 with_libnetlink_cflags="-I$withval/include"
1664 with_libnetlink_libs="-L$withval/lib -lnetlink"
1665 with_libnetlink="yes"
1666 else
1667 AC_MSG_ERROR("no such directory: $withval/include")
1668 fi
1669 fi; fi
1670],
1671[
1672 if test "x$ac_system" = "xLinux"
1673 then
1674 with_libnetlink="yes"
1675 else
1676 with_libnetlink="no (Linux only library)"
1677 fi
1678])
1679if test "x$with_libnetlink" = "xyes"
1680then
1681 SAVE_CFLAGS=$CFLAGS
1682 CFLAGS="$CFLAGS $with_libnetlink_cflags"
1683
48bc4be8
FF
1684 with_libnetlink="no (libnetlink.h not found)"
1685
1686 AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1687 [
1688 with_libnetlink="yes"
1689 break
1690 ], [],
c1406acc
FF
1691[#include <stdio.h>
1692#include <sys/types.h>
57825ea7 1693#include <asm/types.h>
c1406acc
FF
1694#include <sys/socket.h>
1695#include <linux/netlink.h>
1696#include <linux/rtnetlink.h>])
5d26a660
FF
1697 AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1698[#include <stdio.h>
1699#include <sys/types.h>
1700#include <asm/types.h>
1701#include <sys/socket.h>])
1702
1703 AC_COMPILE_IFELSE(
1704[#include <stdio.h>
1705#include <sys/types.h>
1706#include <asm/types.h>
1707#include <sys/socket.h>
1708#include <linux/netlink.h>
1709#include <linux/rtnetlink.h>
1710
1711int main (void)
1712{
1713 int retval = TCA_STATS2;
1714 return (retval);
1715}],
1716 [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1717 []);
1718
1719 AC_COMPILE_IFELSE(
1720[#include <stdio.h>
1721#include <sys/types.h>
1722#include <asm/types.h>
1723#include <sys/socket.h>
1724#include <linux/netlink.h>
1725#include <linux/rtnetlink.h>
1726
1727int main (void)
1728{
1729 int retval = TCA_STATS;
1730 return (retval);
1731}],
1732 [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1733 []);
c1406acc
FF
1734
1735 CFLAGS="$SAVE_CFLAGS"
1736fi
1737if test "x$with_libnetlink" = "xyes"
1738then
1739 AC_CHECK_LIB(netlink, rtnl_open,
1740 [with_libnetlink="yes"],
1741 [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1742 [$with_libnetlink_libs])
1743fi
1744if test "x$with_libnetlink" = "xyes"
1745then
05ea4f3f
FF
1746 BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1747 BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
c1406acc
FF
1748 AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1749 AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1750fi
1751AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
5d99fadf 1752
86ca149a
FF
1753# Check for enabled/disabled features
1754#
6e765a02 1755
3c12e8a6
NW
1756# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1757# ------------------------------------------------------------
1758dnl
1759m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1760dnl
1761AC_DEFUN(
1762 [AC_COLLECTD],
1763 [
1764 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1765 m4_if(
1766 [$2],
1767 [enable],
1768 [dnl
1769 m4_define([EnDis],[disabled])dnl
1770 m4_define([YesNo],[no])dnl
1771 ],dnl
1772 [m4_if(
1773 [$2],
1774 [disable],
1775 [dnl
1776 m4_define([EnDis],[enabled])dnl
1777 m4_define([YesNo],[yes])dnl
1778 ],
1779 [dnl
1780 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1781 ]dnl
1782 )]dnl
1783 )dnl
1784 m4_if([$3], [feature], [],
1785 [m4_if(
1786 [$3], [module], [],
1787 [dnl
1788 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1789 ]dnl
1790 )]dnl
1791 )dnl
1792 AC_ARG_ENABLE(
1793 [$1],
1794 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1795 [],
1796 enable_$1='[YesNo]'dnl
1797 )# AC_ARG_ENABLE
1798if test "x$enable_$1" = "xno"
1799then
1800 collectd_$1=0
6e765a02 1801else
3c12e8a6 1802 if test "x$enable_$1" = "xyes"
6e765a02 1803 then
3c12e8a6 1804 collectd_$1=1
6e765a02 1805 else
3c12e8a6
NW
1806 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1807 collectd_$1=1
1808 enable_$1='yes'
6e765a02
FF
1809 fi
1810fi
3c12e8a6
NW
1811 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1812 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1813 ]dnl
1814)# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1815
a905d397
FF
1816# AC_PLUGIN(name, default, info)
1817# ------------------------------------------------------------
1818dnl
1819AC_DEFUN(
1820 [AC_PLUGIN],
1821 [
1822 enable_plugin="no"
1823 AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1824 [
1825 if test "x$enableval" = "xyes"
1826 then
1827 enable_plugin="yes"
1828 else
1829 enable_plugin="no"
1830 fi
1831 ],
1832 [
1833 if test "x$2" = "xyes"
1834 then
1835 enable_plugin="yes"
1836 else
1837 enable_plugin="no"
1838 fi
1839 ])
1840 if test "x$enable_plugin" = "xyes"
1841 then
1842 AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1843 fi
1844 AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1845 enable_$1="$enable_plugin"
1846 ]
1847)# AC_PLUGIN(name, default, info)
1848
3c12e8a6
NW
1849m4_divert_once([HELP_ENABLE], [
1850collectd features:])
a905d397 1851# FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3c12e8a6
NW
1852AC_COLLECTD([debug], [enable], [feature], [debugging])
1853AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
14740db4 1854AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
6e765a02 1855
a905d397
FF
1856plugin_battery="no"
1857plugin_cpu="no"
1858plugin_cpufreq="no"
1859plugin_df="no"
1860plugin_disk="no"
1861plugin_entropy="no"
1862plugin_interface="no"
6d431b70 1863plugin_ipvs="no"
a905d397
FF
1864plugin_irq="no"
1865plugin_load="no"
1866plugin_memory="no"
3fc0feb6 1867plugin_multimeter="no"
a905d397
FF
1868plugin_nfs="no"
1869plugin_processes="no"
1870plugin_serial="no"
1871plugin_swap="no"
1872plugin_tape="no"
03b7ec00 1873plugin_tcpconns="no"
a905d397
FF
1874plugin_users="no"
1875plugin_vserver="no"
1876plugin_wireless="no"
1877
1878# Linux
1879if test "x$ac_system" = "xLinux"
1880then
1881 plugin_battery="yes"
1882 plugin_cpu="yes"
1883 plugin_cpufreq="yes"
1884 plugin_disk="yes"
1885 plugin_entropy="yes"
1886 plugin_interface="yes"
1887 plugin_irq="yes"
1888 plugin_load="yes"
1889 plugin_memory="yes"
1890 plugin_nfs="yes"
1891 plugin_processes="yes"
1892 plugin_serial="yes"
1893 plugin_swap="yes"
03b7ec00 1894 plugin_tcpconns="yes"
a905d397
FF
1895 plugin_vserver="yes"
1896 plugin_wireless="yes"
fb3a07dc
SH
1897
1898 if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1899 then
1900 plugin_ipvs="yes"
1901 fi
a905d397
FF
1902fi
1903
1904# Mac OS X devices
1905if test "x$with_libiokit" = "xyes"
1906then
1907 plugin_battery="yes"
1908 plugin_disk="yes"
1909fi
1910
1911# Solaris
1912if test "x$with_devinfo$with_kstat" = "xyesyes"
1913then
1914 plugin_cpu="yes"
1915 plugin_disk="yes"
1916 plugin_interface="yes"
1917 plugin_memory="yes"
1918 plugin_swap="yes"
1919 plugin_tape="yes"
1920fi
1921
1922# libstatgrab
1923if test "x$with_libstatgrab" = "xyes"
1924then
1925 plugin_interface="yes"
1926 plugin_load="yes"
1927 plugin_memory="yes"
1928 plugin_swap="yes"
1929fi
1930
1931if test "x$have_processor_info" = "xyes"
1932then
1933 plugin_cpu="yes"
1934fi
1935if test "x$have_sysctlbyname" = "xyes"
1936then
1937 plugin_cpu="yes"
1938 plugin_memory="yes"
1695cd07 1939 plugin_tcpconns="yes"
a905d397
FF
1940fi
1941
1942if test "x$have_statfs" = "xyes"
1943then
1944 plugin_df="yes"
1945fi
1946if test "x$have_statvfs" = "xyes"
1947then
1948 plugin_df="yes"
1949fi
1950
1951if test "x$have_getifaddrs" = "xyes"
1952then
1953 plugin_interface="yes"
1954fi
1955
1956if test "x$have_getloadavg" = "xyes"
1957then
1958 plugin_load="yes"
1959fi
1960
1961# Mac OS X memory interface
1962if test "x$have_host_statistics" = "xyes"
1963then
1964 plugin_memory="yes"
1965fi
1966
3fc0feb6
FF
1967if test "x$have_termios_h" = "xyes"
1968then
1969 plugin_multimeter="yes"
1970fi
1971
a905d397
FF
1972if test "x$have_thread_info" = "xyes"
1973then
1974 plugin_processes="yes"
1975fi
1976
1977if test "x$with_libkvm" = "xyes"
1978then
1979 plugin_swap="yes"
1980fi
1981
1982if test "x$have_getutent" = "xyes"
1983then
1984 plugin_users="yes"
1985fi
1986if test "x$have_getutxent" = "xyes"
1987then
1988 plugin_users="yes"
1989fi
1990
1991# FIXME: sysctl for swap plugin
1992
f9ee71b2 1993m4_divert_once([HELP_ENABLE], [
a905d397
FF
1994collectd plugins:])
1995
3fc0feb6
FF
1996AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics])
1997AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC])
1998AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors])
1999AC_PLUGIN([battery], [$plugin_battery], [Battery statistics])
2000AC_PLUGIN([cpu], [$plugin_cpu], [CPU usage statistics])
2001AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics])
2002AC_PLUGIN([csv], [yes], [CSV output plugin])
2003AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
2004AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
2005AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
2006AC_PLUGIN([email], [yes], [EMail statistics])
2007AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
2008AC_PLUGIN([exec], [yes], [Execution of external programs])
2009AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
2010AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
2011AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
6d431b70 2012AC_PLUGIN([ipvs], [$plugin_ipvs], [IPVS connection statistics])
3fc0feb6
FF
2013AC_PLUGIN([irq], [$plugin_irq], [IRQ statistics])
2014AC_PLUGIN([load], [$plugin_load], [System load])
2015AC_PLUGIN([logfile], [yes], [File logging plugin])
2016AC_PLUGIN([mbmon], [yes], [Query mbmond])
0735ed71 2017AC_PLUGIN([memcached], [yes], [memcached statistics])
3fc0feb6
FF
2018AC_PLUGIN([memory], [$plugin_memory], [Memory usage])
2019AC_PLUGIN([multimeter], [$plugin_multimeter], [Read multimeter values])
2020AC_PLUGIN([mysql], [$with_libmysql], [MySQL statistics])
5d99fadf 2021AC_PLUGIN([netlink], [$with_libnetlink], [Enhanced Linux network statistics])
3fc0feb6
FF
2022AC_PLUGIN([network], [yes], [Network communication plugin])
2023AC_PLUGIN([nfs], [$plugin_nfs], [NFS statistics])
62b1cfdd 2024AC_PLUGIN([nginx], [$with_libcurl], [nginx statistics])
3fc0feb6 2025AC_PLUGIN([ntpd], [yes], [NTPd statistics])
a905d397 2026AC_PLUGIN([nut], [$with_libupsclient], [Network UPS tools statistics])
3fc0feb6
FF
2027AC_PLUGIN([perl], [$with_libperl], [Embed a Perl interpreter])
2028AC_PLUGIN([ping], [$with_liboping], [Network latency statistics])
2029AC_PLUGIN([processes], [$plugin_processes], [Process statistics])
2030AC_PLUGIN([rrdtool], [$with_rrdtool], [RRDTool output plugin])
2031AC_PLUGIN([sensors], [$with_lm_sensors], [lm_sensors statistics])
2032AC_PLUGIN([serial], [$plugin_serial], [serial port traffic])
2033AC_PLUGIN([snmp], [$with_libnetsnmp], [SNMP querying plugin])
2034AC_PLUGIN([swap], [$plugin_swap], [Swap usage statistics])
2035AC_PLUGIN([syslog], [$have_syslog], [Syslog logging plugin])
2036AC_PLUGIN([tape], [$plugin_tape], [Tape drive statistics])
03b7ec00 2037AC_PLUGIN([tcpconns], [$plugin_tcpconns], [TCP connection statistics])
3fc0feb6
FF
2038AC_PLUGIN([unixsock], [yes], [Unixsock communication plugin])
2039AC_PLUGIN([users], [$plugin_users], [User statistics])
2040AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
2041AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
2042AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
55b43947 2043
fb3a07dc
SH
2044dnl ip_vs.h
2045if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
2046then
2047 enable_ipvs="$enable_ipvs (ip_vs.h not found)"
2048fi
2049
a459afe5
SH
2050dnl Perl bindings
2051AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
2052[
2053 if test "x$withval" != "xno" && test "x$withval" != "xyes"
2054 then
2055 PERL_BINDINGS_OPTIONS="$withval"
2056 with_perl_bindings="yes"
edbd4701
SH
2057 else
2058 PERL_BINDINGS_OPTIONS=""
2059 with_perl_bindings="$withval"
a459afe5
SH
2060 fi
2061],
2062[
2063 PERL_BINDINGS_OPTIONS=""
2064 with_perl_bindings="yes"
2065])
2066if test "x$with_perl_bindings" = "xyes"
2067then
2068 PERL_BINDINGS="perl"
2069else
2070 PERL_BINDINGS=""
2071fi
2072AC_SUBST(PERL_BINDINGS)
2073AC_SUBST(PERL_BINDINGS_OPTIONS)
2074
2075AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
86ca149a 2076
a905d397
FF
2077if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
2078then
2079 with_liboping="yes (shipped version)"
2080fi
2081
7d32c2bc 2082if test "x$with_libperl" = "xyes"
a432a981 2083then
a459afe5 2084 with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
7d32c2bc 2085else
a432a981
FF
2086 enable_perl="no (needs libperl)"
2087fi
2088
a459afe5
SH
2089if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
2090then
2091 with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
2092fi
2093
86ca149a
FF
2094cat <<EOF;
2095
2096Configuration:
2097 Libraries:
a8025575 2098 libcurl . . . . . . $with_libcurl
adaf6ca0 2099 libiokit . . . . . $with_libiokit
86ccc162 2100 libiptc . . . . . . $with_libiptc
86ca149a 2101 libkstat . . . . . $with_kstat
a905d397 2102 libkvm . . . . . . $with_libkvm
e4303e15 2103 libmysql . . . . . $with_libmysql
5ce6bf75 2104 libnetlink . . . . $with_libnetlink
c02ba630 2105 libnetsnmp . . . . $with_libnetsnmp
c64b3f3b 2106 liboconfig . . . . $with_liboconfig
86ccc162 2107 liboping . . . . . $with_liboping
dd7a9bc9 2108 libpcap . . . . . . $with_libpcap
a432a981 2109 libperl . . . . . . $with_libperl
c4377c1e 2110 libpthread . . . . $with_libpthread
86ccc162
FF
2111 librrd . . . . . . $with_rrdtool
2112 libsensors . . . . $with_lm_sensors
2113 libstatgrab . . . . $with_libstatgrab
2114 libupsclient . . . $with_libupsclient
558a6a1c 2115 libxmms . . . . . . $with_libxmms
86ca149a
FF
2116
2117 Features:
6e765a02 2118 daemon mode . . . . $enable_daemon
86ccc162 2119 debug . . . . . . . $enable_debug
6e765a02 2120
a459afe5
SH
2121 Bindings:
2122 perl . . . . . . . $with_perl_bindings
2123
6e765a02 2124 Modules:
11265296 2125 apache . . . . . . $enable_apache
bfec4e6f 2126 apcups . . . . . . $enable_apcups
11265296 2127 apple_sensors . . . $enable_apple_sensors
84b0b421 2128 battery . . . . . . $enable_battery
86ca149a
FF
2129 cpu . . . . . . . . $enable_cpu
2130 cpufreq . . . . . . $enable_cpufreq
f5b4f424 2131 csv . . . . . . . . $enable_csv
2d03e4e3 2132 df . . . . . . . . $enable_df
86ca149a 2133 disk . . . . . . . $enable_disk
fdfbf887 2134 dns . . . . . . . . $enable_dns
fc257d86 2135 email . . . . . . . $enable_email
1cc2a825 2136 entropy . . . . . . $enable_entropy
11770688 2137 exec . . . . . . . $enable_exec
86ca149a 2138 hddtemp . . . . . . $enable_hddtemp
3268a333 2139 interface . . . . . $enable_interface
35248bcc 2140 iptables . . . . . $enable_iptables
6d431b70 2141 ipvs . . . . . . . $enable_ipvs
3268a333 2142 irq . . . . . . . . $enable_irq
86ca149a 2143 load . . . . . . . $enable_load
05b7b7e3 2144 logfile . . . . . . $enable_logfile
c8e76316 2145 mbmon . . . . . . . $enable_mbmon
0735ed71 2146 memcached . . . . . $enable_memcached
86ca149a 2147 memory . . . . . . $enable_memory
9a5e1523 2148 multimeter . . . . $enable_multimeter
1f2a5bff 2149 mysql . . . . . . . $enable_mysql
c1406acc 2150 netlink . . . . . . $enable_netlink
63450476 2151 network . . . . . . $enable_network
86ca149a 2152 nfs . . . . . . . . $enable_nfs
a3e863a5 2153 nginx . . . . . . . $enable_nginx
2fa44680 2154 ntpd . . . . . . . $enable_ntpd
bc2d9402 2155 nut . . . . . . . . $enable_nut
3f0a64bd 2156 perl . . . . . . . $enable_perl
86ca149a
FF
2157 ping . . . . . . . $enable_ping
2158 processes . . . . . $enable_processes
fd04dec3 2159 rrdtool . . . . . . $enable_rrdtool
86ca149a
FF
2160 sensors . . . . . . $enable_sensors
2161 serial . . . . . . $enable_serial
2aafb6b9 2162 snmp . . . . . . . $enable_snmp
86ca149a 2163 swap . . . . . . . $enable_swap
5bc935fb 2164 syslog . . . . . . $enable_syslog
86ca149a 2165 tape . . . . . . . $enable_tape
03b7ec00 2166 tcpconns . . . . . $enable_tcpconns
86090b3d 2167 unixsock . . . . . $enable_unixsock
0127d402 2168 users . . . . . . . $enable_users
5e70f2e0 2169 vserver . . . . . . $enable_vserver
08037975 2170 wireless . . . . . $enable_wireless
558a6a1c 2171 xmms . . . . . . . $enable_xmms
86ca149a
FF
2172
2173EOF