Code

Merge branch 'collectd-4.1'
[collectd.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
3 AC_CONFIG_SRCDIR(src/collectd.c)
4 AC_CONFIG_HEADERS(src/config.h)
5 AM_INIT_AUTOMAKE(dist-bzip2)
6 AC_LANG(C)
8 AC_PREFIX_DEFAULT("/opt/collectd")
10 AC_SYS_LARGEFILE
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")
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)
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])
51 #
52 # Checks for header files.
53 #
54 AC_HEADER_STDC
55 AC_HEADER_SYS_WAIT
56 AC_HEADER_DIRENT
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)
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 ])
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, [], [],
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 ])
211 # For hddtemp module
212 AC_CHECK_HEADERS(linux/major.h libgen.h)
214 # For the battery plugin
215 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
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 ])
225 # For the swap module
226 AC_CHECK_HEADERS(sys/swap.h, [], [],
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 ])
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)
241 # For interface plugin
242 AC_CHECK_HEADERS(ifaddrs.h)
243 AC_CHECK_HEADERS(net/if.h, [], [],
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, [], [],
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, [], [],
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 ])
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
283 # For quota module
284 AC_CHECK_HEADERS(sys/ucred.h, [], [],
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 ])
294 # For mount interface
295 AC_CHECK_HEADERS(sys/mount.h, [], [],
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 ])
305 # For the email plugin
306 AC_CHECK_HEADERS(linux/un.h, [], [],
308 #if HAVE_SYS_SOCKET_H
309 #       include <sys/socket.h>
310 #endif
311 ])
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)
315 # For the dns plugin
316 AC_CHECK_HEADERS(arpa/nameser.h)
317 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
319 #if HAVE_ARPA_NAMESER_H
320 # include <arpa/nameser.h>
321 #endif
322 ])
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 ])
353 # For the multimeter plugin
354 have_termios_h="no"
355 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
358 # Checking for libraries
360 AC_CHECK_LIB(m, ext)
363 # Checks for typedefs, structures, and compiler characteristics.
365 AC_C_CONST
366 AC_TYPE_PID_T
367 AC_TYPE_SIZE_T
368 AC_TYPE_UID_T
369 AC_HEADER_TIME
372 # Checks for library functions.
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)
377 AC_FUNC_STRERROR_R
379 AC_CHECK_FUNCS(getpwnam_r)
380 AC_CHECK_FUNCS(getgrnam_r)
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")
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")
390 AC_CHECK_FUNCS(regcomp regerror regexec regfree)
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"])
403 # For load module
404 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
406 # Check for NAN
407 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
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
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
515 # For mount interface
516 #AC_CHECK_FUNCS(getfsent getvfsent)
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"])
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
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
575 # Check for different versions of `getmntent' here..
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
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         ])
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 ])
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         ])
669 with_libresolv="yes"
670 AC_CHECK_LIB(resolv, res_search,
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")
678 m4_divert_once([HELP_WITH], [
679 collectd additional packages:])
681 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
682 librrd_cflags=""
683 librrd_ldflags=""
684 librrd_threadsafe="yes"
685 AC_ARG_WITH(rrdtool, [AS_HELP_STRING([--with-rrdtool@<:@=PREFIX@:>@], [Path to rrdtool.])],
686 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
687         then
688                 librrd_cflags="-I$withval/include"
689                 librrd_ldflags="-L$withval/lib"
690                 with_rrdtool="yes"
691         fi
692 ], [with_rrdtool="yes"])
693 if test "x$with_rrdtool" = "xyes"
694 then
695         SAVE_CPPFLAGS="$CPPFLAGS"
696         SAVE_LDFLAGS="$LDFLAGS"
698         CPPFLAGS="$CPPFLAGS $librrd_cflags"
699         LDFLAGS="$LDFLAGS $librrd_ldflags"
701         AC_CHECK_HEADERS(rrd.h,, [with_rrdtool="no (rrd.h not found)"])
703         CPPFLAGS="$SAVE_CPPFLAGS"
704         LDFLAGS="$SAVE_LDFLAGS"
705 fi
706 if test "x$with_rrdtool" = "xyes"
707 then
708         SAVE_CPPFLAGS="$CPPFLAGS"
709         SAVE_LDFLAGS="$LDFLAGS"
711         CPPFLAGS="$CPPFLAGS $librrd_cflags"
712         LDFLAGS="$LDFLAGS $librrd_ldflags"
714         AC_CHECK_LIB(rrd_th, rrd_update_r,
715         [with_rrdtool="yes"
716          librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
717         ],
718         [librrd_threadsafe="no"
719          AC_CHECK_LIB(rrd, rrd_update,
720          [with_rrdtool="yes"
721           librrd_ldflags="$librrd_ldflags -lrrd -lm"
722          ],
723          [with_rrdtool="no (symbol 'rrd_update' not found)"],
724          [-lm])
725         ]
726         [-lm])
728         CPPFLAGS="$SAVE_CPPFLAGS"
729         LDFLAGS="$SAVE_LDFLAGS"
730 fi
731 if test "x$with_rrdtool" = "xyes"
732 then
733         BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
734         BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
735         AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
736         AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
737 fi
738 if test "x$librrd_threadsafe" = "xyes"
739 then
740         AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
741 fi
743 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
744 [       if test "x$withval" != "xno" -a "x$withval" != "xyes"
745         then
746                 LDFLAGS="$LDFLAGS -L$withval/lib"
747                 CPPFLAGS="$CPPFLAGS -I$withval/include"
748                 with_libpthread="yes"
749         else
750                 if test "x$withval" = "xno"
751                 then
752                         with_libpthread="no (disabled)"
753                 fi
754         fi
755 ], [with_libpthread="yes"])
756 if test "x$with_libpthread" = "xyes"
757 then
758         AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
759 fi
760 if test "x$with_libpthread" = "xyes"
761 then
762         AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
763 fi
764 if test "x$with_libpthread" = "xyes"
765 then
766         collect_pthread=1
767 else
768         collect_pthread=0
769 fi
770 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
771         [Wether or not to use pthread (POSIX threads) library])
772 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
774 if test "x$ac_system" = "xSolaris"
775 then
776         with_kstat="yes"
777         with_devinfo="yes"
778 else
779         with_kstat="no (Solaris only)"
780         with_devinfo="no (Solaris only)"
781 fi
783 if test "x$with_kstat" = "xyes"
784 then
785         AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
786 fi
787 if test "x$with_kstat" = "xyes"
788 then
789         AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
790         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
791 fi
792 if test "x$with_kstat" = "xyes"
793 then
794         AC_DEFINE(HAVE_LIBKSTAT, 1,
795                   [Define to 1 if you have the 'kstat' library (-lkstat)])
796 fi
797 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
798 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
800 ### BEGIN of check for libcurl ###
801 with_curl_config="curl-config"
802 with_curl_cflags=""
803 with_curl_libs=""
804 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
806         if test "x$withval" = "xno"
807         then
808                 with_libcurl="no"
809         else if test "x$withval" = "xyes"
810         then
811                 with_libcurl="yes"
812         else
813                 if test -f "$withval" && test -x "$withval"
814                 then
815                         with_curl_config="$withval"
816                         with_libcurl="yes"
817                 else if test -x "$withval/bin/curl-config"
818                 then
819                         with_curl_config="$withval/bin/curl-config"
820                         with_libcurl="yes"
821                 fi; fi
822                 with_libcurl="yes"
823         fi; fi
824 ],
826         with_libcurl="yes"
827 ])
828 if test "x$with_libcurl" = "xyes"
829 then
830         with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
831         curl_config_status=$?
833         if test $curl_config_status -ne 0
834         then
835                 with_libcurl="no ($with_curl_config failed)"
836         else
837                 SAVE_CFLAGS=$CFLAGS
838                 CFLAGS="$CFLAGS $with_curl_cflags"
840                 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
842                 CFLAGS="$SAVE_CFLAGS"
843         fi
844 fi
845 if test "x$with_libcurl" = "xyes"
846 then
847         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
848         curl_config_status=$?
850         if test $curl_config_status -ne 0
851         then
852                 with_libcurl="no ($with_curl_config failed)"
853         else
854                 AC_CHECK_LIB(curl, curl_easy_init,
855                  [with_libcurl="yes"],
856                  [with_libcurl="no (symbol 'curl_easy_init' not found)"],
857                  [$with_curl_libs])
858         fi
859 fi
860 if test "x$with_libcurl" = "xyes"
861 then
862         BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
863         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
864         AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
865         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
866 fi
867 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
868 ### END of check for libcurl ###
870 with_libiokit="no"
871 collectd_libiokit=0
872 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
874         with_libiokit="yes"
875         collectd_libiokit=1
876 ], 
878         with_libiokit="no"
879         collectd_libiokit=0
880 ])
881 AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library])
882 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
884 with_libstatgrab="yes"
885 with_libdevstat="no"
886 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
888         if test "x$withval" != "xno" -a "x$withval" != "xyes"
889         then
890                 LDFLAGS="$LDFLAGS -L$withval/lib"
891                 CPPFLAGS="$CPPFLAGS -I$withval/include"
892                 with_libstatgrab="yes"
893         fi
894 ],
896         if test "x$ac_system" == "xunknown"
897         then
898                 with_libstatgrab="yes"
899         else
900                 with_libstatgrab="no"
901         fi
902 ])
903 if test "x$with_libstatgrab" = "xyes"
904 then
905         AC_CHECK_LIB(statgrab, sg_init, [with_libstatgrab="yes"], [with_libstatgrab="no (libstatgrab not found)"])
906 fi
907 if test "x$with_libstatgrab" = "xyes"
908 then
909         AC_CHECK_HEADERS(statgrab.h,,    [with_libstatgrab="no (statgrab.h not found)"])
910 fi
911 if test "x$with_libstatgrab" = "xyes"
912 then
913         AC_CHECK_LIB(devstat, getdevs, [with_libdevstat="yes"], [with_libdevstat="no"])
914 fi
915 if test "x$with_libstatgrab" = "xyes"
916 then
917         collect_libstatgrab=1
918 else
919         collect_libstatgrab=0
920 fi
921 AC_DEFINE_UNQUOTED(COLLECT_LIBSTATGRAB, [$collect_libstatgrab],
922         [Wether or not to use statgrab library])
923 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
924 AM_CONDITIONAL(BUILD_WITH_LIBDEVSTAT,  test "x$with_libdevstat"  = "xyes")
926 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_libkvm="yes"], [with_libkvm="no"])
927 if test "x$with_libkvm" = "xyes"
928 then
929         AC_DEFINE(HAVE_LIBKVM, 1, [Define to 1 if you have the 'kvm' library (-lkvm)])
930 fi
931 AM_CONDITIONAL(BUILD_WITH_LIBKVM, test "x$with_libkvm" = "xyes")
933 AC_ARG_WITH(lm-sensors, [AS_HELP_STRING([--with-lm-sensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
935         if test "x$withval" != "xno" && test "x$withval" != "xyes"
936         then
937                 LDFLAGS="$LDFLAGS -L$withval/lib"
938                 CPPFLAGS="$CPPFLAGS -I$withval/include"
939                 with_lm_sensors="yes"
940         fi
941 ],
943         if test "x$ac_system" = "xLinux"
944         then
945                 with_lm_sensors="yes"
946         else
947                 with_lm_sensors="no (Linux only library)"
948         fi
949 ])
950 if test "x$with_lm_sensors" = "xyes"
951 then
952         AC_CHECK_LIB(sensors, sensors_init,
953         [
954                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
955         ],
956         [with_lm_sensors="no (libsensors not found)"])
957 fi
958 if test "x$with_lm_sensors" = "xyes"
959 then
960         AC_CHECK_HEADERS(sensors/sensors.h,
961         [
962                 AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
963         ],
964         [with_lm_sensors="no (sensors/sensors.h not found)"])
965 fi
966 if test "x$with_lm_sensors" = "xyes"
967 then
968         collect_lm_sensors=1
969 else
970         collect_lm_sensors=0
971 fi
972 AC_DEFINE_UNQUOTED(COLLECT_LM_SENSORS, [$collect_lm_sensors],
973         [Wether or not to use sensors library])
974 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_lm_sensors" = "xyes")
976 with_mysql_config="mysql_config"
977 with_mysql_cflags=""
978 with_mysql_libs=""
979 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
981         if test "x$withval" = "xno"
982         then
983                 with_libmysql="no"
984         else if test "x$withval" = "xyes"
985         then
986                 with_libmysql="yes"
987         else
988                 if test -f "$withval" && test -x "$withval";
989                 then
990                         with_mysql_config="$withval"
991                 else if test -x "$withval/bin/mysql_config"
992                 then
993                         with_mysql_config="$withval/bin/mysql_config"
994                 fi; fi
995                 with_libmysql="yes"
996         fi; fi
997 ],
999         with_libmysql="yes"
1000 ])
1001 if test "x$with_libmysql" = "xyes"
1002 then
1003         with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1004         mysql_config_status=$?
1006         if test $mysql_config_status -ne 0
1007         then
1008                 with_libmysql="no"
1009         else
1010                 SAVE_CFLAGS=$CFLAGS
1011                 CFLAGS="$CFLAGS $with_mysql_cflags"
1013                 AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
1015                 CFLAGS="$SAVE_CFLAGS"
1016         fi
1017 fi
1018 if test "x$with_libmysql" = "xyes"
1019 then
1020         with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1021         mysql_config_status=$?
1023         if test $mysql_config_status -ne 0
1024         then
1025                 with_libmysql="no"
1026         else
1027                 AC_CHECK_LIB(mysqlclient, mysql_init,
1028                  [with_libmysql="yes"],
1029                  [with_libmysql="no (symbol 'mysql_init' not found)"],
1030                  [$with_mysql_libs])
1031         fi
1032 fi
1033 if test "x$with_libmysql" = "xyes"
1034 then
1035         BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1036         BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1037         AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1038         AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1039 fi
1040 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1042 with_own_liboconfig="no"
1043 liboconfig_LDFLAGS="$LDFLAGS"
1044 liboconfig_CPPFLAGS="$CPPFLAGS"
1045 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1047         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1048         then
1049                 if test -d "$withval/lib"
1050                 then
1051                         liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1052                 fi
1053                 if test -d "$withval/include"
1054                 then
1055                         liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1056                 fi
1057         fi
1058         if test "x$withval" = "xno"
1059         then
1060                 AC_MSG_ERROR("liboconfig is required")
1061         fi
1062 ],
1064         with_liboconfig="yes"
1065 ])
1067 save_LDFLAGS="$LDFLAGS"
1068 save_CPPFLAGS="$CPPFLAGS"
1069 LDFLAGS="$liboconfig_LDFLAGS"
1070 CPPFLAGS="$liboconfig_CPPFLAGS"
1071 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1073         with_liboconfig="yes"
1074         with_own_liboconfig="no"
1075 ],
1077         with_liboconfig="yes"
1078         with_own_liboconfig="yes"
1079         LDFLAGS="$save_LDFLAGS"
1080         CPPFLAGS="$save_CPPFLAGS"
1081 ])
1083 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1084 if test "x$with_own_liboconfig" = "xyes"
1085 then
1086         with_liboconfig="yes (shipped version)"
1087 fi
1089 #with_liboping="yes"
1090 with_own_liboping="no"
1091 liboping_LDFLAGS="$LDFLAGS"
1092 liboping_CPPFLAGS="$CPPFLAGS"
1093 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1095         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1096         then
1097                 if test -d "$withval/lib"
1098                 then
1099                         liboping_LDFLAGS="$LDFLAGS -L$withval/lib"
1100                 fi
1101                 if test -d "$withval/include"
1102                 then
1103                         liboping_CPPFLAGS="$CPPFLAGS -I$withval/include"
1104                 fi
1105         fi
1106         if test "x$withval" = "xno"
1107         then
1108                 with_liboping="no"
1109                 with_own_liboping="no"
1110         fi
1111 ],
1113         #753
1114         with_liboping="yes"
1115 ])
1117 if test "x$with_liboping" = "xyes"
1118 then
1119         save_LDFLAGS="$LDFLAGS"
1120         save_CPPFLAGS="$CPPFLAGS"
1121         LDFLAGS="$liboping_LDFLAGS"
1122         CPPFLAGS="$liboping_CPPFLAGS"
1123         AC_CHECK_LIB(oping, ping_construct,
1124         [
1125                 with_liboping="yes"
1126                 with_own_liboping="no"
1127         ],
1128         [
1129                 with_liboping="yes"
1130                 with_own_liboping="yes"
1131                 LDFLAGS="$save_LDFLAGS"
1132                 CPPFLAGS="$save_CPPFLAGS"
1133         ])
1134 fi
1135 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
1136 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOPING, test "x$with_own_liboping" = "xyes")
1138 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
1140         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1141         then
1142                 LDFLAGS="$LDFLAGS -L$withval/lib"
1143                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1144                 with_libpcap="yes"
1145         fi
1146 ],
1148         with_libpcap="yes"
1149 ])
1150 if test "x$with_libpcap" = "xyes"
1151 then
1152         AC_CHECK_LIB(pcap, pcap_open_live,
1153         [
1154                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
1155         ], [with_libpcap="no (libpcap not found)"])
1156 fi
1157 if test "x$with_libpcap" = "xyes"
1158 then
1159         AC_CHECK_HEADERS(pcap.h,
1160         [
1161                 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
1162         ], [with_libpcap="no (pcap.h not found)"])
1163 fi
1164 if test "x$with_libpcap" = "xyes"
1165 then
1166         collect_libpcap=1
1167 else
1168         collect_libpcap=0
1169 fi
1170 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
1171         [Wether or not to use the pcap library])
1172 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
1174 perl_interpreter="perl"
1175 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
1177         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1178         then
1179                 LDFLAGS="$LDFLAGS -L$withval/lib"
1180                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1181                 perl_interpreter="$withval/bin/perl"
1182                 with_libperl="yes"
1183         fi
1184 ],
1186         with_libperl="yes"
1187 ])
1189 AC_SUBST(PERL, "$perl_interpreter")
1191 if test "x$with_libperl" = "xyes"
1192 then
1193   SAVE_CFLAGS=$CFLAGS
1194   SAVE_LDFLAGS=$LDFLAGS
1195   PERL_CFLAGS=`$perl_interpreter -MExtUtils::Embed -e ccopts`
1196   PERL_LDFLAGS=`$perl_interpreter -MExtUtils::Embed -e ldopts`
1197   CFLAGS="$CFLAGS $PERL_CFLAGS"
1198   LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
1200   AC_CACHE_CHECK([for libperl],
1201     [have_libperl],
1202     AC_LINK_IFELSE(
1203       AC_LANG_PROGRAM(
1204       [[
1205 #include <EXTERN.h>
1206 #include <perl.h>
1207 #include <XSUB.h>
1208       ]],
1209       [[
1210        PerlInterpreter *perl = NULL;
1211        Perl_load_module (perl, PERL_LOADMOD_NOIMPORT,
1212                          newSVpv ("Collectd::Plugin::FooBar", 24),
1213                          Nullsv);
1214       ]]),
1215       [have_libperl="yes"],
1216       [have_libperl="no"]
1217     )
1218   )
1220   if test "x$have_libperl" = "xyes"
1221   then
1222           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
1223           AC_SUBST(PERL_CFLAGS)
1224           AC_SUBST(PERL_LDFLAGS)
1225   else
1226           with_libperl="no"
1227   fi
1229   CFLAGS=$SAVE_CFLAGS
1230   LDFLAGS=$SAVE_LDFLAGS
1231 fi
1232 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
1234 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1236         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1237         then
1238                 LDFLAGS="$LDFLAGS -L$withval/lib"
1239                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1240                 with_libiptc="yes"
1241         fi
1242 ],
1244         if test "x$ac_system" = "xLinux"
1245         then
1246                 with_libiptc="yes"
1247         else
1248                 with_libiptc="no (Linux only)"
1249         fi
1250 ])
1251 if test "x$with_libiptc" = "xyes"
1252 then
1253         AC_CHECK_LIB(iptc, iptc_init,
1254         [
1255                 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1256         ], [with_libiptc="no (libiptc not found)"])
1257 fi
1258 if test "x$with_libiptc" = "xyes"
1259 then
1260         AC_CHECK_HEADERS(libiptc/libiptc.h,
1261         [
1262                 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1263         ], [with_libiptc="no (libiptc/libiptc.h not found)"])
1264 fi
1265 if test "x$with_libiptc" = "xyes"
1266 then
1267         collect_libiptc=1
1268 else
1269         collect_libiptc=0
1270 fi
1271 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1273 with_snmp_config="net-snmp-config"
1274 with_snmp_cflags=""
1275 with_snmp_libs=""
1276 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1278         if test "x$withval" = "xno"
1279         then
1280                 with_libnetsnmp="no"
1281         else if "x$withval" = "xyes"
1282         then
1283                 with_libnetsnmp="yes"
1284         else
1285                 if test -x "$withval"
1286                 then
1287                         with_snmp_config="$withval"
1288                         with_libnetsnmp="yes"
1289                 else
1290                         with_snmp_config="$withval/bin/net-snmp-config"
1291                         with_libnetsnmp="yes"
1292                 fi
1293         fi; fi
1294 ],
1295 [with_libnetsnmp="yes"])
1296 if test "x$with_libnetsnmp" = "xyes"
1297 then
1298         with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1299         snmp_config_status=$?
1301         if test $snmp_config_status -ne 0
1302         then
1303                 with_libnetsnmp="no ($with_snmp_config failed)"
1304         else
1305                 SAVE_CFLAGS=$CFLAGS
1306                 CFLAGS="$CFLAGS $with_snmp_cflags"
1307                 
1308                 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1310                 CFLAGS="$SAVE_CFLAGS"
1311         fi
1312 fi
1313 if test "x$with_libnetsnmp" = "xyes"
1314 then
1315         with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1316         snmp_config_status=$?
1318         if test $snmp_config_status -ne 0
1319         then
1320                 with_libnetsnmp="no ($with_snmp_config failed)"
1321         else
1322                 AC_CHECK_LIB(netsnmp, init_snmp,
1323                 [with_libnetsnmp="yes"],
1324                 [with_libnetsnmp="no (libnetsnmp not found)"],
1325                 [$with_snmp_libs])
1326         fi
1327 fi
1328 if test "x$with_libnetsnmp" = "xyes"
1329 then
1330         BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1331         BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1332         AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1333         AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1334 fi
1335 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1337 with_upsclient_config="libupsclient-config"
1338 with_upsclient_cflags=""
1339 with_upsclient_libs=""
1340 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
1342         if test "x$withval" = "xno"
1343         then
1344                 with_libupsclient="no"
1345         else
1346                 if test "x$withval" != "xyes"
1347                 then
1348                         if test -f "$withval" && test -x "$withval";
1349                         then
1350                                 with_upsclient_config="$withval"
1351                         else
1352                                 with_upsclient_config="$withval/bin/libupsclient-config"
1353                         fi
1354                 fi
1355                 with_libupsclient="yes"
1356         fi
1357 ],
1359         with_libupsclient="yes"
1360 ])
1361 if test "x$with_libupsclient" = "xyes"
1362 then
1363         with_upsclient_cflags=`$with_upsclient_config --cflags 2>/dev/null`
1364         upsclient_config_status=$?
1366         if test $upsclient_config_status -ne 0
1367         then
1368                 with_libupsclient="no ($with_upsclient_config failed)"
1369         fi
1370 fi
1371 if test "x$with_libupsclient" = "xyes"
1372 then
1373         SAVE_CFLAGS="$CFLAGS"
1374         CFLAGS="$CFLAGS $with_upsclient_cflags"
1376         AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
1378         CFLAGS="$SAVE_CFLAGS"
1379 fi
1380 if test "x$with_libupsclient" = "xyes"
1381 then
1382         with_upsclient_libs=`$with_upsclient_config --libs 2>/dev/null`
1383         upsclient_config_status=$?
1385         if test $upsclient_config_status -ne 0
1386         then
1387                 with_libupsclient="no ($with_upsclient_config failed)"
1388         fi
1389 fi
1390 if test "x$with_libupsclient" = "xyes"
1391 then
1392         AC_CHECK_LIB(upsclient, upscli_connect,
1393         [
1394                 BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_upsclient_cflags"
1395                 BUILD_WITH_LIBUPSCLIENT_LIBS="$with_upsclient_libs"
1396                 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
1397                 AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
1398         ],
1399         [
1400                 with_libupsclient="no (symbol 'upscli_connect' not found)"
1401         ], [$with_upsclient_libs])
1402 fi
1403 if test "x$with_libupsclient" = "xyes"
1404 then
1405         AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [], 
1406 [#include <stdlib.h>
1407 #include <stdio.h>
1408 #include <upsclient.h>])
1409 fi
1410 AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")
1412 ### BEGIN of check for libxmms ###
1413 with_xmms_config="xmms-config"
1414 with_xmms_cflags=""
1415 with_xmms_libs=""
1416 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
1418         if test "x$withval" != "xno" -a "x$withval" != "xyes"
1419         then
1420                 if test -f "$withval" && test -x "$withval";
1421                 then
1422                         with_xmms_config="$withval"
1423                 else if test -x "$withval/bin/xmms-config"
1424                 then
1425                         with_xmms_config="$withval/bin/xmms-config"
1426                 fi; fi
1427                 with_libxmms="yes"
1428         else if test "x$withval" = "xno"
1429         then
1430                 with_libxmms="no"
1431         else
1432                 with_libxmms="yes"
1433         fi; fi
1434 ],
1436         with_libxmms="yes"
1437 ])
1438 if test "x$with_libxmms" = "xyes"
1439 then
1440         with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
1441         xmms_config_status=$?
1443         if test $xmms_config_status -ne 0
1444         then
1445                 with_libxmms="no"
1446         fi
1447 fi
1448 if test "x$with_libxmms" = "xyes"
1449 then
1450         with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
1451         xmms_config_status=$?
1453         if test $xmms_config_status -ne 0
1454         then
1455                 with_libxmms="no"
1456         fi
1457 fi
1458 if test "x$with_libxmms" = "xyes"
1459 then
1460         AC_CHECK_LIB(xmms, xmms_remote_get_info,
1461         [
1462                 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
1463                 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
1464                 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
1465                 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
1466         ],
1467         [
1468                 with_libxmms="no"
1469         ],
1470         [$with_xmms_libs])
1471 fi
1472 with_libxmms_numeric=0
1473 if test "x$with_libxmms" = "xyes"
1474 then
1475         with_libxmms_numeric=1
1476 fi
1477 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
1478 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
1479 ### END of check for libxmms ###
1481 with_libnetlink_cflags=""
1482 with_libnetlink_libs="-lnetlink"
1483 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1485  echo "libnetlink: withval = $withval"
1486  if test "x$withval" = "xyes"
1487  then
1488          with_libnetlink="yes"
1489  else if test "x$withval" = "xno"
1490  then
1491          with_libnetlink="no"
1492  else
1493          if test -d "$withval/include"
1494          then
1495                  with_libnetlink_cflags="-I$withval/include"
1496                  with_libnetlink_libs="-L$withval/lib -lnetlink"
1497                  with_libnetlink="yes"
1498          else
1499                  AC_MSG_ERROR("no such directory: $withval/include")
1500          fi
1501  fi; fi
1502 ],
1504  if test "x$ac_system" = "xLinux"
1505  then
1506          with_libnetlink="yes"
1507  else
1508          with_libnetlink="no (Linux only library)"
1509  fi
1510 ])
1511 if test "x$with_libnetlink" = "xyes"
1512 then
1513         SAVE_CFLAGS=$CFLAGS
1514         CFLAGS="$CFLAGS $with_libnetlink_cflags"
1516         with_libnetlink="no (libnetlink.h not found)"
1518         AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1519         [
1520          with_libnetlink="yes"
1521          break
1522         ], [],
1523 [#include <stdio.h>
1524 #include <sys/types.h>
1525 #include <asm/types.h>
1526 #include <sys/socket.h>
1527 #include <linux/netlink.h>
1528 #include <linux/rtnetlink.h>])
1529         AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1530 [#include <stdio.h>
1531 #include <sys/types.h>
1532 #include <asm/types.h>
1533 #include <sys/socket.h>])
1535         AC_COMPILE_IFELSE(
1536 [#include <stdio.h>
1537 #include <sys/types.h>
1538 #include <asm/types.h>
1539 #include <sys/socket.h>
1540 #include <linux/netlink.h>
1541 #include <linux/rtnetlink.h>
1543 int main (void)
1545         int retval = TCA_STATS2;
1546         return (retval);
1547 }],
1548         [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1549         []);
1551         AC_COMPILE_IFELSE(
1552 [#include <stdio.h>
1553 #include <sys/types.h>
1554 #include <asm/types.h>
1555 #include <sys/socket.h>
1556 #include <linux/netlink.h>
1557 #include <linux/rtnetlink.h>
1559 int main (void)
1561         int retval = TCA_STATS;
1562         return (retval);
1563 }],
1564         [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1565         []);
1567         CFLAGS="$SAVE_CFLAGS"
1568 fi
1569 if test "x$with_libnetlink" = "xyes"
1570 then
1571         AC_CHECK_LIB(netlink, rtnl_open,
1572                      [with_libnetlink="yes"],
1573                      [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1574                      [$with_libnetlink_libs])
1575 fi
1576 if test "x$with_libnetlink" = "xyes"
1577 then
1578         BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1579         BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1580         AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1581         AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1582 fi
1583 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1585 # Check for enabled/disabled features
1588 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
1589 # ------------------------------------------------------------
1590 dnl
1591 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
1592 dnl
1593 AC_DEFUN(
1594         [AC_COLLECTD],
1595         [
1596         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
1597         m4_if(
1598                 [$2],
1599                 [enable],
1600                 [dnl
1601                 m4_define([EnDis],[disabled])dnl
1602                 m4_define([YesNo],[no])dnl
1603                 ],dnl
1604                 [m4_if(
1605                         [$2],
1606                         [disable],
1607                         [dnl
1608                         m4_define([EnDis],[enabled])dnl
1609                         m4_define([YesNo],[yes])dnl
1610                         ],
1611                         [dnl
1612                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
1613                         ]dnl
1614                 )]dnl
1615         )dnl
1616         m4_if([$3], [feature], [],
1617                 [m4_if(
1618                         [$3], [module], [],
1619                         [dnl
1620                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
1621                         ]dnl
1622                 )]dnl
1623         )dnl
1624         AC_ARG_ENABLE(
1625                 [$1],
1626                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
1627                 [],
1628                 enable_$1='[YesNo]'dnl
1629         )# AC_ARG_ENABLE
1630 if test "x$enable_$1" = "xno"
1631 then
1632         collectd_$1=0
1633 else
1634         if test "x$enable_$1" = "xyes"
1635         then
1636                 collectd_$1=1
1637         else
1638                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
1639                 collectd_$1=1
1640                 enable_$1='yes'
1641         fi
1642 fi
1643         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
1644         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
1645         ]dnl
1646 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
1648 # AC_PLUGIN(name, default, info)
1649 # ------------------------------------------------------------
1650 dnl
1651 AC_DEFUN(
1652   [AC_PLUGIN],
1653   [
1654     enable_plugin="no"
1655     AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
1656     [
1657      if test "x$enableval" = "xyes"
1658      then
1659              enable_plugin="yes"
1660      else
1661              enable_plugin="no"
1662      fi
1663     ],
1664     [
1665      if test "x$2" = "xyes"
1666      then
1667              enable_plugin="yes"
1668      else
1669              enable_plugin="no"
1670      fi
1671     ])
1672     if test "x$enable_plugin" = "xyes"
1673     then
1674             AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
1675     fi
1676     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
1677     enable_$1="$enable_plugin"
1678   ]
1679 )# AC_PLUGIN(name, default, info)
1681 m4_divert_once([HELP_ENABLE], [
1682 collectd features:])
1683 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
1684 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
1685 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
1686 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
1688 plugin_battery="no"
1689 plugin_cpu="no"
1690 plugin_cpufreq="no"
1691 plugin_df="no"
1692 plugin_disk="no"
1693 plugin_entropy="no"
1694 plugin_interface="no"
1695 plugin_ipvs="no"
1696 plugin_irq="no"
1697 plugin_load="no"
1698 plugin_memory="no"
1699 plugin_multimeter="no"
1700 plugin_nfs="no"
1701 plugin_processes="no"
1702 plugin_serial="no"
1703 plugin_swap="no"
1704 plugin_tape="no"
1705 plugin_tcpconns="no"
1706 plugin_users="no"
1707 plugin_vserver="no"
1708 plugin_wireless="no"
1710 # Linux
1711 if test "x$ac_system" = "xLinux"
1712 then
1713         plugin_battery="yes"
1714         plugin_cpu="yes"
1715         plugin_cpufreq="yes"
1716         plugin_disk="yes"
1717         plugin_entropy="yes"
1718         plugin_interface="yes"
1719         plugin_irq="yes"
1720         plugin_load="yes"
1721         plugin_memory="yes"
1722         plugin_nfs="yes"
1723         plugin_processes="yes"
1724         plugin_serial="yes"
1725         plugin_swap="yes"
1726         plugin_tcpconns="yes"
1727         plugin_vserver="yes"
1728         plugin_wireless="yes"
1730         if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
1731         then
1732                 plugin_ipvs="yes"
1733         fi
1734 fi
1736 # Mac OS X devices
1737 if test "x$with_libiokit" = "xyes"
1738 then
1739         plugin_battery="yes"
1740         plugin_disk="yes"
1741 fi
1743 # Solaris
1744 if test "x$with_devinfo$with_kstat" = "xyesyes"
1745 then
1746         plugin_cpu="yes"
1747         plugin_disk="yes"
1748         plugin_interface="yes"
1749         plugin_memory="yes"
1750         plugin_swap="yes"
1751         plugin_tape="yes"
1752 fi
1754 # libstatgrab
1755 if test "x$with_libstatgrab" = "xyes"
1756 then
1757         plugin_interface="yes"
1758         plugin_load="yes"
1759         plugin_memory="yes"
1760         plugin_swap="yes"
1761 fi
1763 if test "x$have_processor_info" = "xyes"
1764 then
1765         plugin_cpu="yes"
1766 fi
1767 if test "x$have_sysctlbyname" = "xyes"
1768 then
1769         plugin_cpu="yes"
1770         plugin_memory="yes"
1771         plugin_tcpconns="yes"
1772 fi
1774 if test "x$have_statfs" = "xyes"
1775 then
1776         plugin_df="yes"
1777 fi
1778 if test "x$have_statvfs" = "xyes"
1779 then
1780         plugin_df="yes"
1781 fi
1783 if test "x$have_getifaddrs" = "xyes"
1784 then
1785         plugin_interface="yes"
1786 fi
1788 if test "x$have_getloadavg" = "xyes"
1789 then
1790         plugin_load="yes"
1791 fi
1793 # Mac OS X memory interface
1794 if test "x$have_host_statistics" = "xyes"
1795 then
1796         plugin_memory="yes"
1797 fi
1799 if test "x$have_termios_h" = "xyes"
1800 then
1801         plugin_multimeter="yes"
1802 fi
1804 if test "x$have_thread_info" = "xyes"
1805 then
1806         plugin_processes="yes"
1807 fi
1809 if test "x$with_libkvm" = "xyes"
1810 then
1811         plugin_swap="yes"
1812 fi
1814 if test "x$have_getutent" = "xyes"
1815 then
1816         plugin_users="yes"
1817 fi
1818 if test "x$have_getutxent" = "xyes"
1819 then
1820         plugin_users="yes"
1821 fi
1823 # FIXME: sysctl for swap plugin
1825 m4_divert_once([HELP_ENABLE], [
1826 collectd plugins:])
1828 AC_PLUGIN([apache],      [$with_libcurl],      [Apache httpd statistics])
1829 AC_PLUGIN([apcups],      [yes],                [Statistics of UPSes by APC])
1830 AC_PLUGIN([apple_sensors], [$with_libiokit],   [Apple's hardware sensors])
1831 AC_PLUGIN([battery],     [$plugin_battery],    [Battery statistics])
1832 AC_PLUGIN([cpu],         [$plugin_cpu],        [CPU usage statistics])
1833 AC_PLUGIN([cpufreq],     [$plugin_cpufreq],    [CPU frequency statistics])
1834 AC_PLUGIN([csv],         [yes],                [CSV output plugin])
1835 AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
1836 AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
1837 AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
1838 AC_PLUGIN([email],       [yes],                [EMail statistics])
1839 AC_PLUGIN([entropy],     [$plugin_entropy],    [Entropy statistics])
1840 AC_PLUGIN([exec],        [yes],                [Execution of external programs])
1841 AC_PLUGIN([hddtemp],     [yes],                [Query hddtempd])
1842 AC_PLUGIN([interface],   [$plugin_interface],  [Interface traffic statistics])
1843 AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
1844 AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
1845 AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
1846 AC_PLUGIN([load],        [$plugin_load],       [System load])
1847 AC_PLUGIN([logfile],     [yes],                [File logging plugin])
1848 AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
1849 AC_PLUGIN([memcached],   [yes],                [memcached statistics])
1850 AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
1851 AC_PLUGIN([multimeter],  [$plugin_multimeter], [Read multimeter values])
1852 AC_PLUGIN([mysql],       [$with_libmysql],     [MySQL statistics])
1853 AC_PLUGIN([netlink],     [$with_libnetlink],   [Enhanced Linux network statistics])
1854 AC_PLUGIN([network],     [yes],                [Network communication plugin])
1855 AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
1856 AC_PLUGIN([nginx],       [$with_libcurl],      [nginx statistics])
1857 AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
1858 AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
1859 AC_PLUGIN([perl],        [$with_libperl],      [Embed a Perl interpreter])
1860 AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
1861 AC_PLUGIN([processes],   [$plugin_processes],  [Process statistics])
1862 AC_PLUGIN([rrdtool],     [$with_rrdtool],      [RRDTool output plugin])
1863 AC_PLUGIN([sensors],     [$with_lm_sensors],   [lm_sensors statistics])
1864 AC_PLUGIN([serial],      [$plugin_serial],     [serial port traffic])
1865 AC_PLUGIN([snmp],        [$with_libnetsnmp],   [SNMP querying plugin])
1866 AC_PLUGIN([swap],        [$plugin_swap],       [Swap usage statistics])
1867 AC_PLUGIN([syslog],      [$have_syslog],       [Syslog logging plugin])
1868 AC_PLUGIN([tape],        [$plugin_tape],       [Tape drive statistics])
1869 AC_PLUGIN([tcpconns],    [$plugin_tcpconns],   [TCP connection statistics])
1870 AC_PLUGIN([unixsock],    [yes],                [Unixsock communication plugin])
1871 AC_PLUGIN([users],       [$plugin_users],      [User statistics])
1872 AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
1873 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
1874 AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
1876 dnl ip_vs.h
1877 if test "x$ac_system" = "xLinux" -a "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
1878 then
1879         enable_ipvs="$enable_ipvs (ip_vs.h not found)"
1880 fi
1882 dnl Perl bindings
1883 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
1885         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1886         then
1887                 PERL_BINDINGS_OPTIONS="$withval"
1888                 with_perl_bindings="yes"
1889         fi
1890 ],
1892         PERL_BINDINGS_OPTIONS=""
1893         with_perl_bindings="yes"
1894 ])
1895 if test "x$with_perl_bindings" = "xyes"
1896 then
1897         PERL_BINDINGS="perl"
1898 else
1899         PERL_BINDINGS=""
1900 fi
1901 AC_SUBST(PERL_BINDINGS)
1902 AC_SUBST(PERL_BINDINGS_OPTIONS)
1904 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/liboconfig/Makefile src/liboping/Makefile bindings/Makefile)
1906 if test "x$with_liboping" = "xyes" -a "x$with_own_liboping" = "xyes"
1907 then
1908         with_liboping="yes (shipped version)"
1909 fi
1911 if test "x$with_libperl" = "xyes"
1912 then
1913         with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
1914 else
1915         enable_perl="no (needs libperl)"
1916 fi
1918 if test "x$with_perl_bindings" = "xyes" -a "x$PERL_BINDINGS_OPTIONS" != "x"
1919 then
1920         with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
1921 fi
1923 cat <<EOF;
1925 Configuration:
1926   Libraries:
1927     libcurl . . . . . . $with_libcurl
1928     libiokit  . . . . . $with_libiokit
1929     libiptc . . . . . . $with_libiptc
1930     libkstat  . . . . . $with_kstat
1931     libkvm  . . . . . . $with_libkvm
1932     libmysql  . . . . . $with_libmysql
1933     libnetlink  . . . . $with_libnetlink
1934     libnetsnmp  . . . . $with_libnetsnmp
1935     liboconfig  . . . . $with_liboconfig
1936     liboping  . . . . . $with_liboping
1937     libpcap . . . . . . $with_libpcap
1938     libperl . . . . . . $with_libperl
1939     libpthread  . . . . $with_libpthread
1940     librrd  . . . . . . $with_rrdtool
1941     libsensors  . . . . $with_lm_sensors
1942     libstatgrab . . . . $with_libstatgrab
1943     libupsclient  . . . $with_libupsclient
1944     libxmms . . . . . . $with_libxmms
1946   Features:
1947     daemon mode . . . . $enable_daemon
1948     debug . . . . . . . $enable_debug
1950   Bindings:
1951     perl  . . . . . . . $with_perl_bindings
1953   Modules:
1954     apache  . . . . . . $enable_apache
1955     apcups  . . . . . . $enable_apcups
1956     apple_sensors . . . $enable_apple_sensors
1957     battery . . . . . . $enable_battery
1958     cpu . . . . . . . . $enable_cpu
1959     cpufreq . . . . . . $enable_cpufreq
1960     csv . . . . . . . . $enable_csv
1961     df  . . . . . . . . $enable_df
1962     disk  . . . . . . . $enable_disk
1963     dns . . . . . . . . $enable_dns
1964     email . . . . . . . $enable_email
1965     entropy . . . . . . $enable_entropy
1966     exec  . . . . . . . $enable_exec
1967     hddtemp . . . . . . $enable_hddtemp
1968     interface . . . . . $enable_interface
1969     iptables  . . . . . $enable_iptables
1970     ipvs  . . . . . . . $enable_ipvs
1971     irq . . . . . . . . $enable_irq
1972     load  . . . . . . . $enable_load
1973     logfile . . . . . . $enable_logfile
1974     mbmon . . . . . . . $enable_mbmon
1975     memcached . . . . . $enable_memcached
1976     memory  . . . . . . $enable_memory
1977     multimeter  . . . . $enable_multimeter
1978     mysql . . . . . . . $enable_mysql
1979     netlink . . . . . . $enable_netlink
1980     network . . . . . . $enable_network
1981     nfs . . . . . . . . $enable_nfs
1982     nginx . . . . . . . $enable_nginx
1983     ntpd  . . . . . . . $enable_ntpd
1984     nut . . . . . . . . $enable_nut
1985     perl  . . . . . . . $enable_perl
1986     ping  . . . . . . . $enable_ping
1987     processes . . . . . $enable_processes
1988     rrdtool . . . . . . $enable_rrdtool
1989     sensors . . . . . . $enable_sensors
1990     serial  . . . . . . $enable_serial
1991     snmp  . . . . . . . $enable_snmp
1992     swap  . . . . . . . $enable_swap
1993     syslog  . . . . . . $enable_syslog
1994     tape  . . . . . . . $enable_tape
1995     tcpconns  . . . . . $enable_tcpconns
1996     unixsock  . . . . . $enable_unixsock
1997     users . . . . . . . $enable_users
1998     vserver . . . . . . $enable_vserver
1999     wireless  . . . . . $enable_wireless
2000     xmms  . . . . . . . $enable_xmms
2002 EOF