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