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