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