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