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