]> git.ipfire.org Git - thirdparty/collectd.git/blame - configure.in
{hddtemp,mbmon,ntpd} plugins: Only use the `AI_ADDRCONFIG' if it's defined.
[thirdparty/collectd.git] / configure.in
CommitLineData
86ca149a 1dnl Process this file with autoconf to produce a configure script.
7ef8c0d6 2AC_INIT(collectd, 4.0.4)
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
15996f86
FF
33#
34# Checks for header files.
35#
e708ae9b 36AC_HEADER_STDC
86ca149a 37AC_HEADER_SYS_WAIT
6e765a02 38AC_HEADER_DIRENT
6934b3d0 39AC_CHECK_HEADERS(stdint.h)
1842a7a7 40AC_CHECK_HEADERS(stdio.h)
586eed68 41AC_CHECK_HEADERS(errno.h)
3e481d27 42AC_CHECK_HEADERS(math.h)
586eed68 43AC_CHECK_HEADERS(syslog.h)
6e765a02 44AC_CHECK_HEADERS(fcntl.h)
86ca149a 45AC_CHECK_HEADERS(signal.h)
586eed68
FF
46AC_CHECK_HEADERS(assert.h)
47AC_CHECK_HEADERS(sys/types.h)
86ca149a
FF
48AC_CHECK_HEADERS(sys/socket.h)
49AC_CHECK_HEADERS(sys/select.h)
63450476 50AC_CHECK_HEADERS(poll.h)
86ca149a 51AC_CHECK_HEADERS(netdb.h)
586eed68 52AC_CHECK_HEADERS(arpa/inet.h)
86ca149a 53AC_CHECK_HEADERS(sys/resource.h)
c988f52c 54AC_CHECK_HEADERS(sys/param.h)
e94efcbe 55AC_CHECK_HEADERS(kstat.h)
15996f86 56
c9a5b034 57# For ping library
6934b3d0
FF
58AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
59[#if HAVE_STDINT_H
60# include <stdint.h>
61#endif
ac491e03
FF
62#if HAVE_SYS_TYPES_H
63# include <sys/types.h>
64#endif
6934b3d0 65])
c9a5b034 66AC_CHECK_HEADERS(netinet/in.h, [], [],
6934b3d0
FF
67[#if HAVE_STDINT_H
68# include <stdint.h>
69#endif
ac491e03
FF
70#if HAVE_SYS_TYPES_H
71# include <sys/types.h>
72#endif
6934b3d0 73#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
74# include <netinet/in_systm.h>
75#endif
76])
77AC_CHECK_HEADERS(netinet/ip.h, [], [],
6934b3d0
FF
78[#if HAVE_STDINT_H
79# include <stdint.h>
80#endif
ac491e03
FF
81#if HAVE_SYS_TYPES_H
82# include <sys/types.h>
83#endif
6934b3d0 84#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
85# include <netinet/in_systm.h>
86#endif
87#if HAVE_NETINET_IN_H
88# include <netinet/in.h>
89#endif
90])
91AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
6934b3d0
FF
92[#if HAVE_STDINT_H
93# include <stdint.h>
94#endif
ac491e03
FF
95#if HAVE_SYS_TYPES_H
96# include <sys/types.h>
97#endif
6934b3d0 98#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
99# include <netinet/in_systm.h>
100#endif
101#if HAVE_NETINET_IN_H
102# include <netinet/in.h>
103#endif
104#if HAVE_NETINET_IP_H
105# include <netinet/ip.h>
106#endif
107])
108AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
6934b3d0
FF
109[#if HAVE_STDINT_H
110# include <stdint.h>
111#endif
ac491e03
FF
112#if HAVE_SYS_TYPES_H
113# include <sys/types.h>
114#endif
6934b3d0 115#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
116# include <netinet/in_systm.h>
117#endif
118#if HAVE_NETINET_IN_H
119# include <netinet/in.h>
120#endif
121#if HAVE_NETINET_IP_H
122# include <netinet/ip.h>
123#endif
124])
125AC_CHECK_HEADERS(netinet/ip6.h, [], [],
6934b3d0
FF
126[#if HAVE_STDINT_H
127# include <stdint.h>
128#endif
6fe07031
FF
129#if HAVE_SYS_TYPES_H
130# include <sys/types.h>
131#endif
6934b3d0 132#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
133# include <netinet/in_systm.h>
134#endif
135#if HAVE_NETINET_IN_H
136# include <netinet/in.h>
137#endif
138])
139AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
6934b3d0
FF
140[#if HAVE_STDINT_H
141# include <stdint.h>
142#endif
6fe07031
FF
143#if HAVE_SYS_TYPES_H
144# include <sys/types.h>
145#endif
6934b3d0 146#if HAVE_NETINET_IN_SYSTM_H
c9a5b034
FF
147# include <netinet/in_systm.h>
148#endif
149#if HAVE_NETINET_IN_H
150# include <netinet/in.h>
151#endif
152#if HAVE_NETINET_IP6_H
153# include <netinet/ip6.h>
154#endif
155])
79d36d9e
FF
156AC_CHECK_HEADERS(netinet/tcp.h, [], [],
157[#if HAVE_STDINT_H
158# include <stdint.h>
159#endif
160#if HAVE_SYS_TYPES_H
161# include <sys/types.h>
162#endif
163#if HAVE_NETINET_IN_SYSTM_H
164# include <netinet/in_systm.h>
165#endif
166#if HAVE_NETINET_IN_H
167# include <netinet/in.h>
168#endif
169#if HAVE_NETINET_IP_H
170# include <netinet/ip.h>
171#endif
172])
5b9d0a2b
FF
173AC_CHECK_HEADERS(netinet/udp.h, [], [],
174[#if HAVE_STDINT_H
175# include <stdint.h>
176#endif
177#if HAVE_SYS_TYPES_H
178# include <sys/types.h>
179#endif
180#if HAVE_NETINET_IN_SYSTM_H
181# include <netinet/in_systm.h>
182#endif
183#if HAVE_NETINET_IN_H
184# include <netinet/in.h>
185#endif
186#if HAVE_NETINET_IP_H
187# include <netinet/ip.h>
188#endif
189])
c9a5b034 190
e1d497b7 191# For cpu modules
d4b36462
FF
192AC_CHECK_HEADERS(sys/sysctl.h, [], [],
193[
194#if HAVE_SYS_TYPES_H
195# include <sys/types.h>
196#endif
197#if HAVE_SYS_PARAM_H
198# include <sys/param.h>
199#endif
200])
201AC_CHECK_HEADERS(sys/dkstat.h)
daf3a589
FF
202AC_CHECK_HEADERS(mach/mach_init.h)
203AC_CHECK_HEADERS(mach/host_priv.h)
a0d73172 204AC_CHECK_HEADERS(mach/mach_error.h)
907f1439
FF
205AC_CHECK_HEADERS(mach/mach_host.h)
206AC_CHECK_HEADERS(mach/mach_port.h)
207AC_CHECK_HEADERS(mach/mach_types.h)
208AC_CHECK_HEADERS(mach/message.h)
209AC_CHECK_HEADERS(mach/processor_set.h)
daf3a589 210AC_CHECK_HEADERS(mach/processor.h)
907f1439
FF
211AC_CHECK_HEADERS(mach/processor_info.h)
212AC_CHECK_HEADERS(mach/task.h)
213AC_CHECK_HEADERS(mach/thread_act.h)
214AC_CHECK_HEADERS(mach/vm_region.h)
215AC_CHECK_HEADERS(mach/vm_map.h)
216AC_CHECK_HEADERS(mach/vm_prot.h)
54800675 217AC_CHECK_HEADERS(mach/vm_statistics.h)
907f1439 218AC_CHECK_HEADERS(mach/kern_return.h)
e1d497b7 219
46ed2804
FF
220# For hddtemp module
221AC_CHECK_HEADERS(linux/major.h)
42403193 222AC_CHECK_HEADERS(libgen.h)
46ed2804 223
dc42e3e0 224# For the apple_sensors module
adaf6ca0
FF
225AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h)
226AC_CHECK_HEADERS(IOKit/IOKitLib.h)
227AC_CHECK_HEADERS(IOKit/IOTypes.h)
228
11265296
FF
229# For the battery plugin
230AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
231[
232#if HAVE_IOKIT_IOKITLIB_H
233# include <IOKit/IOKitLib.h>
234#endif
235#if HAVE_IOKIT_IOTYPES_H
236# include <IOKit/IOTypes.h>
237#endif
238])
239AC_CHECK_HEADERS(IOKit/ps/IOPSKeys.h)
240
ce5ce8ad
FF
241# For the `disk' plugin
242AC_CHECK_HEADERS(IOKit/IOBSD.h)
243AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDriver.h)
244
15996f86
FF
245# For load module
246AC_CHECK_HEADERS(sys/loadavg.h)
247
44a3f33a
FF
248# For the processes plugin
249AC_CHECK_HEADERS(linux/config.h)
250
daedf582 251# For the swap module
d4b36462
FF
252AC_CHECK_HEADERS(sys/swap.h, [], [],
253[
254#if HAVE_SYS_TYPES_H
255# include <sys/types.h>
256#endif
257#if HAVE_SYS_PARAM_H
258# include <sys/param.h>
259#endif
260])
daedf582 261
15996f86 262# For users module
82d65d87 263AC_CHECK_HEADERS(utmp.h)
6e481905 264AC_CHECK_HEADERS(utmpx.h)
86ca149a 265
3268a333 266# For interface plugin
a05e34a0 267AC_CHECK_HEADERS(ifaddrs.h)
cd377858
FF
268AC_CHECK_HEADERS(net/if.h, [], [],
269[
270#if HAVE_SYS_TYPES_H
271# include <sys/types.h>
272#endif
273#if HAVE_SYS_SOCKET_H
274# include <sys/socket.h>
275#endif
276])
a05e34a0
FF
277AC_CHECK_HEADERS(linux/if.h, [], [],
278[
279#if HAVE_SYS_TYPES_H
280# include <sys/types.h>
281#endif
282#if HAVE_SYS_SOCKET_H
283# include <sys/socket.h>
284#endif
285])
286AC_CHECK_HEADERS(linux/netdevice.h, [], [],
287[
288#if HAVE_SYS_TYPES_H
289# include <sys/types.h>
290#endif
291#if HAVE_SYS_SOCKET_H
292# include <sys/socket.h>
293#endif
294#if HAVE_LINUX_IF_H
295# include <linux/if.h>
296#endif
297])
298
a8025575
FF
299# For apache plugin
300AC_CHECK_HEADERS(curl/curl.h)
301
6e765a02 302# For quota module
d4b36462
FF
303AC_CHECK_HEADERS(pwd.h)
304AC_CHECK_HEADERS(sys/ucred.h, [], [],
305[
306#if HAVE_SYS_TYPES_H
307# include <sys/types.h>
308#endif
309#if HAVE_SYS_PARAM_H
310# include <sys/param.h>
311#endif
312])
6e765a02
FF
313AC_CHECK_HEADERS(ctype.h)
314AC_CHECK_HEADERS(limits.h)
315AC_CHECK_HEADERS(sys/quota.h)
316AC_CHECK_HEADERS(xfs/xqm.h)
317
318# For mount interface
319AC_CHECK_HEADERS(fs_info.h)
320AC_CHECK_HEADERS(fshelp.h)
321AC_CHECK_HEADERS(paths.h)
322AC_CHECK_HEADERS(mntent.h)
323AC_CHECK_HEADERS(mnttab.h)
324AC_CHECK_HEADERS(sys/fstyp.h)
325AC_CHECK_HEADERS(sys/fs_types.h)
326AC_CHECK_HEADERS(sys/mntent.h)
327AC_CHECK_HEADERS(sys/mnttab.h)
d4b36462
FF
328AC_CHECK_HEADERS(sys/mount.h, [], [],
329[
330#if HAVE_SYS_TYPES_H
331# include <sys/types.h>
332#endif
333#if HAVE_SYS_PARAM_H
334# include <sys/param.h>
335#endif
336])
6e765a02 337AC_CHECK_HEADERS(sys/statfs.h)
2d03e4e3 338AC_CHECK_HEADERS(sys/statvfs.h)
6e765a02
FF
339AC_CHECK_HEADERS(sys/vfs.h)
340AC_CHECK_HEADERS(sys/vfstab.h)
341
28c5e282
FF
342# For the swap plugin, FreeBSD
343AC_CHECK_HEADERS(kvm.h)
344
fc257d86
SH
345# For the email plugin
346AC_CHECK_HEADERS(linux/un.h, [], [],
347[
348#if HAVE_SYS_SOCKET_H
349# include <sys/socket.h>
350#endif
351])
352AC_CHECK_HEADERS(sys/un.h)
8389947b 353AC_CHECK_HEADERS(grp.h)
fc257d86 354
6e765a02
FF
355# For debugging interface (variable number of arguments)
356AC_CHECK_HEADERS(stdarg.h)
357
ec88fb0e
FF
358# Regular expressions for the ignorelist.
359AC_CHECK_HEADERS(regex.h)
360
fdfbf887 361# For the dns plugin
c4377c1e 362AC_CHECK_HEADERS(arpa/nameser.h arpa/nameser_compat.h)
c4377c1e 363
e94efcbe
FF
364AC_CHECK_HEADERS(net/if_arp.h, [], [],
365[#if HAVE_SYS_SOCKET_H
366# include <sys/socket.h>
367#endif
368])
e40574f3
FF
369AC_CHECK_HEADERS(net/ppp_defs.h)
370AC_CHECK_HEADERS(net/if_ppp.h, [], [],
371[#if HAVE_NET_PPP_DEFS_H
372# include <net/ppp_defs.h>
373#endif
374])
e94efcbe
FF
375AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
376[#if HAVE_STDINT_H
377# include <stdint.h>
378#endif
379#if HAVE_SYS_TYPES_H
380# include <sys/types.h>
381#endif
382#if HAVE_SYS_SOCKET_H
383# include <sys/socket.h>
384#endif
385#if HAVE_NET_IF_H
386# include <net/if.h>
387#endif
388#if HAVE_NETINET_IN_H
389# include <netinet/in.h>
390#endif
391])
dd7a9bc9 392
51e70a99
FF
393# For the multimeter plugin
394AC_CHECK_HEADERS(termios.h)
395AC_CHECK_HEADERS(sys/ioctl.h)
396
8de91034
FF
397#
398# Checking for libraries
399#
86ca149a
FF
400AC_CHECK_LIB(m, ext)
401
15996f86
FF
402#
403# Checks for typedefs, structures, and compiler characteristics.
404#
86ca149a
FF
405AC_C_CONST
406AC_TYPE_PID_T
407AC_TYPE_SIZE_T
7df03651 408AC_TYPE_UID_T
86ca149a
FF
409AC_HEADER_TIME
410
15996f86
FF
411#
412# Checks for library functions.
413#
86ca149a 414AC_PROG_GCC_TRADITIONAL
6e765a02 415AC_CHECK_FUNCS(gettimeofday select strdup strtol)
586eed68 416AC_CHECK_FUNCS(getaddrinfo getnameinfo)
86ca149a 417AC_CHECK_FUNCS(strchr memcpy strstr strcmp strncmp strncpy strlen)
6e765a02 418AC_CHECK_FUNCS(strncasecmp strcasecmp)
c988f52c 419AC_CHECK_FUNCS(openlog syslog closelog)
15996f86 420
d89f6dc3
FF
421socket_needs_socket="no"
422AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
423AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
424
4ca5457f
FF
425nanosleep_needs_rt="no"
426AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
427AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
428
ec88fb0e
FF
429# Regular expressions for the ignorelist.
430AC_CHECK_FUNCS(regcomp regerror regexec regfree)
431
e1d497b7
FF
432# For cpu module
433AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
434
2d03e4e3
FF
435# For df module
436AC_CHECK_FUNCS(statfs statvfs)
437
15996f86
FF
438# For load module
439AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
440
256810b6
FF
441# For the `processes' plugin
442AC_CHECK_FUNCS(thread_info)
443
15996f86 444# For users module
b898eac6 445AC_CHECK_FUNCS(getutent getutxent)
86ca149a 446
6e765a02
FF
447# For quota module
448AC_CHECK_FUNCS(quotactl)
449AC_CHECK_FUNCS(getgrgid getpwuid)
450
3268a333 451# For interface module
a05e34a0
FF
452AC_CHECK_FUNCS(getifaddrs)
453
e91c40b8 454# Check for NAN
18fdfeca
FF
455AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
456[
457 if test "x$withval" = "xno"; then
458 nan_type="none"
459 else if test "x$withval" = "xyes"; then
460 nan_type="zero"
461 else
462 nan_type="$withval"
463 fi; fi
464],
465[nan_type="none"])
e91c40b8
FF
466if test "x$nan_type" = "xnone"; then
467 AC_CACHE_CHECK([whether NAN is defined by default],
468 [have_nan_default],
469 AC_COMPILE_IFELSE(
470 AC_LANG_PROGRAM(
471 [[
472#include <stdlib.h>
473#include <math.h>
474static float foo = NAN;
475 ]],
476 [[
477 if (isnan (foo))
478 return 0;
479 else
480 return 1;
481 ]]),
482 [have_nan_default="yes"],
483 [have_nan_default="no"]
484 )
485 )
486 if test "x$have_nan_default" = "xyes"
487 then
18fdfeca 488 nan_type="default"
e91c40b8
FF
489 fi
490fi
491if test "x$nan_type" = "xnone"; then
492 AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
493 [have_nan_isoc],
494 AC_COMPILE_IFELSE(
495 AC_LANG_PROGRAM(
496 [[
497#include <stdlib.h>
498#define __USE_ISOC99 1
499#include <math.h>
500static float foo = NAN;
501 ]],
502 [[
503 if (isnan (foo))
504 return 0;
505 else
506 return 1;
507 ]]),
508 [have_nan_isoc="yes"],
509 [have_nan_isoc="no"]
510 )
511 )
512 if test "x$have_nan_isoc" = "xyes"
513 then
18fdfeca 514 nan_type="isoc99"
e91c40b8
FF
515 fi
516fi
517if test "x$nan_type" = "xnone"; then
518 AC_CACHE_CHECK([whether NAN can be defined by 0/0],
519 [have_nan_zero],
520 AC_RUN_IFELSE(
521 AC_LANG_PROGRAM(
522 [[
523#include <stdlib.h>
524#include <math.h>
dcc46cbc
FF
525#ifdef NAN
526# undef NAN
527#endif
e91c40b8
FF
528#define NAN (0.0 / 0.0)
529#ifndef isnan
530# define isnan(f) ((f) != (f))
531#endif
532static float foo = NAN;
533 ]],
534 [[
535 if (isnan (foo))
536 return 0;
537 else
538 return 1;
539 ]]),
540 [have_nan_zero="yes"],
541 [have_nan_zero="no"]
542 )
543 )
544 if test "x$have_nan_zero" = "xyes"
545 then
18fdfeca 546 nan_type="zero"
e91c40b8
FF
547 fi
548fi
18fdfeca
FF
549
550if test "x$nan_type" = "xdefault"; then
551 AC_DEFINE(NAN_STATIC_DEFAULT, 1,
552 [Define if NAN is defined by default and can initialize static variables.])
553else if test "x$nan_type" = "xisoc99"; then
554 AC_DEFINE(NAN_STATIC_ISOC, 1,
555 [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
556else if test "x$nan_type" = "xzero"; then
557 AC_DEFINE(NAN_ZERO_ZERO, 1,
558 [Define if NAN can be defined as (0.0 / 0.0)])
559else
e91c40b8 560 AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
18fdfeca 561fi; fi; fi
e91c40b8 562
6e765a02 563# For mount interface
2dc3f07b
FF
564#AC_CHECK_FUNCS(getfsent getvfsent)
565
566have_getfsstat="no"
567AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
568have_getvfsstat="no"
569AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
570have_listmntent="no"
571AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
572
573have_getmntent="no"
574AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
575if test "x$have_getmntent" = "xno"; then
576 AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
c9a5b034 577fi
2dc3f07b
FF
578if test "x$have_getmntent" = "xno"; then
579 AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
c9a5b034 580fi
2dc3f07b
FF
581if test "x$have_getmntent" = "xno"; then
582 AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
c9a5b034
FF
583fi
584
2dc3f07b 585if test "x$have_getmntent" = "xc"; then
6e765a02 586 AC_CACHE_CHECK([whether getmntent takes one argument],
2dc3f07b 587 [have_one_getmntent],
6e765a02
FF
588 AC_COMPILE_IFELSE(
589 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
2dc3f07b 590#include <mntent.h>
6e765a02 591#include "$srcdir/src/utils_mount.h"]],
2dc3f07b
FF
592 [[
593 FILE *fh;
594 struct mntent *me;
595 fh = setmntent ("/etc/mtab", "r");
596 me = getmntent (fh);
597 ]]
6e765a02 598 ),
2dc3f07b
FF
599 [have_one_getmntent="yes"],
600 [have_one_getmntent="no"]
6e765a02
FF
601 )
602 )
2dc3f07b
FF
603 AC_CACHE_CHECK([whether getmntent takes two arguments],
604 [have_two_getmntent],
605 AC_COMPILE_IFELSE(
606 AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
607#include <sys/mnttab.h>
6e765a02 608#include "$srcdir/src/utils_mount.h"]],
2dc3f07b
FF
609 [[
610 FILE *fh;
611 struct mnttab mt;
612 int status;
613 fh = fopen ("/etc/mnttab", "r");
614 status = getmntent (fh, &mt);
615 ]]
616 ),
617 [have_two_getmntent="yes"],
618 [have_two_getmntent="no"]
6e765a02 619 )
2dc3f07b
FF
620 )
621fi
622
623# Check for different versions of `getmntent' here..
624
625if test "x$have_getmntent" = "xc"; then
626 if test "x$have_one_getmntent" = "xyes"; then
627 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
628 [Define if the function getmntent exists and takes one argument.])
629 fi
630 if test "x$have_two_getmntent" = "xyes"; then
631 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
632 [Define if the function getmntent exists and takes two arguments.])
6e765a02 633 fi
6e765a02 634fi
2dc3f07b
FF
635if test "x$have_getmntent" = "xsun"; then
636 AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
637 [Define if the function getmntent exists. It's the version from libsun.])
6e765a02 638fi
2dc3f07b
FF
639if test "x$have_getmntent" = "xseq"; then
640 AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
641 [Define if the function getmntent exists. It's the version from libseq.])
642fi
643if test "x$have_getmntent" = "xgen"; then
644 AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
645 [Define if the function getmntent exists. It's the version from libgen.])
6e765a02
FF
646fi
647
a05e34a0 648# Check for structures
906bea76 649AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
a05e34a0
FF
650 [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
651 [],
cd377858
FF
652 [
653 #include <sys/types.h>
654 #include <sys/socket.h>
655 #include <net/if.h>
656 ])
906bea76 657AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
a05e34a0
FF
658 [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
659 [],
660 [
661 #include <sys/types.h>
662 #include <sys/socket.h>
663 #include <linux/if.h>
664 #include <linux/netdevice.h>
665 ])
666
5b9d0a2b
FF
667AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
668[#if HAVE_STDINT_H
669# include <stdint.h>
670#endif
671#if HAVE_SYS_TYPES_H
672# include <sys/types.h>
673#endif
674#if HAVE_NETINET_IN_SYSTM_H
675# include <netinet/in_systm.h>
676#endif
677#if HAVE_NETINET_IN_H
678# include <netinet/in.h>
679#endif
680#if HAVE_NETINET_IP_H
681# include <netinet/ip.h>
682#endif
683#if HAVE_NETINET_UDP_H
684# include <netinet/udp.h>
685#endif
686])
687AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
688[#if HAVE_STDINT_H
689# include <stdint.h>
690#endif
691#if HAVE_SYS_TYPES_H
692# include <sys/types.h>
693#endif
694#if HAVE_NETINET_IN_SYSTM_H
695# include <netinet/in_systm.h>
696#endif
697#if HAVE_NETINET_IN_H
698# include <netinet/in.h>
699#endif
700#if HAVE_NETINET_IP_H
701# include <netinet/ip.h>
702#endif
703#if HAVE_NETINET_UDP_H
704# include <netinet/udp.h>
705#endif
706])
2aff261d 707
e94efcbe
FF
708AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
709 [],
710 [],
711 [
712#if HAVE_KSTAT_H
713# include <kstat.h>
714#endif
715 ])
716
86ca149a
FF
717AC_MSG_CHECKING([for kernel type ($host_os)])
718case $host_os in
719 *linux*)
256810b6 720 AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
86ca149a
FF
721 ac_system="Linux"
722 ;;
723 *solaris*)
256810b6 724 AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
86ca149a
FF
725 ac_system="Solaris"
726 ;;
727 *)
728 ac_system="unknown"
729esac
730AC_MSG_RESULT([$ac_system])
731
a58af051
FF
732with_libresolv="yes"
733AC_CHECK_LIB(resolv, res_search,
734[
735 AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
736],
737[with_libresolv="no"])
738AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
86ca149a 739
125bdc00 740
c27cdba8
NW
741m4_divert_once([HELP_WITH], [
742collectd additional packages:])
743
86ca149a 744# AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3c12e8a6 745AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
42e281c5 746[ if test "x$withval" != "xno" && test "x$withval" != "xyes"
86ca149a
FF
747 then
748 LDFLAGS="$LDFLAGS -L$withval/lib"
749 CPPFLAGS="$CPPFLAGS -I$withval/include"
750 with_rrdtool="yes"
751 fi
752], [with_rrdtool="yes"])
753if test "x$with_rrdtool" = "xyes"
754then
a58af051
FF
755 AC_CHECK_LIB(rrd, rrd_update,
756 [
757 AC_DEFINE(HAVE_LIBRRD, 1, [Define to 1 if you have the rrd library (-lrrd).])
758 ],
759 [with_rrdtool="no (librrd not found)"], [-lm])
86ca149a
FF
760fi
761if test "x$with_rrdtool" = "xyes"
762then
3c12e8a6 763 AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
86ca149a 764fi
b898eac6
NW
765if test "x$with_rrdtool" = "xyes"
766then
767 collect_rrdtool=1
768else
769 collect_rrdtool=0
770fi
771AC_DEFINE_UNQUOTED(COLLECT_RRDTOOL, [$collect_rrdtool],
772 [Wether or not to use rrdtool library])
86ca149a
FF
773AM_CONDITIONAL(BUILD_WITH_RRDTOOL, test "x$with_rrdtool" = "xyes")
774
c4377c1e
FF
775AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
776[ if test "x$withval" != "xno" -a "x$withval" != "xyes"
9e137cdb
FF
777 then
778 LDFLAGS="$LDFLAGS -L$withval/lib"
779 CPPFLAGS="$CPPFLAGS -I$withval/include"
c4377c1e
FF
780 with_libpthread="yes"
781 else
782 if test "x$withval" = "xno"
783 then
784 with_libpthread="no (disabled)"
785 fi
9e137cdb 786 fi
06bafec5 787], [with_libpthread="yes"])
c4377c1e 788if test "x$with_libpthread" = "xyes"
9e137cdb 789then
c4377c1e 790 AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
9e137cdb 791fi
c4377c1e 792if test "x$with_libpthread" = "xyes"
9e137cdb 793then
c4377c1e 794 AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
9e137cdb 795fi
c4377c1e 796if test "x$with_libpthread" = "xyes"
9e137cdb
FF
797then
798 collect_pthread=1
799else
800 collect_pthread=0
801fi
802AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
803 [Wether or not to use pthread (POSIX threads) library])
c4377c1e 804AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
6e765a02 805
86ca149a
FF
806if test "$ac_system" = "Solaris"
807then
808 with_kstat="yes"
d89f6dc3 809 with_devinfo="yes"
3c12e8a6
NW
810else
811 with_kstat="no (Solaris only)"
d89f6dc3 812 with_devinfo="no (Solaris only)"
3c12e8a6 813fi
d89f6dc3 814
3c12e8a6
NW
815if test "x$with_kstat" = "xyes"
816then
080df026 817 AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
3c12e8a6
NW
818fi
819if test "x$with_kstat" = "xyes"
820then
080df026 821 AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
86ca149a 822 AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
86ca149a 823fi
b898eac6
NW
824if test "x$with_kstat" = "xyes"
825then
27adc320
FF
826 AC_DEFINE(HAVE_LIBKSTAT, 1,
827 [Define to 1 if you have the 'kstat' library (-lkstat)])
b898eac6 828fi
d89f6dc3
FF
829AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
830AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
86ca149a 831
1842a7a7
FF
832### BEGIN of check for libcurl ###
833with_curl_config="curl-config"
834with_curl_prefix=0
835with_curl_libs=""
836AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
837[
838 if test "x$withval" != "xno" -a "x$withval" != "xyes"
839 then
840 if test -x "$withval/bin/curl-config"
841 then
842 with_curl_config="$withval/bin/curl-config"
843 with_curl_prefix=1
844 fi
845 fi
846 if test "x$withval" = "xno"
847 then
848 with_libcurl="no"
849 else
850 with_libcurl="yes"
851 fi
852],
853[
854 with_libcurl="yes"
855])
856if test "x$with_libcurl" = "xyes"
857then
858 with_curl_libs=`$with_curl_config --libs 2>/dev/null`
859 curl_config_status=$?
860
861 if test $curl_config_status -ne 0
862 then
863 with_libcurl="no"
864 else
865 AC_CHECK_LIB(curl, curl_easy_init,
866 [
867 BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
868 AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
869 ],
870 [
871 with_libcurl="no"
872 ],
873 [$with_curl_libs])
874 fi
875fi
876if test "x$with_libcurl" = "xyes" -a $with_curl_prefix -ne 0
877then
878 with_curl_prefix=`$with_curl_config --libs 2>/dev/null`
879 curl_config_status=$?
880
881 if test $curl_config_status -ne 0
882 then
883 with_libcurl="no"
884 else
885 if test -d "$with_curl_prefix/include"
886 then
887 CPPFLAGS="$CPPFLAGS -I$with_curl_prefix/include"
888 fi
889 fi
890fi
891
892with_libcurl_numeric=0
893if test "x$with_libcurl" = "xyes"
894then
895 with_libcurl_numeric=1
896fi
897AC_DEFINE_UNQUOTED(HAVE_LIBCURL, [$with_libcurl_numeric], [Define to 1 if you have the 'curl' library (-lcurl).])
898AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
899### END of check for libcurl ###
900
adaf6ca0
FF
901with_libiokit="no"
902collectd_libiokit=0
903AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
904[
905 with_libiokit="yes"
906 collectd_libiokit=1
907],
908[
909 with_libiokit="no"
910 collectd_libiokit=0
911])
912AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
913AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
914
0aa63f0c
FF
915with_libstatgrab="yes"
916with_libdevstat="no"
3c12e8a6 917AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
86ca149a 918[
1842a7a7 919 if test "x$withval" != "xno" -a "x$withval" != "xyes"
86ca149a 920 then
42e281c5
NW
921 LDFLAGS="$LDFLAGS -L$withval/lib"
922 CPPFLAGS="$CPPFLAGS -I$withval/include"
923 with_libstatgrab="yes"
86ca149a
FF
924 fi
925],
926[
f830bd02 927 if test "x$ac_system" == "xunknown"
86ca149a 928 then
86ca149a 929 with_libstatgrab="yes"
f830bd02
NW
930 else
931 with_libstatgrab="no"
86ca149a
FF
932 fi
933])
934if test "x$with_libstatgrab" = "xyes"
935then
0aa63f0c 936 AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
3c12e8a6
NW
937fi
938if test "x$with_libstatgrab" = "xyes"
939then
176d5f79 940 AC_CHECK_HEADERS(statgrab.h,, [with_libstatgrab="no (statgrab.h not found)"])
86ca149a 941fi
176d5f79 942if test "x$with_libstatgrab" = "xyes"
0aa63f0c
FF
943then
944 AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
0aa63f0c
FF
945fi
946if test "x$with_libstatgrab" = "xyes"
176d5f79
NW
947then
948 collect_libstatgrab=1
949else
950 collect_libstatgrab=0
951fi
952AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
953 [Wether or not to use statgrab library])
954AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
0aa63f0c 955AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT, test "x$with_libdevstat" = "xyes")
28c5e282
FF
956
957AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
958if test "x$with_libkvm" = "xyes"
959then
960 AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
961fi
962AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
86ca149a 963
3c12e8a6 964AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
86ca149a 965[
56a554e8 966 if test "x$withval" != "xno" && test "x$withval" != "xyes"
86ca149a 967 then
56a554e8
NW
968 LDFLAGS="$LDFLAGS -L$withval/lib"
969 CPPFLAGS="$CPPFLAGS -I$withval/include"
970 with_lm_sensors="yes"
86ca149a
FF
971 fi
972],
973[
86ca149a
FF
974 if test "x$ac_system" = "xLinux"
975 then
976 with_lm_sensors="yes"
977 else
978 with_lm_sensors="no"
979 fi
980])
981if test "x$with_lm_sensors" = "xyes"
982then
983 AC_CHECK_LIB(sensors, sensors_init,
984 [
86ca149a
FF
985 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
986 ],
56a554e8 987 [with_lm_sensors="no (libsensors not found)"])
3c12e8a6
NW
988fi
989if test "x$with_lm_sensors" = "xyes"
990then
86ca149a
FF
991 AC_CHECK_HEADERS(sensors/sensors.h,
992 [
86ca149a
FF
993 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
994 ],
56a554e8
NW
995 [with_lm_sensors="no (sensors/sensors.h not found)"])
996fi
997if test "x$with_lm_sensors" = "xyes"
998then
999 collect_lm_sensors=1
1000else
1001 collect_lm_sensors=0
86ca149a 1002fi
56a554e8
NW
1003AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
1004 [Wether or not to use sensors library])
1005AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
86ca149a 1006
e4303e15
FF
1007AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1008[
1009 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1010 then
1011 LDFLAGS="$LDFLAGS -L$withval/lib"
1012 CPPFLAGS="$CPPFLAGS -I$withval/include"
1013 with_libmysql="yes"
1014 fi
1015],
1016[
1017 with_libmysql="yes"
1018])
1019if test "x$with_libmysql" = "xyes"
1020then
2bb1a064
FF
1021 AC_CHECK_LIB(mysqlclient, mysql_init,
1022 [
1023 AC_DEFINE(HAVE_LIBMYSQLCLIENT, 1, [Define to 1 if you have the mysqlclient library (-lmysqlclient).])
1024 ], [with_libmysql="no (libmysql not found)"])
e4303e15
FF
1025fi
1026if test "x$with_libmysql" = "xyes"
1027then
2bb1a064
FF
1028 AC_CHECK_HEADERS(mysql/mysql.h,
1029 [
1030 AC_DEFINE(HAVE_MYSQL_MYSQL_H, 1, [Define to 1 if you have the <mysql/mysql.h> header file.])
1031 ], [with_libmysql="no (mysql/mysql.h not found)"])
e4303e15
FF
1032fi
1033if test "x$with_libmysql" = "xyes"
1034then
1035 collect_libmysql=1
1036else
1037 collect_libmysql=0
1038fi
1039AC_DEFINE_UNQUOTED(COLLECT_LIBMYSQL, [$collect_libmysql],
1040 [Wether or not to use mysql library])
1041AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
86ca149a 1042
c64b3f3b
SH
1043with_own_liboconfig="no"
1044liboconfig_LDFLAGS="$LDFLAGS"
1045liboconfig_CPPFLAGS="$CPPFLAGS"
1046AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1047[
1048 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1049 then
1050 if test -d "$withval/lib"
1051 then
1052 liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1053 fi
1054 if test -d "$withval/include"
1055 then
1056 liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1057 fi
1058 fi
1059 if test "x$withval" = "xno"
1060 then
1061 AC_MSG_ERROR("liboconfig is required")
1062 fi
1063],
1064[
1065 with_liboconfig="yes"
1066])
1067
1068save_LDFLAGS="$LDFLAGS"
1069save_CPPFLAGS="$CPPFLAGS"
1070LDFLAGS="$liboconfig_LDFLAGS"
1071CPPFLAGS="$liboconfig_CPPFLAGS"
1072AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1073[
1074 with_liboconfig="yes"
1075 with_own_liboconfig="no"
1076],
1077[
1078 with_liboconfig="yes"
1079 with_own_liboconfig="yes"
1080 LDFLAGS="$save_LDFLAGS"
1081 CPPFLAGS="$save_CPPFLAGS"
1082])
1083
1084AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1085if test "x$with_own_liboconfig" = "xyes"
1086then
1087 with_liboconfig="yes (shipped version)"
1088fi
1089
6997fb33
FF
1090#with_liboping="yes"
1091with_own_liboping="no"
1092liboping_LDFLAGS="$LDFLAGS"
1093liboping_CPPFLAGS="$CPPFLAGS"
1094AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1095[
1096 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1097 then
1098 if test -d "$withval/lib"
1099 then
1100 liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1101 fi
1102 if test -d "$withval/include"
1103 then
1104 liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1105 fi
1106 fi
1107 if test "x$withval" = "xno"
1108 then
1109 with_liboping="no"
1110 with_own_liboping="no"
1111 fi
1112],
1113[
1114 #753
1115 with_liboping="yes"
1116])
1117
1118if test "x$with_liboping" = "xyes"
1119then
1120 save_LDFLAGS="$LDFLAGS"
1121 save_CPPFLAGS="$CPPFLAGS"
1122 LDFLAGS="$liboping_LDFLAGS"
1123 CPPFLAGS="$liboping_CPPFLAGS"
1124 AC_CHECK_LIB(oping, ping_construct,
1125 [
1126 with_liboping="yes"
1127 with_own_liboping="no"
1128 ],
1129 [
1130 with_liboping="yes"
1131 with_own_liboping="yes"
1132 LDFLAGS="$save_LDFLAGS"
1133 CPPFLAGS="$save_CPPFLAGS"
1134 ])
1135fi
1136AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1137AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1138if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1139then
1140 with_liboping="yes (shipped version)"
1141fi
1142
dd7a9bc9
FF
1143AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1144[
1145 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1146 then
1147 LDFLAGS="$LDFLAGS -L$withval/lib"
1148 CPPFLAGS="$CPPFLAGS -I$withval/include"
1149 with_libpcap="yes"
1150 fi
1151],
1152[
1153 with_libpcap="yes"
1154])
1155if test "x$with_libpcap" = "xyes"
1156then
1157 AC_CHECK_LIB(pcap, pcap_open_live,
1158 [
1159 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1160 ], [with_libpcap="no (libpcap not found)"])
1161fi
1162if test "x$with_libpcap" = "xyes"
1163then
1164 AC_CHECK_HEADERS(pcap.h,
1165 [
1166 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1167 ], [with_libpcap="no (pcap.h not found)"])
1168fi
1169if test "x$with_libpcap" = "xyes"
1170then
1171 collect_libpcap=1
1172else
1173 collect_libpcap=0
1174fi
92f43553 1175AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
dd7a9bc9 1176 [Wether or not to use the pcap library])
92f43553 1177AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
dd7a9bc9 1178
3acac9b0 1179perl_interpreter="perl"
a432a981
FF
1180AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1181[
1182 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1183 then
1184 LDFLAGS="$LDFLAGS -L$withval/lib"
1185 CPPFLAGS="$CPPFLAGS -I$withval/include"
3acac9b0 1186 perl_interpreter="$withval/bin/perl"
a432a981
FF
1187 with_libperl="yes"
1188 fi
1189],
1190[
1191 with_libperl="yes"
1192])
1193if test "x$with_libperl" = "xyes"
1194then
1195 SAVE_CFLAGS=$CFLAGS
1196 SAVE_LDFLAGS=$LDFLAGS
3acac9b0
FF
1197 PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1198 PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1199 CFLAGS="$CFLAGS $PERL_CFLAGS"
1200 LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
a432a981
FF
1201
1202 AC_CACHE_CHECK([for libperl],
1203 [have_libperl],
1204 AC_LINK_IFELSE(
1205 AC_LANG_PROGRAM(
1206 [[
1207#include <EXTERN.h>
1208#include <perl.h>
1209#include <XSUB.h>
1210 ]],
1211 [[
1212 PerlInterpreter *perl = NULL;
1213 Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
3acac9b0 1214 newSVpv ("Collectd::Plugin::FooBar", 24),
a432a981
FF
1215 Nullsv);
1216 ]]),
1217 [have_libperl="yes"],
1218 [have_libperl="no"]
1219 )
1220 )
1221
1222 if test "x$have_libperl" = "xyes"
1223 then
1224 AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3acac9b0
FF
1225 AC_SUBST(PERL_CFLAGS)
1226 AC_SUBST(PERL_LDFLAGS)
a432a981
FF
1227 else
1228 with_libperl="no"
1229 fi
1230
1231 CFLAGS=$SAVE_CFLAGS
1232 LDFLAGS=$SAVE_LDFLAGS
1233fi
1234AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1235
8de91034
FF
1236AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1237[
1238 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1239 then
1240 LDFLAGS="$LDFLAGS -L$withval/lib"
1241 CPPFLAGS="$CPPFLAGS -I$withval/include"
1242 with_libiptc="yes"
1243 fi
1244],
1245[
1246 if test "x$ac_system" = "xLinux"
1247 then
1248 with_libiptc="yes"
1249 else
1250 with_libiptc="no (Linux only)"
1251 fi
1252])
1253if test "x$with_libiptc" = "xyes"
1254then
1255 AC_CHECK_LIB(iptc, iptc_init,
1256 [
1257 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1258 ], [with_libiptc="no (libiptc not found)"])
1259fi
1260if test "x$with_libiptc" = "xyes"
1261then
1262 AC_CHECK_HEADERS(libiptc/libiptc.h,
1263 [
1264 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1265 ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1266fi
1267if test "x$with_libiptc" = "xyes"
1268then
1269 collect_libiptc=1
1270else
1271 collect_libiptc=0
1272fi
1273AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1274
bc2d9402
FF
1275AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1276[
1277 if test "x$withval" != "xno" && test "x$withval" != "xyes"
1278 then
1279 LDFLAGS="$LDFLAGS -L$withval/lib"
1280 CPPFLAGS="$CPPFLAGS -I$withval/include"
1281 with_libupsclient="yes"
1282 fi
1283],
1284[
1285 with_libupsclient="yes"
1286])
1287if test "x$with_libupsclient" = "xyes"
1288then
1289 AC_CHECK_LIB(upsclient, upscli_connect,
1290 [
1291 AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
1292 ], [with_libupsclient="no (libupsclient not found)"])
1293fi
1294if test "x$with_libupsclient" = "xyes"
1295then
1296 AC_CHECK_HEADERS(upsclient.h,
1297 [
1298 AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the <upsclient.h> header file.])
1299 ], [with_libupsclient="no (upsclient.h not found)"])
1300fi
1301AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1302
86ca149a
FF
1303# Check for enabled/disabled features
1304#
6e765a02 1305
3c12e8a6
NW
1306# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1307# ------------------------------------------------------------
1308dnl
1309m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1310dnl
1311AC_DEFUN(
1312 [AC_COLLECTD],
1313 [
1314 m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1315 m4_if(
1316 [$2],
1317 [enable],
1318 [dnl
1319 m4_define([EnDis],[disabled])dnl
1320 m4_define([YesNo],[no])dnl
1321 ],dnl
1322 [m4_if(
1323 [$2],
1324 [disable],
1325 [dnl
1326 m4_define([EnDis],[enabled])dnl
1327 m4_define([YesNo],[yes])dnl
1328 ],
1329 [dnl
1330 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1331 ]dnl
1332 )]dnl
1333 )dnl
1334 m4_if([$3], [feature], [],
1335 [m4_if(
1336 [$3], [module], [],
1337 [dnl
1338 AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1339 ]dnl
1340 )]dnl
1341 )dnl
1342 AC_ARG_ENABLE(
1343 [$1],
1344 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1345 [],
1346 enable_$1='[YesNo]'dnl
1347 )# AC_ARG_ENABLE
1348if test "x$enable_$1" = "xno"
1349then
1350 collectd_$1=0
6e765a02 1351else
3c12e8a6 1352 if test "x$enable_$1" = "xyes"
6e765a02 1353 then
3c12e8a6 1354 collectd_$1=1
6e765a02 1355 else
3c12e8a6
NW
1356 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1357 collectd_$1=1
1358 enable_$1='yes'
6e765a02
FF
1359 fi
1360fi
3c12e8a6
NW
1361 AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1362 AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1363 ]dnl
1364)# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1365
3c12e8a6
NW
1366m4_divert_once([HELP_ENABLE], [
1367collectd features:])
3c12e8a6
NW
1368AC_COLLECTD([debug], [enable], [feature], [debugging])
1369AC_COLLECTD([daemon], [disable], [feature], [daemon mode])
14740db4 1370AC_COLLECTD([getifaddrs],[enable], [feature], [getifaddrs under Linux])
6e765a02 1371
f9ee71b2
NW
1372m4_divert_once([HELP_ENABLE], [
1373collectd modules:])
a8025575 1374AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
bfec4e6f 1375AC_COLLECTD([apcups], [disable], [module], [Statistics of UPSes by APC])
dc42e3e0 1376AC_COLLECTD([apple_sensors], [disable], [module], [Apple's hardware sensors])
84b0b421 1377AC_COLLECTD([battery], [disable], [module], [battery statistics])
96cf2ccb 1378AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
55b43947
FF
1379AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
1380AC_COLLECTD([disk], [disable], [module], [disk/partition statistics])
f5b4f424 1381AC_COLLECTD([csv], [disable], [module], [csv output plugin])
2d03e4e3 1382AC_COLLECTD([df], [disable], [module], [df statistics])
fdfbf887 1383AC_COLLECTD([dns], [disable], [module], [dns statistics])
fc257d86 1384AC_COLLECTD([email], [disable], [module], [email statistics])
1cc2a825 1385AC_COLLECTD([entropy], [disable], [module], [entropy statistics])
11770688 1386AC_COLLECTD([exec], [disable], [module], [exec of external programs])
55b43947 1387AC_COLLECTD([hddtemp], [disable], [module], [hdd temperature statistics])
3268a333 1388AC_COLLECTD([interface], [disable], [module], [interface statistics])
863dfcdf 1389AC_COLLECTD([iptables], [disable], [module], [IPtables statistics])
f21bcfdc 1390AC_COLLECTD([irq], [disable], [module], [irq statistics])
55b43947 1391AC_COLLECTD([load], [disable], [module], [system load statistics])
c8e76316 1392AC_COLLECTD([mbmon], [disable], [module], [motherboard monitor statistics])
55b43947 1393AC_COLLECTD([memory], [disable], [module], [memory statistics])
9a5e1523 1394AC_COLLECTD([multimeter],[disable], [module], [multimeter statistics])
e4303e15 1395AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
63450476 1396AC_COLLECTD([network], [disable], [module], [network functionality])
55b43947 1397AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
ab71d6d2 1398AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
bc2d9402 1399AC_COLLECTD([nut], [disable], [module], [network UPS tools statistics])
3f0a64bd 1400AC_COLLECTD([perl], [disable], [module], [embedded perl interpreter])
55b43947
FF
1401AC_COLLECTD([ping], [disable], [module], [ping statistics])
1402AC_COLLECTD([processes], [disable], [module], [processes statistics])
1403AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
1404AC_COLLECTD([serial], [disable], [module], [serial statistics])
1edbe3e5 1405AC_COLLECTD([logfile], [disable], [module], [logfile log facility])
55b43947 1406AC_COLLECTD([swap], [disable], [module], [swap statistics])
5bc935fb 1407AC_COLLECTD([syslog], [disable], [module], [syslog log facility])
55b43947 1408AC_COLLECTD([tape], [disable], [module], [tape statistics])
86090b3d 1409AC_COLLECTD([unixsock], [disable], [module], [UNIX socket plugin])
55b43947 1410AC_COLLECTD([users], [disable], [module], [user count statistics])
5e70f2e0 1411AC_COLLECTD([vserver], [disable], [module], [vserver statistics])
08037975 1412AC_COLLECTD([wireless], [disable], [module], [wireless link statistics])
55b43947 1413
108c20b2 1414AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile)
86ca149a 1415
7d32c2bc 1416if test "x$with_libperl" = "xyes"
a432a981 1417then
7d32c2bc
FF
1418 with_libperl="yes (version `perl -MConfig -e 'print $Config{version};'`)"
1419else
a432a981
FF
1420 enable_perl="no (needs libperl)"
1421fi
1422
86ca149a
FF
1423cat <<EOF;
1424
1425Configuration:
1426 Libraries:
a8025575 1427 libcurl . . . . . . $with_libcurl
adaf6ca0 1428 libiokit . . . . . $with_libiokit
86ccc162 1429 libiptc . . . . . . $with_libiptc
86ca149a 1430 libkstat . . . . . $with_kstat
e4303e15 1431 libmysql . . . . . $with_libmysql
c64b3f3b 1432 liboconfig . . . . $with_liboconfig
86ccc162 1433 liboping . . . . . $with_liboping
dd7a9bc9 1434 libpcap . . . . . . $with_libpcap
a432a981 1435 libperl . . . . . . $with_libperl
c4377c1e 1436 libpthread . . . . $with_libpthread
86ccc162
FF
1437 librrd . . . . . . $with_rrdtool
1438 libsensors . . . . $with_lm_sensors
1439 libstatgrab . . . . $with_libstatgrab
1440 libupsclient . . . $with_libupsclient
86ca149a
FF
1441
1442 Features:
6e765a02 1443 daemon mode . . . . $enable_daemon
86ccc162 1444 debug . . . . . . . $enable_debug
6e765a02
FF
1445
1446 Modules:
11265296 1447 apache . . . . . . $enable_apache
bfec4e6f 1448 apcups . . . . . . $enable_apcups
11265296 1449 apple_sensors . . . $enable_apple_sensors
84b0b421 1450 battery . . . . . . $enable_battery
86ca149a
FF
1451 cpu . . . . . . . . $enable_cpu
1452 cpufreq . . . . . . $enable_cpufreq
f5b4f424 1453 csv . . . . . . . . $enable_csv
2d03e4e3 1454 df . . . . . . . . $enable_df
86ca149a 1455 disk . . . . . . . $enable_disk
fdfbf887 1456 dns . . . . . . . . $enable_dns
fc257d86 1457 email . . . . . . . $enable_email
1cc2a825 1458 entropy . . . . . . $enable_entropy
11770688 1459 exec . . . . . . . $enable_exec
86ca149a 1460 hddtemp . . . . . . $enable_hddtemp
3268a333 1461 interface . . . . . $enable_interface
35248bcc 1462 iptables . . . . . $enable_iptables
3268a333 1463 irq . . . . . . . . $enable_irq
86ca149a 1464 load . . . . . . . $enable_load
05b7b7e3 1465 logfile . . . . . . $enable_logfile
c8e76316 1466 mbmon . . . . . . . $enable_mbmon
86ca149a 1467 memory . . . . . . $enable_memory
9a5e1523 1468 multimeter . . . . $enable_multimeter
1f2a5bff 1469 mysql . . . . . . . $enable_mysql
63450476 1470 network . . . . . . $enable_network
86ca149a 1471 nfs . . . . . . . . $enable_nfs
2fa44680 1472 ntpd . . . . . . . $enable_ntpd
bc2d9402 1473 nut . . . . . . . . $enable_nut
3f0a64bd 1474 perl . . . . . . . $enable_perl
86ca149a
FF
1475 ping . . . . . . . $enable_ping
1476 processes . . . . . $enable_processes
1477 sensors . . . . . . $enable_sensors
1478 serial . . . . . . $enable_serial
1479 swap . . . . . . . $enable_swap
5bc935fb 1480 syslog . . . . . . $enable_syslog
86ca149a 1481 tape . . . . . . . $enable_tape
86090b3d 1482 unixsock . . . . . $enable_unixsock
0127d402 1483 users . . . . . . . $enable_users
5e70f2e0 1484 vserver . . . . . . $enable_vserver
08037975 1485 wireless . . . . . $enable_wireless
86ca149a
FF
1486
1487EOF