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