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