configure.in: Fixed spaces followed by tabs and trailing whitespaces.
[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         with_liboping="yes"
1130 ])
1131
1132 if test "x$with_liboping" = "xyes"
1133 then
1134         save_LDFLAGS="$LDFLAGS"
1135         save_CPPFLAGS="$CPPFLAGS"
1136         LDFLAGS="$liboping_LDFLAGS"
1137         CPPFLAGS="$liboping_CPPFLAGS"
1138         AC_CHECK_LIB(oping, ping_construct,
1139         [
1140                 with_liboping="yes"
1141                 with_own_liboping="no"
1142         ],
1143         [
1144                 with_liboping="yes"
1145                 with_own_liboping="yes"
1146                 LDFLAGS="$save_LDFLAGS"
1147                 CPPFLAGS="$save_CPPFLAGS"
1148         ])
1149 fi
1150 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1151 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1152
1153 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1154 [
1155         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1156         then
1157                 LDFLAGS="$LDFLAGS -L$withval/lib"
1158                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1159                 with_libpcap="yes"
1160         fi
1161 ],
1162 [
1163         with_libpcap="yes"
1164 ])
1165 if test "x$with_libpcap" = "xyes"
1166 then
1167         AC_CHECK_LIB(pcap, pcap_open_live,
1168         [
1169                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1170         ], [with_libpcap="no (libpcap not found)"])
1171 fi
1172 if test "x$with_libpcap" = "xyes"
1173 then
1174         AC_CHECK_HEADERS(pcap.h,
1175         [
1176                 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1177         ], [with_libpcap="no (pcap.h not found)"])
1178 fi
1179 if test "x$with_libpcap" = "xyes"
1180 then
1181         collect_libpcap=1
1182 else
1183         collect_libpcap=0
1184 fi
1185 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1186         [Wether or not to use the pcap library])
1187 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1188
1189 perl_interpreter="perl"
1190 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1191 [
1192         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1193         then
1194                 LDFLAGS="$LDFLAGS -L$withval/lib"
1195                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1196                 perl_interpreter="$withval/bin/perl"
1197                 with_libperl="yes"
1198         fi
1199 ],
1200 [
1201         with_libperl="yes"
1202 ])
1203
1204 AC_SUBST(PERL, "$perl_interpreter")
1205
1206 if test "x$with_libperl" = "xyes"
1207 then
1208   SAVE_CFLAGS=$CFLAGS
1209   SAVE_LDFLAGS=$LDFLAGS
1210   PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1211   PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1212   CFLAGS="$CFLAGS $PERL_CFLAGS"
1213   LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1214
1215   AC_CACHE_CHECK([for libperl],
1216     [have_libperl],
1217     AC_LINK_IFELSE(
1218       AC_LANG_PROGRAM(
1219       [[
1220 #include <EXTERN.h>
1221 #include <perl.h>
1222 #include <XSUB.h>
1223       ]],
1224       [[
1225        PerlInterpreter *perl = NULL;
1226        Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1227                          newSVpv ("Collectd::Plugin::FooBar", 24),
1228                          Nullsv);
1229       ]]),
1230       [have_libperl="yes"],
1231       [have_libperl="no"]
1232     )
1233   )
1234
1235   if test "x$have_libperl" = "xyes"
1236   then
1237           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1238           AC_SUBST(PERL_CFLAGS)
1239           AC_SUBST(PERL_LDFLAGS)
1240   else
1241           with_libperl="no"
1242   fi
1243
1244   CFLAGS=$SAVE_CFLAGS
1245   LDFLAGS=$SAVE_LDFLAGS
1246 fi
1247 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1248
1249 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1250 [
1251         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1252         then
1253                 LDFLAGS="$LDFLAGS -L$withval/lib"
1254                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1255                 with_libiptc="yes"
1256         fi
1257 ],
1258 [
1259         if test "x$ac_system" = "xLinux"
1260         then
1261                 with_libiptc="yes"
1262         else
1263                 with_libiptc="no (Linux only)"
1264         fi
1265 ])
1266 if test "x$with_libiptc" = "xyes"
1267 then
1268         AC_CHECK_LIB(iptc, iptc_init,
1269         [
1270                 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1271         ], [with_libiptc="no (libiptc not found)"])
1272 fi
1273 if test "x$with_libiptc" = "xyes"
1274 then
1275         AC_CHECK_HEADERS(libiptc/libiptc.h,
1276         [
1277                 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1278         ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1279 fi
1280 if test "x$with_libiptc" = "xyes"
1281 then
1282         collect_libiptc=1
1283 else
1284         collect_libiptc=0
1285 fi
1286 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1287
1288 with_snmp_config="net-snmp-config"
1289 with_snmp_cflags=""
1290 with_snmp_libs=""
1291 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1292 [
1293         if test "x$withval" = "xno"
1294         then
1295                 with_libnetsnmp="no"
1296         else if test "x$withval" = "xyes"
1297         then
1298                 with_libnetsnmp="yes"
1299         else
1300                 if test -x "$withval"
1301                 then
1302                         with_snmp_config="$withval"
1303                         with_libnetsnmp="yes"
1304                 else
1305                         with_snmp_config="$withval/bin/net-snmp-config"
1306                         with_libnetsnmp="yes"
1307                 fi
1308         fi; fi
1309 ],
1310 [with_libnetsnmp="yes"])
1311 if test "x$with_libnetsnmp" = "xyes"
1312 then
1313         with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1314         snmp_config_status=$?
1315
1316         if test $snmp_config_status -ne 0
1317         then
1318                 with_libnetsnmp="no ($with_snmp_config failed)"
1319         else
1320                 SAVE_CFLAGS=$CFLAGS
1321                 CFLAGS="$CFLAGS $with_snmp_cflags"
1322                 
1323                 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1324
1325                 CFLAGS="$SAVE_CFLAGS"
1326         fi
1327 fi
1328 if test "x$with_libnetsnmp" = "xyes"
1329 then
1330         with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1331         snmp_config_status=$?
1332
1333         if test $snmp_config_status -ne 0
1334         then
1335                 with_libnetsnmp="no ($with_snmp_config failed)"
1336         else
1337                 AC_CHECK_LIB(netsnmp, init_snmp,
1338                 [with_libnetsnmp="yes"],
1339                 [with_libnetsnmp="no (libnetsnmp not found)"],
1340                 [$with_snmp_libs])
1341         fi
1342 fi
1343 if test "x$with_libnetsnmp" = "xyes"
1344 then
1345         BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1346         BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1347         AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1348         AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1349 fi
1350 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1351
1352 with_upsclient_config="libupsclient-config"
1353 with_upsclient_cflags=""
1354 with_upsclient_libs=""
1355 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1356 [
1357         if test "x$withval" = "xno"
1358         then
1359                 with_libupsclient="no"
1360         else
1361                 if test "x$withval" != "xyes"
1362                 then
1363                         if test -f "$withval" && test -x "$withval";
1364                         then
1365                                 with_upsclient_config="$withval"
1366                         else
1367                                 with_upsclient_config="$withval/bin/libupsclient-config"
1368                         fi
1369                 fi
1370                 with_libupsclient="yes"
1371         fi
1372 ],
1373 [
1374         with_libupsclient="yes"
1375 ])
1376 if test "x$with_libupsclient" = "xyes"
1377 then
1378         with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1379         upsclient_config_status=$?
1380
1381         if test $upsclient_config_status -ne 0
1382         then
1383                 with_libupsclient="no ($with_upsclient_config failed)"
1384         fi
1385 fi
1386 if test "x$with_libupsclient" = "xyes"
1387 then
1388         SAVE_CFLAGS="$CFLAGS"
1389         CFLAGS="$CFLAGS $with_upsclient_cflags"
1390
1391         AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1392
1393         CFLAGS="$SAVE_CFLAGS"
1394 fi
1395 if test "x$with_libupsclient" = "xyes"
1396 then
1397         with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1398         upsclient_config_status=$?
1399
1400         if test $upsclient_config_status -ne 0
1401         then
1402                 with_libupsclient="no ($with_upsclient_config failed)"
1403         fi
1404 fi
1405 if test "x$with_libupsclient" = "xyes"
1406 then
1407         AC_CHECK_LIB(upsclient, upscli_connect,
1408         [
1409                 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1410                 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1411                 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1412                 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1413         ],
1414         [
1415                 with_libupsclient="no (symbol 'upscli_connect' not found)"
1416         ], [$with_upsclient_libs])
1417 fi
1418 if test "x$with_libupsclient" = "xyes"
1419 then
1420         AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
1421 [#include <stdlib.h>
1422 #include <stdio.h>
1423 #include <upsclient.h>])
1424 fi
1425 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1426
1427 ### BEGIN of check for libxmms ###
1428 with_xmms_config="xmms-config"
1429 with_xmms_cflags=""
1430 with_xmms_libs=""
1431 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1432 [
1433         if test "x$withval" != "xno" -a "x$withval" != "xyes"
1434         then
1435                 if test -f "$withval" && test -x "$withval";
1436                 then
1437                         with_xmms_config="$withval"
1438                 else if test -x "$withval/bin/xmms-config"
1439                 then
1440                         with_xmms_config="$withval/bin/xmms-config"
1441                 fi; fi
1442                 with_libxmms="yes"
1443         else if test "x$withval" = "xno"
1444         then
1445                 with_libxmms="no"
1446         else
1447                 with_libxmms="yes"
1448         fi; fi
1449 ],
1450 [
1451         with_libxmms="yes"
1452 ])
1453 if test "x$with_libxmms" = "xyes"
1454 then
1455         with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1456         xmms_config_status=$?
1457
1458         if test $xmms_config_status -ne 0
1459         then
1460                 with_libxmms="no"
1461         fi
1462 fi
1463 if test "x$with_libxmms" = "xyes"
1464 then
1465         with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1466         xmms_config_status=$?
1467
1468         if test $xmms_config_status -ne 0
1469         then
1470                 with_libxmms="no"
1471         fi
1472 fi
1473 if test "x$with_libxmms" = "xyes"
1474 then
1475         AC_CHECK_LIB(xmms, xmms_remote_get_info,
1476         [
1477                 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1478                 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1479                 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1480                 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1481         ],
1482         [
1483                 with_libxmms="no"
1484         ],
1485         [$with_xmms_libs])
1486 fi
1487 with_libxmms_numeric=0
1488 if test "x$with_libxmms" = "xyes"
1489 then
1490         with_libxmms_numeric=1
1491 fi
1492 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1493 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1494 ### END of check for libxmms ###
1495
1496 with_libnetlink_cflags=""
1497 with_libnetlink_libs="-lnetlink"
1498 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1499 [
1500  echo "libnetlink: withval = $withval"
1501  if test "x$withval" = "xyes"
1502  then
1503          with_libnetlink="yes"
1504  else if test "x$withval" = "xno"
1505  then
1506          with_libnetlink="no"
1507  else
1508          if test -d "$withval/include"
1509          then
1510                  with_libnetlink_cflags="-I$withval/include"
1511                  with_libnetlink_libs="-L$withval/lib -lnetlink"
1512                  with_libnetlink="yes"
1513          else
1514                  AC_MSG_ERROR("no such directory: $withval/include")
1515          fi
1516  fi; fi
1517 ],
1518 [
1519  if test "x$ac_system" = "xLinux"
1520  then
1521          with_libnetlink="yes"
1522  else
1523          with_libnetlink="no (Linux only library)"
1524  fi
1525 ])
1526 if test "x$with_libnetlink" = "xyes"
1527 then
1528         SAVE_CFLAGS=$CFLAGS
1529         CFLAGS="$CFLAGS $with_libnetlink_cflags"
1530
1531         with_libnetlink="no (libnetlink.h not found)"
1532
1533         AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1534         [
1535          with_libnetlink="yes"
1536          break
1537         ], [],
1538 [#include <stdio.h>
1539 #include <sys/types.h>
1540 #include <asm/types.h>
1541 #include <sys/socket.h>
1542 #include <linux/netlink.h>
1543 #include <linux/rtnetlink.h>])
1544         AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1545 [#include <stdio.h>
1546 #include <sys/types.h>
1547 #include <asm/types.h>
1548 #include <sys/socket.h>])
1549
1550         AC_COMPILE_IFELSE(
1551 [#include <stdio.h>
1552 #include <sys/types.h>
1553 #include <asm/types.h>
1554 #include <sys/socket.h>
1555 #include <linux/netlink.h>
1556 #include <linux/rtnetlink.h>
1557
1558 int main (void)
1559 {
1560         int retval = TCA_STATS2;
1561         return (retval);
1562 }],
1563         [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1564         []);
1565
1566         AC_COMPILE_IFELSE(
1567 [#include <stdio.h>
1568 #include <sys/types.h>
1569 #include <asm/types.h>
1570 #include <sys/socket.h>
1571 #include <linux/netlink.h>
1572 #include <linux/rtnetlink.h>
1573
1574 int main (void)
1575 {
1576         int retval = TCA_STATS;
1577         return (retval);
1578 }],
1579         [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1580         []);
1581
1582         CFLAGS="$SAVE_CFLAGS"
1583 fi
1584 if test "x$with_libnetlink" = "xyes"
1585 then
1586         AC_CHECK_LIB(netlink, rtnl_open,
1587                      [with_libnetlink="yes"],
1588                      [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1589                      [$with_libnetlink_libs])
1590 fi
1591 if test "x$with_libnetlink" = "xyes"
1592 then
1593         BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1594         BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1595         AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1596         AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1597 fi
1598 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1599
1600 dnl Check for libvirt and libxml2 libraries.
1601 AC_CHECK_LIB(xml2,xmlXPathEval,
1602              [with_libxml2="yes"],
1603              [with_libxml2="no"])
1604
1605 with_libvirt="no"
1606 if test "x$with_libxml2" = "xyes"; then
1607     AC_CHECK_LIB(virt,virDomainBlockStats,
1608                  [with_libvirt="yes"],
1609                  [with_libvirt="no (symbol virDomainBlockStats not found)"])
1610 fi
1611 dnl Add the right compiler flags and libraries.
1612 if test "x$with_libvirt" = "xyes"; then
1613     PKG_PROG_PKG_CONFIG
1614     if test "x$PKG_CONFIG" != "x"; then
1615         BUILD_WITH_LIBVIRTSTATS_CFLAGS="`pkg-config --cflags libvirt` `pkg-config --cflags libxml-2.0`"
1616         BUILD_WITH_LIBVIRTSTATS_LIBS="`pkg-config --libs libvirt` `pkg-config --libs libxml-2.0`"
1617         AC_SUBST(BUILD_WITH_LIBVIRTSTATS_CFLAGS)
1618         AC_SUBST(BUILD_WITH_LIBVIRTSTATS_LIBS)
1619     fi
1620 fi
1621
1622 dnl End of check for libvirt and libxml2 libraries.
1623
1624 # Check for enabled/disabled features
1625 #
1626
1627 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1628 # ------------------------------------------------------------
1629 dnl
1630 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1631 dnl
1632 AC_DEFUN(
1633         [AC_COLLECTD],
1634         [
1635         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1636         m4_if(
1637                 [$2],
1638                 [enable],
1639                 [dnl
1640                 m4_define([EnDis],[disabled])dnl
1641                 m4_define([YesNo],[no])dnl
1642                 ],dnl
1643                 [m4_if(
1644                         [$2],
1645                         [disable],
1646                         [dnl
1647                         m4_define([EnDis],[enabled])dnl
1648                         m4_define([YesNo],[yes])dnl
1649                         ],
1650                         [dnl
1651                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1652                         ]dnl
1653                 )]dnl
1654         )dnl
1655         m4_if([$3], [feature], [],
1656                 [m4_if(
1657                         [$3], [module], [],
1658                         [dnl
1659                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1660                         ]dnl
1661                 )]dnl
1662         )dnl
1663         AC_ARG_ENABLE(
1664                 [$1],
1665                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1666                 [],
1667                 enable_$1='[YesNo]'dnl
1668         )# AC_ARG_ENABLE
1669 if test "x$enable_$1" = "xno"
1670 then
1671         collectd_$1=0
1672 else
1673         if test "x$enable_$1" = "xyes"
1674         then
1675                 collectd_$1=1
1676         else
1677                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1678                 collectd_$1=1
1679                 enable_$1='yes'
1680         fi
1681 fi
1682         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1683         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1684         ]dnl
1685 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1686
1687 # AC_PLUGIN(name, default, info)
1688 # ------------------------------------------------------------
1689 dnl
1690 AC_DEFUN(
1691   [AC_PLUGIN],
1692   [
1693     enable_plugin="no"
1694     AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1695     [
1696      if test "x$enableval" = "xyes"
1697      then
1698              enable_plugin="yes"
1699      else
1700              enable_plugin="no"
1701      fi
1702     ],
1703     [
1704      if test "x$2" = "xyes"
1705      then
1706              enable_plugin="yes"
1707      else
1708              enable_plugin="no"
1709      fi
1710     ])
1711     if test "x$enable_plugin" = "xyes"
1712     then
1713             AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1714     fi
1715     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1716     enable_$1="$enable_plugin"
1717   ]
1718 )# AC_PLUGIN(name, default, info)
1719
1720 m4_divert_once([HELP_ENABLE], [
1721 collectd features:])
1722 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1723 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
1724 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
1725 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
1726
1727 plugin_battery="no"
1728 plugin_cpu="no"
1729 plugin_cpufreq="no"
1730 plugin_df="no"
1731 plugin_disk="no"
1732 plugin_entropy="no"
1733 plugin_interface="no"
1734 plugin_ipvs="no"
1735 plugin_irq="no"
1736 plugin_load="no"
1737 plugin_memory="no"
1738 plugin_multimeter="no"
1739 plugin_nfs="no"
1740 plugin_processes="no"
1741 plugin_serial="no"
1742 plugin_swap="no"
1743 plugin_tape="no"
1744 plugin_tcpconns="no"
1745 plugin_users="no"
1746 plugin_vserver="no"
1747 plugin_wireless="no"
1748
1749 # Linux
1750 if test "x$ac_system" = "xLinux"
1751 then
1752         plugin_battery="yes"
1753         plugin_cpu="yes"
1754         plugin_cpufreq="yes"
1755         plugin_disk="yes"
1756         plugin_entropy="yes"
1757         plugin_interface="yes"
1758         plugin_irq="yes"
1759         plugin_load="yes"
1760         plugin_memory="yes"
1761         plugin_nfs="yes"
1762         plugin_processes="yes"
1763         plugin_serial="yes"
1764         plugin_swap="yes"
1765         plugin_tcpconns="yes"
1766         plugin_vserver="yes"
1767         plugin_wireless="yes"
1768
1769         if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1770         then
1771                 plugin_ipvs="yes"
1772         fi
1773 fi
1774
1775 # Mac OS X devices
1776 if test "x$with_libiokit" = "xyes"
1777 then
1778         plugin_battery="yes"
1779         plugin_disk="yes"
1780 fi
1781
1782 # Solaris
1783 if test "x$with_devinfo$with_kstat" = "xyesyes"
1784 then
1785         plugin_cpu="yes"
1786         plugin_disk="yes"
1787         plugin_interface="yes"
1788         plugin_memory="yes"
1789         plugin_swap="yes"
1790         plugin_tape="yes"
1791 fi
1792
1793 # libstatgrab
1794 if test "x$with_libstatgrab" = "xyes"
1795 then
1796         plugin_interface="yes"
1797         plugin_load="yes"
1798         plugin_memory="yes"
1799         plugin_swap="yes"
1800 fi
1801
1802 if test "x$have_processor_info" = "xyes"
1803 then
1804         plugin_cpu="yes"
1805 fi
1806 if test "x$have_sysctlbyname" = "xyes"
1807 then
1808         plugin_cpu="yes"
1809         plugin_memory="yes"
1810         plugin_tcpconns="yes"
1811 fi
1812
1813 if test "x$have_statfs" = "xyes"
1814 then
1815         plugin_df="yes"
1816 fi
1817 if test "x$have_statvfs" = "xyes"
1818 then
1819         plugin_df="yes"
1820 fi
1821
1822 if test "x$have_getifaddrs" = "xyes"
1823 then
1824         plugin_interface="yes"
1825 fi
1826
1827 if test "x$have_getloadavg" = "xyes"
1828 then
1829         plugin_load="yes"
1830 fi
1831
1832 # Mac OS X memory interface
1833 if test "x$have_host_statistics" = "xyes"
1834 then
1835         plugin_memory="yes"
1836 fi
1837
1838 if test "x$have_termios_h" = "xyes"
1839 then
1840         plugin_multimeter="yes"
1841 fi
1842
1843 if test "x$have_thread_info" = "xyes"
1844 then
1845         plugin_processes="yes"
1846 fi
1847
1848 if test "x$with_libkvm" = "xyes"
1849 then
1850         plugin_swap="yes"
1851 fi
1852
1853 if test "x$have_getutent" = "xyes"
1854 then
1855         plugin_users="yes"
1856 fi
1857 if test "x$have_getutxent" = "xyes"
1858 then
1859         plugin_users="yes"
1860 fi
1861
1862 # FIXME: sysctl for swap plugin
1863
1864 m4_divert_once([HELP_ENABLE], [
1865 collectd plugins:])
1866
1867 AC_PLUGIN([apache],      [$with_libcurl],      [Apache httpd statistics])
1868 AC_PLUGIN([apcups],      [yes],                [Statistics of UPSes by APC])
1869 AC_PLUGIN([apple_sensors], [$with_libiokit],   [Apple's hardware sensors])
1870 AC_PLUGIN([battery],     [$plugin_battery],    [Battery statistics])
1871 AC_PLUGIN([cpu],         [$plugin_cpu],        [CPU usage statistics])
1872 AC_PLUGIN([cpufreq],     [$plugin_cpufreq],    [CPU frequency statistics])
1873 AC_PLUGIN([csv],         [yes],                [CSV output plugin])
1874 AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
1875 AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
1876 AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
1877 AC_PLUGIN([email],       [yes],                [EMail statistics])
1878 AC_PLUGIN([entropy],     [$plugin_entropy],    [Entropy statistics])
1879 AC_PLUGIN([exec],        [yes],                [Execution of external programs])
1880 AC_PLUGIN([hddtemp],     [yes],                [Query hddtempd])
1881 AC_PLUGIN([interface],   [$plugin_interface],  [Interface traffic statistics])
1882 AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
1883 AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
1884 AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
1885 AC_PLUGIN([libvirtstats],[$with_libvirt],      [Virtual machine statistics])
1886 AC_PLUGIN([load],        [$plugin_load],       [System load])
1887 AC_PLUGIN([logfile],     [yes],                [File logging plugin])
1888 AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
1889 AC_PLUGIN([memcached],   [yes],                [memcached statistics])
1890 AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
1891 AC_PLUGIN([multimeter],  [$plugin_multimeter], [Read multimeter values])
1892 AC_PLUGIN([mysql],       [$with_libmysql],     [MySQL statistics])
1893 AC_PLUGIN([netlink],     [$with_libnetlink],   [Enhanced Linux network statistics])
1894 AC_PLUGIN([network],     [yes],                [Network communication plugin])
1895 AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
1896 AC_PLUGIN([nginx],       [$with_libcurl],      [nginx statistics])
1897 AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
1898 AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
1899 AC_PLUGIN([perl],        [$with_libperl],      [Embed a Perl interpreter])
1900 AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
1901 AC_PLUGIN([processes],   [$plugin_processes],  [Process statistics])
1902 AC_PLUGIN([rrdtool],     [$with_rrdtool],      [RRDTool output plugin])
1903 AC_PLUGIN([sensors],     [$with_lm_sensors],   [lm_sensors statistics])
1904 AC_PLUGIN([serial],      [$plugin_serial],     [serial port traffic])
1905 AC_PLUGIN([snmp],        [$with_libnetsnmp],   [SNMP querying plugin])
1906 AC_PLUGIN([swap],        [$plugin_swap],       [Swap usage statistics])
1907 AC_PLUGIN([syslog],      [$have_syslog],       [Syslog logging plugin])
1908 AC_PLUGIN([tape],        [$plugin_tape],       [Tape drive statistics])
1909 AC_PLUGIN([tcpconns],    [$plugin_tcpconns],   [TCP connection statistics])
1910 AC_PLUGIN([unixsock],    [yes],                [Unixsock communication plugin])
1911 AC_PLUGIN([users],       [$plugin_users],      [User statistics])
1912 AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
1913 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
1914 AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
1915
1916 dnl ip_vs.h
1917 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
1918 then
1919         enable_ipvs="$enable_ipvs (ip_vs.h not found)"
1920 fi
1921
1922 dnl Perl bindings
1923 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
1924 [
1925         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1926         then
1927                 PERL_BINDINGS_OPTIONS="$withval"
1928                 with_perl_bindings="yes"
1929         fi
1930 ],
1931 [
1932         PERL_BINDINGS_OPTIONS=""
1933         with_perl_bindings="yes"
1934 ])
1935 if test "x$with_perl_bindings" = "xyes"
1936 then
1937         PERL_BINDINGS="perl"
1938 else
1939         PERL_BINDINGS=""
1940 fi
1941 AC_SUBST(PERL_BINDINGS)
1942 AC_SUBST(PERL_BINDINGS_OPTIONS)
1943
1944 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
1945
1946 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1947 then
1948         with_liboping="yes (shipped version)"
1949 fi
1950
1951 if test "x$with_libperl" = "xyes"
1952 then
1953         with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
1954 else
1955         enable_perl="no (needs libperl)"
1956 fi
1957
1958 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
1959 then
1960         with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
1961 fi
1962
1963 cat <<EOF;
1964
1965 Configuration:
1966   Libraries:
1967     libcurl . . . . . . $with_libcurl
1968     libiokit  . . . . . $with_libiokit
1969     libiptc . . . . . . $with_libiptc
1970     libkstat  . . . . . $with_kstat
1971     libkvm  . . . . . . $with_libkvm
1972     libmysql  . . . . . $with_libmysql
1973     libnetlink  . . . . $with_libnetlink
1974     libnetsnmp  . . . . $with_libnetsnmp
1975     liboconfig  . . . . $with_liboconfig
1976     liboping  . . . . . $with_liboping
1977     libpcap . . . . . . $with_libpcap
1978     libperl . . . . . . $with_libperl
1979     libpthread  . . . . $with_libpthread
1980     librrd  . . . . . . $with_rrdtool
1981     libsensors  . . . . $with_lm_sensors
1982     libstatgrab . . . . $with_libstatgrab
1983     libupsclient  . . . $with_libupsclient
1984     libvirt . . . . . . $with_libvirt
1985     libxml2 . . . . . . $with_libxml2
1986     libxmms . . . . . . $with_libxmms
1987
1988   Features:
1989     daemon mode . . . . $enable_daemon
1990     debug . . . . . . . $enable_debug
1991
1992   Bindings:
1993     perl  . . . . . . . $with_perl_bindings
1994
1995   Modules:
1996     apache  . . . . . . $enable_apache
1997     apcups  . . . . . . $enable_apcups
1998     apple_sensors . . . $enable_apple_sensors
1999     battery . . . . . . $enable_battery
2000     cpu . . . . . . . . $enable_cpu
2001     cpufreq . . . . . . $enable_cpufreq
2002     csv . . . . . . . . $enable_csv
2003     df  . . . . . . . . $enable_df
2004     disk  . . . . . . . $enable_disk
2005     dns . . . . . . . . $enable_dns
2006     email . . . . . . . $enable_email
2007     entropy . . . . . . $enable_entropy
2008     exec  . . . . . . . $enable_exec
2009     hddtemp . . . . . . $enable_hddtemp
2010     interface . . . . . $enable_interface
2011     iptables  . . . . . $enable_iptables
2012     ipvs  . . . . . . . $enable_ipvs
2013     irq . . . . . . . . $enable_irq
2014     libvirtstats  . . . $enable_libvirtstats
2015     load  . . . . . . . $enable_load
2016     logfile . . . . . . $enable_logfile
2017     mbmon . . . . . . . $enable_mbmon
2018     memcached . . . . . $enable_memcached
2019     memory  . . . . . . $enable_memory
2020     multimeter  . . . . $enable_multimeter
2021     mysql . . . . . . . $enable_mysql
2022     netlink . . . . . . $enable_netlink
2023     network . . . . . . $enable_network
2024     nfs . . . . . . . . $enable_nfs
2025     nginx . . . . . . . $enable_nginx
2026     ntpd  . . . . . . . $enable_ntpd
2027     nut . . . . . . . . $enable_nut
2028     perl  . . . . . . . $enable_perl
2029     ping  . . . . . . . $enable_ping
2030     processes . . . . . $enable_processes
2031     rrdtool . . . . . . $enable_rrdtool
2032     sensors . . . . . . $enable_sensors
2033     serial  . . . . . . $enable_serial
2034     snmp  . . . . . . . $enable_snmp
2035     swap  . . . . . . . $enable_swap
2036     syslog  . . . . . . $enable_syslog
2037     tape  . . . . . . . $enable_tape
2038     tcpconns  . . . . . $enable_tcpconns
2039     unixsock  . . . . . $enable_unixsock
2040     users . . . . . . . $enable_users
2041     vserver . . . . . . $enable_vserver
2042     wireless  . . . . . $enable_wireless
2043     xmms  . . . . . . . $enable_xmms
2044
2045 EOF