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