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