madwifi plugin: Plugin for detailed information from the MadWifi driver.
[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
6 m4_ifdef([LT_PACKAGE_VERSION],
7         # libtool >= 2.2
8         [
9          LT_CONFIG_LTDL_DIR([libltdl])
10          LT_INIT([dlopen])
11          LTDL_INIT([convenience])
12         ]
13 ,
14         # libtool <= 1.5
15         [
16          AC_LIBLTDL_CONVENIENCE
17          AC_SUBST(LTDLINCL)
18          AC_SUBST(LIBLTDL)
19          AC_LIBTOOL_DLOPEN
20          AC_CONFIG_SUBDIRS(libltdl)
21         ]
22 )
23
24 AM_INIT_AUTOMAKE(dist-bzip2)
25 AC_LANG(C)
26
27 AC_PREFIX_DEFAULT("/opt/collectd")
28
29 AC_SYS_LARGEFILE
30
31 #
32 # Checks for programs.
33 #
34 AC_PROG_CC
35 AC_PROG_CPP
36 AC_PROG_INSTALL
37 AC_PROG_LN_S
38 AC_PROG_MAKE_SET
39 AM_PROG_CC_C_O
40 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
41
42 AC_DISABLE_STATIC
43 AC_PROG_LIBTOOL
44 AC_PROG_LEX
45 AC_PROG_YACC
46 PKG_PROG_PKG_CONFIG
47
48 AC_MSG_CHECKING([for kernel type ($host_os)])
49 case $host_os in
50         *linux*)
51         AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
52         ac_system="Linux"
53         ;;
54         *solaris*)
55         AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
56         ac_system="Solaris"
57         ;;
58         *darwin*)
59         ac_system="Darwin"
60         ;;
61         *openbsd*)
62         ac_system="OpenBSD"
63         ;;
64         *)
65         ac_system="unknown"
66 esac
67 AC_MSG_RESULT([$ac_system])
68
69 if test "x$ac_system" = "xLinux"
70 then
71         AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
72         if test -z "$KERNEL_DIR"
73         then
74                 KERNEL_DIR="/lib/modules/`uname -r`/source"
75         fi
76
77         KERNEL_CFLAGS="-I$KERNEL_DIR/include"
78         AC_SUBST(KERNEL_CFLAGS)
79 fi
80
81 if test "x$ac_system" = "xSolaris"
82 then
83         AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
84 fi
85
86 # Where to install .pc files.
87 pkgconfigdir="${libdir}/pkgconfig"
88 AC_SUBST(pkgconfigdir)
89
90 # Check for standards compliance mode
91 AC_ARG_ENABLE(standards,
92               AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
93               [enable_standards="$enableval"],
94               [enable_standards="no"])
95 if test "x$enable_standards" = "xyes"
96 then
97         AC_DEFINE(_ISOC99_SOURCE,        1, [Define to enforce ISO C99 compliance.])
98         AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Define to enforce POSIX.1-2001 compliance.])
99         AC_DEFINE(_XOPEN_SOURCE,       600, [Define to enforce X/Open 6 (XSI) compliance.])
100         AC_DEFINE(_REENTRANT,            1, [Define to enable reentrancy interfaces.])
101 fi
102 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
103
104 #
105 # Checks for header files.
106 #
107 AC_HEADER_STDC
108 AC_HEADER_SYS_WAIT
109 AC_HEADER_DIRENT
110 AC_HEADER_STDBOOL
111
112 AC_CHECK_HEADERS(stdio.h stdint.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)
113
114 # For ping library
115 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
116 [#if HAVE_STDINT_H
117 # include <stdint.h>
118 #endif
119 #if HAVE_SYS_TYPES_H
120 # include <sys/types.h>
121 #endif
122 ])
123 AC_CHECK_HEADERS(netinet/in.h, [], [],
124 [#if HAVE_STDINT_H
125 # include <stdint.h>
126 #endif
127 #if HAVE_SYS_TYPES_H
128 # include <sys/types.h>
129 #endif
130 #if HAVE_NETINET_IN_SYSTM_H
131 # include <netinet/in_systm.h>
132 #endif
133 ])
134 AC_CHECK_HEADERS(netinet/ip.h, [], [],
135 [#if HAVE_STDINT_H
136 # include <stdint.h>
137 #endif
138 #if HAVE_SYS_TYPES_H
139 # include <sys/types.h>
140 #endif
141 #if HAVE_NETINET_IN_SYSTM_H
142 # include <netinet/in_systm.h>
143 #endif
144 #if HAVE_NETINET_IN_H
145 # include <netinet/in.h>
146 #endif
147 ])
148 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
149 [#if HAVE_STDINT_H
150 # include <stdint.h>
151 #endif
152 #if HAVE_SYS_TYPES_H
153 # include <sys/types.h>
154 #endif
155 #if HAVE_NETINET_IN_SYSTM_H
156 # include <netinet/in_systm.h>
157 #endif
158 #if HAVE_NETINET_IN_H
159 # include <netinet/in.h>
160 #endif
161 #if HAVE_NETINET_IP_H
162 # include <netinet/ip.h>
163 #endif
164 ])
165 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
166 [#if HAVE_STDINT_H
167 # include <stdint.h>
168 #endif
169 #if HAVE_SYS_TYPES_H
170 # include <sys/types.h>
171 #endif
172 #if HAVE_NETINET_IN_SYSTM_H
173 # include <netinet/in_systm.h>
174 #endif
175 #if HAVE_NETINET_IN_H
176 # include <netinet/in.h>
177 #endif
178 #if HAVE_NETINET_IP_H
179 # include <netinet/ip.h>
180 #endif
181 ])
182 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
183 [#if HAVE_STDINT_H
184 # include <stdint.h>
185 #endif
186 #if HAVE_SYS_TYPES_H
187 # include <sys/types.h>
188 #endif
189 #if HAVE_NETINET_IN_SYSTM_H
190 # include <netinet/in_systm.h>
191 #endif
192 #if HAVE_NETINET_IN_H
193 # include <netinet/in.h>
194 #endif
195 ])
196 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
197 [#if HAVE_STDINT_H
198 # include <stdint.h>
199 #endif
200 #if HAVE_SYS_TYPES_H
201 # include <sys/types.h>
202 #endif
203 #if HAVE_NETINET_IN_SYSTM_H
204 # include <netinet/in_systm.h>
205 #endif
206 #if HAVE_NETINET_IN_H
207 # include <netinet/in.h>
208 #endif
209 #if HAVE_NETINET_IP6_H
210 # include <netinet/ip6.h>
211 #endif
212 ])
213 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
214 [#if HAVE_STDINT_H
215 # include <stdint.h>
216 #endif
217 #if HAVE_SYS_TYPES_H
218 # include <sys/types.h>
219 #endif
220 #if HAVE_NETINET_IN_SYSTM_H
221 # include <netinet/in_systm.h>
222 #endif
223 #if HAVE_NETINET_IN_H
224 # include <netinet/in.h>
225 #endif
226 #if HAVE_NETINET_IP_H
227 # include <netinet/ip.h>
228 #endif
229 ])
230 AC_CHECK_HEADERS(netinet/udp.h, [], [],
231 [#if HAVE_STDINT_H
232 # include <stdint.h>
233 #endif
234 #if HAVE_SYS_TYPES_H
235 # include <sys/types.h>
236 #endif
237 #if HAVE_NETINET_IN_SYSTM_H
238 # include <netinet/in_systm.h>
239 #endif
240 #if HAVE_NETINET_IN_H
241 # include <netinet/in.h>
242 #endif
243 #if HAVE_NETINET_IP_H
244 # include <netinet/ip.h>
245 #endif
246 ])
247
248 # For cpu modules
249 AC_CHECK_HEADERS(sys/dkstat.h)
250 if test "x$ac_system" = "xDarwin"
251 then
252         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)
253         AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
254 fi
255 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
256 [
257 #if HAVE_SYS_TYPES_H
258 #  include <sys/types.h>
259 #endif
260 #if HAVE_SYS_PARAM_H
261 # include <sys/param.h>
262 #endif
263 ])
264
265 # For hddtemp module
266 AC_CHECK_HEADERS(linux/major.h libgen.h)
267
268 # For the battery plugin
269 AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
270 [
271 #if HAVE_IOKIT_IOKITLIB_H
272 #  include <IOKit/IOKitLib.h>
273 #endif
274 #if HAVE_IOKIT_IOTYPES_H
275 #  include <IOKit/IOTypes.h>
276 #endif
277 ])
278
279 # For the swap module
280 have_sys_swap_h="yes"
281 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
282 [
283 #undef _FILE_OFFSET_BITS
284 #undef _LARGEFILE64_SOURCE
285 #if HAVE_SYS_TYPES_H
286 #  include <sys/types.h>
287 #endif
288 #if HAVE_SYS_PARAM_H
289 # include <sys/param.h>
290 #endif
291 ])
292
293 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
294 then
295         hint_64=""
296         if test "x$GCC" = "xyes"
297         then
298                 hint_64="CFLAGS='-m64'"
299         else
300                 hint_64="CFLAGS='-xarch=v9'"
301         fi
302         AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
303 fi
304
305 # For load module
306 # For the processes plugin
307 # For users module
308 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
309
310 # For interface plugin
311 AC_CHECK_HEADERS(ifaddrs.h)
312 AC_CHECK_HEADERS(net/if.h, [], [],
313 [
314 #if HAVE_SYS_TYPES_H
315 #  include <sys/types.h>
316 #endif
317 #if HAVE_SYS_SOCKET_H
318 #  include <sys/socket.h>
319 #endif
320 ])
321 AC_CHECK_HEADERS(linux/if.h, [], [],
322 [
323 #if HAVE_SYS_TYPES_H
324 #  include <sys/types.h>
325 #endif
326 #if HAVE_SYS_SOCKET_H
327 #  include <sys/socket.h>
328 #endif
329 ])
330 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
331 [
332 #if HAVE_SYS_TYPES_H
333 #  include <sys/types.h>
334 #endif
335 #if HAVE_SYS_SOCKET_H
336 #  include <sys/socket.h>
337 #endif
338 #if HAVE_LINUX_IF_H
339 # include <linux/if.h>
340 #endif
341 ])
342
343 # For ipvs module
344 have_net_ip_vs_h="no"
345 have_ip_vs_h="no"
346 if test "x$ac_system" = "xLinux"
347 then
348         SAVE_CFLAGS=$CFLAGS
349         CFLAGS="$CFLAGS $KERNEL_CFLAGS"
350
351         AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
352         AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
353
354         CFLAGS=$SAVE_CFLAGS
355 fi
356
357 # For quota module
358 AC_CHECK_HEADERS(sys/ucred.h, [], [],
359 [
360 #if HAVE_SYS_TYPES_H
361 #  include <sys/types.h>
362 #endif
363 #if HAVE_SYS_PARAM_H
364 # include <sys/param.h>
365 #endif
366 ])
367
368 # For mount interface
369 AC_CHECK_HEADERS(sys/mount.h, [], [],
370 [
371 #if HAVE_SYS_TYPES_H
372 #  include <sys/types.h>
373 #endif
374 #if HAVE_SYS_PARAM_H
375 # include <sys/param.h>
376 #endif
377 ])
378
379 # For the email plugin
380 AC_CHECK_HEADERS(linux/un.h, [], [],
381 [
382 #if HAVE_SYS_SOCKET_H
383 #       include <sys/socket.h>
384 #endif
385 ])
386
387 AC_CHECK_HEADERS(pwd.h grp.h sys/un.h ctype.h limits.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)
388
389 # For the dns plugin
390 AC_CHECK_HEADERS(arpa/nameser.h)
391 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
392 [
393 #if HAVE_ARPA_NAMESER_H
394 # include <arpa/nameser.h>
395 #endif
396 ])
397
398 AC_CHECK_HEADERS(net/if_arp.h, [], [],
399 [#if HAVE_SYS_SOCKET_H
400 # include <sys/socket.h>
401 #endif
402 ])
403 AC_CHECK_HEADERS(net/ppp_defs.h)
404 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
405 [#if HAVE_NET_PPP_DEFS_H
406 # include <net/ppp_defs.h>
407 #endif
408 ])
409 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
410 [#if HAVE_STDINT_H
411 # include <stdint.h>
412 #endif
413 #if HAVE_SYS_TYPES_H
414 # include <sys/types.h>
415 #endif
416 #if HAVE_SYS_SOCKET_H
417 # include <sys/socket.h>
418 #endif
419 #if HAVE_NET_IF_H
420 # include <net/if.h>
421 #endif
422 #if HAVE_NETINET_IN_H
423 # include <netinet/in.h>
424 #endif
425 ])
426
427 # For the multimeter plugin
428 have_termios_h="no"
429 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
430
431 #
432 # Checks for typedefs, structures, and compiler characteristics.
433 #
434 AC_C_CONST
435 AC_TYPE_PID_T
436 AC_TYPE_SIZE_T
437 AC_TYPE_UID_T
438 AC_HEADER_TIME
439
440 #
441 # Checks for library functions.
442 #
443 AC_PROG_GCC_TRADITIONAL
444 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf)
445
446 AC_FUNC_STRERROR_R
447
448 AC_CACHE_CHECK([for strtok_r],
449   [c_cv_have_strtok_r_default],
450   AC_LINK_IFELSE(
451     AC_LANG_PROGRAM(
452     [[[[
453 #include <stdlib.h>
454 #include <stdio.h>
455 #include <string.h>
456     ]]]],
457     [[[[
458       char buffer[] = "foo,bar,baz";
459       char *token;
460       char *dummy;
461       char *saveptr;
462
463       dummy = buffer;
464       saveptr = NULL;
465       while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
466       {
467         dummy = NULL;
468         printf ("token = %s;\n", token);
469       }
470     ]]]]),
471     [c_cv_have_strtok_r_default="yes"],
472     [c_cv_have_strtok_r_default="no"]
473   )
474 )
475
476 if test "x$c_cv_have_strtok_r_default" = "xno"
477 then
478   SAVE_CFLAGS="$CFLAGS"
479   CFLAGS="$CFLAGS -D_REENTRANT=1"
480
481   AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
482     [c_cv_have_strtok_r_reentrant],
483     AC_LINK_IFELSE(
484       AC_LANG_PROGRAM(
485       [[[[
486 #include <stdlib.h>
487 #include <stdio.h>
488 #include <string.h>
489       ]]]],
490       [[[[
491         char buffer[] = "foo,bar,baz";
492         char *token;
493         char *dummy;
494         char *saveptr;
495
496         dummy = buffer;
497         saveptr = NULL;
498         while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
499         {
500           dummy = NULL;
501           printf ("token = %s;\n", token);
502         }
503       ]]]]),
504       [c_cv_have_strtok_r_reentrant="yes"],
505       [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
506     )
507   )
508 fi
509
510 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
511
512 socket_needs_socket="no"
513 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
514 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
515
516 nanosleep_needs_rt="no"
517 AC_CHECK_FUNCS(nanosleep, [], AC_CHECK_LIB(rt, nanosleep, [nanosleep_needs_rt="yes"], AC_MSG_ERROR(cannot find nanosleep)))
518 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$nanosleep_needs_rt" = "xyes")
519
520 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
521 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
522 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
523 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
524 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
525 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
526 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
527 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
528 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
529 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
530 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
531 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
532
533 # For load module
534 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
535
536 # Check for NAN
537 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
538 [
539  if test "x$withval" = "xno"; then
540          nan_type="none"
541  else if test "x$withval" = "xyes"; then
542          nan_type="zero"
543  else
544          nan_type="$withval"
545  fi; fi
546 ],
547 [nan_type="none"])
548 if test "x$nan_type" = "xnone"; then
549   AC_CACHE_CHECK([whether NAN is defined by default],
550     [c_cv_have_nan_default],
551     AC_COMPILE_IFELSE(
552       AC_LANG_PROGRAM(
553       [[
554 #include <stdlib.h>
555 #include <math.h>
556 static float foo = NAN;
557       ]],
558       [[
559        if (isnan (foo))
560         return 0;
561        else
562         return 1;
563       ]]),
564       [c_cv_have_nan_default="yes"],
565       [c_cv_have_nan_default="no"]
566     )
567   )
568   if test "x$c_cv_have_nan_default" = "xyes"
569   then
570     nan_type="default"
571   fi
572 fi
573 if test "x$nan_type" = "xnone"; then
574   AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
575     [c_cv_have_nan_isoc],
576     AC_COMPILE_IFELSE(
577       AC_LANG_PROGRAM(
578       [[
579 #include <stdlib.h>
580 #define __USE_ISOC99 1
581 #include <math.h>
582 static float foo = NAN;
583       ]],
584       [[
585        if (isnan (foo))
586         return 0;
587        else
588         return 1;
589       ]]),
590       [c_cv_have_nan_isoc="yes"],
591       [c_cv_have_nan_isoc="no"]
592     )
593   )
594   if test "x$c_cv_have_nan_isoc" = "xyes"
595   then
596     nan_type="isoc99"
597   fi
598 fi
599 if test "x$nan_type" = "xnone"; then
600   AC_CACHE_CHECK([whether NAN can be defined by 0/0],
601     [c_cv_have_nan_zero],
602     AC_RUN_IFELSE(
603       AC_LANG_PROGRAM(
604       [[
605 #include <stdlib.h>
606 #include <math.h>
607 #ifdef NAN
608 # undef NAN
609 #endif
610 #define NAN (0.0 / 0.0)
611 #ifndef isnan
612 # define isnan(f) ((f) != (f))
613 #endif
614 static float foo = NAN;
615       ]],
616       [[
617        if (isnan (foo))
618         return 0;
619        else
620         return 1;
621       ]]),
622       [c_cv_have_nan_zero="yes"],
623       [c_cv_have_nan_zero="no"]
624     )
625   )
626   if test "x$c_cv_have_nan_zero" = "xyes"
627   then
628     nan_type="zero"
629   fi
630 fi
631
632 if test "x$nan_type" = "xdefault"; then
633   AC_DEFINE(NAN_STATIC_DEFAULT, 1,
634     [Define if NAN is defined by default and can initialize static variables.])
635 else if test "x$nan_type" = "xisoc99"; then
636   AC_DEFINE(NAN_STATIC_ISOC, 1,
637     [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
638 else if test "x$nan_type" = "xzero"; then
639   AC_DEFINE(NAN_ZERO_ZERO, 1,
640     [Define if NAN can be defined as (0.0 / 0.0)])
641 else
642   AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
643 fi; fi; fi
644
645 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
646 [
647  if test "x$withval" = "xnothing"; then
648         fp_layout_type="nothing"
649  else if test "x$withval" = "xendianflip"; then
650         fp_layout_type="endianflip"
651  else if test "x$withval" = "xintswap"; then
652         fp_layout_type="intswap"
653  else
654         AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
655 fi; fi; fi
656 ],
657 [fp_layout_type="unknown"])
658
659 if test "x$fp_layout_type" = "xunknown"; then
660   AC_CACHE_CHECK([if doubles are stored in x86 representation],
661     [c_cv_fp_layout_need_nothing],
662     AC_RUN_IFELSE(
663       AC_LANG_PROGRAM(
664       [[[[
665 #include <stdlib.h>
666 #include <stdio.h>
667 #include <string.h>
668 #if HAVE_STDINT_H
669 # include <stdint.h>
670 #endif
671 #if HAVE_STDBOOL_H
672 # include <stdbool.h>
673 #endif
674       ]]]],
675       [[[[
676         uint64_t i0;
677         uint64_t i1;
678         uint8_t c[8];
679         double d;
680
681         d = 8.642135e130; 
682         memcpy ((void *) &i0, (void *) &d, 8);
683
684         i1 = i0;
685         memcpy ((void *) c, (void *) &i1, 8);
686
687         if ((c[0] == 0x2f) && (c[1] == 0x25)
688                         && (c[2] == 0xc0) && (c[3] == 0xc7)
689                         && (c[4] == 0x43) && (c[5] == 0x2b)
690                         && (c[6] == 0x1f) && (c[7] == 0x5b))
691                 return (0);
692         else
693                 return (1);
694       ]]]]),
695       [c_cv_fp_layout_need_nothing="yes"],
696       [c_cv_fp_layout_need_nothing="no"]
697     )
698   )
699   if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
700     fp_layout_type="nothing"
701   fi
702 fi
703 if test "x$fp_layout_type" = "xunknown"; then
704   AC_CACHE_CHECK([if endianflip converts to x86 representation],
705     [c_cv_fp_layout_need_endianflip],
706     AC_RUN_IFELSE(
707       AC_LANG_PROGRAM(
708       [[[[
709 #include <stdlib.h>
710 #include <stdio.h>
711 #include <string.h>
712 #if HAVE_STDINT_H
713 # include <stdint.h>
714 #endif
715 #if HAVE_STDBOOL_H
716 # include <stdbool.h>
717 #endif
718 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
719                        (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
720                        (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
721                        (((uint64_t)(A) & 0x000000ff00000000LL) >> 8)  | \
722                        (((uint64_t)(A) & 0x00000000ff000000LL) << 8)  | \
723                        (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
724                        (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
725                        (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
726       ]]]],
727       [[[[
728         uint64_t i0;
729         uint64_t i1;
730         uint8_t c[8];
731         double d;
732
733         d = 8.642135e130; 
734         memcpy ((void *) &i0, (void *) &d, 8);
735
736         i1 = endianflip (i0);
737         memcpy ((void *) c, (void *) &i1, 8);
738
739         if ((c[0] == 0x2f) && (c[1] == 0x25)
740                         && (c[2] == 0xc0) && (c[3] == 0xc7)
741                         && (c[4] == 0x43) && (c[5] == 0x2b)
742                         && (c[6] == 0x1f) && (c[7] == 0x5b))
743                 return (0);
744         else
745                 return (1);
746       ]]]]),
747       [c_cv_fp_layout_need_endianflip="yes"],
748       [c_cv_fp_layout_need_endianflip="no"]
749     )
750   )
751   if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
752     fp_layout_type="endianflip"
753   fi
754 fi
755 if test "x$fp_layout_type" = "xunknown"; then
756   AC_CACHE_CHECK([if intswap converts to x86 representation],
757     [c_cv_fp_layout_need_intswap],
758     AC_RUN_IFELSE(
759       AC_LANG_PROGRAM(
760       [[[[
761 #include <stdlib.h>
762 #include <stdio.h>
763 #include <string.h>
764 #if HAVE_STDINT_H
765 # include <stdint.h>
766 #endif
767 #if HAVE_STDBOOL_H
768 # include <stdbool.h>
769 #endif
770 #define intswap(A)    ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
771                        (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
772       ]]]],
773       [[[[
774         uint64_t i0;
775         uint64_t i1;
776         uint8_t c[8];
777         double d;
778
779         d = 8.642135e130; 
780         memcpy ((void *) &i0, (void *) &d, 8);
781
782         i1 = intswap (i0);
783         memcpy ((void *) c, (void *) &i1, 8);
784
785         if ((c[0] == 0x2f) && (c[1] == 0x25)
786                         && (c[2] == 0xc0) && (c[3] == 0xc7)
787                         && (c[4] == 0x43) && (c[5] == 0x2b)
788                         && (c[6] == 0x1f) && (c[7] == 0x5b))
789                 return (0);
790         else
791                 return (1);
792       ]]]]),
793       [c_cv_fp_layout_need_intswap="yes"],
794       [c_cv_fp_layout_need_intswap="no"]
795     )
796   )
797   if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
798     fp_layout_type="intswap"
799   fi
800 fi
801
802 if test "x$fp_layout_type" = "xnothing"; then
803   AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
804   [Define if doubles are stored in x86 representation.])
805 else if test "x$fp_layout_type" = "xendianflip"; then
806   AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
807   [Define if endianflip is needed to convert to x86 representation.])
808 else if test "x$fp_layout_type" = "xintswap"; then
809   AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
810   [Define if intswap is needed to convert to x86 representation.])
811 else
812   AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
813 fi; fi; fi
814
815 have_getfsstat="no"
816 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
817 have_getvfsstat="no"
818 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
819 have_listmntent="no"
820 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
821
822 have_getmntent="no"
823 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
824 if test "x$have_getmntent" = "xno"; then
825         AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
826 fi
827 if test "x$have_getmntent" = "xno"; then
828         AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
829 fi
830 if test "x$have_getmntent" = "xno"; then
831         AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
832 fi
833
834 if test "x$have_getmntent" = "xc"; then
835         AC_CACHE_CHECK([whether getmntent takes one argument],
836                 [c_cv_have_one_getmntent],
837                 AC_COMPILE_IFELSE(
838                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
839 #include "$srcdir/src/utils_mount.h"]],
840                                 [[
841                                  FILE *fh;
842                                  struct mntent *me;
843                                  fh = setmntent ("/etc/mtab", "r");
844                                  me = getmntent (fh);
845                                 ]]
846                         ),
847                         [c_cv_have_one_getmntent="yes"],
848                         [c_cv_have_one_getmntent="no"]
849                 )
850         )
851         AC_CACHE_CHECK([whether getmntent takes two arguments],
852                 [c_cv_have_two_getmntent],
853                 AC_COMPILE_IFELSE(
854                         AC_LANG_PROGRAM([[AC_INCLUDES_DEFAULT
855 #include "$srcdir/src/utils_mount.h"]],
856                                 [[
857                                  FILE *fh;
858                                  struct mnttab mt;
859                                  int status;
860                                  fh = fopen ("/etc/mnttab", "r");
861                                  status = getmntent (fh, &mt);
862                                 ]]
863                         ),
864                         [c_cv_have_two_getmntent="yes"],
865                         [c_cv_have_two_getmntent="no"]
866                 )
867         )
868 fi
869
870 # Check for different versions of `getmntent' here..
871
872 if test "x$have_getmntent" = "xc"; then
873         if test "x$c_cv_have_one_getmntent" = "xyes"; then
874                 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
875                           [Define if the function getmntent exists and takes one argument.])
876         fi
877         if test "x$c_cv_have_two_getmntent" = "xyes"; then
878                 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
879                           [Define if the function getmntent exists and takes two arguments.])
880         fi
881 fi
882 if test "x$have_getmntent" = "xsun"; then
883         AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
884                   [Define if the function getmntent exists. It's the version from libsun.])
885 fi
886 if test "x$have_getmntent" = "xseq"; then
887         AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
888                   [Define if the function getmntent exists. It's the version from libseq.])
889 fi
890 if test "x$have_getmntent" = "xgen"; then
891         AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
892                   [Define if the function getmntent exists. It's the version from libgen.])
893 fi
894
895 # Check for structures
896 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
897         [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
898         [],
899         [
900         #include <sys/types.h>
901         #include <sys/socket.h>
902         #include <net/if.h>
903         ])
904 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
905         [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
906         [],
907         [
908         #include <sys/types.h>
909         #include <sys/socket.h>
910         #include <linux/if.h>
911         #include <linux/netdevice.h>
912         ])
913
914 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
915         [
916                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
917                         [Define if struct kinfo_proc exists in the FreeBSD variant.])
918                 have_struct_kinfo_proc_freebsd="yes"
919         ],
920         [
921                 have_struct_kinfo_proc_freebsd="no"
922         ],
923         [
924 #include <kvm.h>
925 #include <sys/param.h>
926 #include <sys/sysctl.h>
927 #include <sys/user.h>
928         ])
929
930 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
931         [
932                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
933                         [Define if struct kinfo_proc exists in the OpenBSD variant.])
934                 have_struct_kinfo_proc_openbsd="yes"
935         ],
936         [
937                 have_struct_kinfo_proc_openbsd="no"
938         ],
939         [
940 #include <sys/param.h>
941 #include <sys/sysctl.h>
942 #include <kvm.h>
943         ])
944
945 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
946 [#define _BSD_SOURCE
947 #if HAVE_STDINT_H
948 # include <stdint.h>
949 #endif
950 #if HAVE_SYS_TYPES_H
951 # include <sys/types.h>
952 #endif
953 #if HAVE_NETINET_IN_SYSTM_H
954 # include <netinet/in_systm.h>
955 #endif
956 #if HAVE_NETINET_IN_H
957 # include <netinet/in.h>
958 #endif
959 #if HAVE_NETINET_IP_H
960 # include <netinet/ip.h>
961 #endif
962 #if HAVE_NETINET_UDP_H
963 # include <netinet/udp.h>
964 #endif
965 ])
966 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
967 [#define _BSD_SOURCE
968 #if HAVE_STDINT_H
969 # include <stdint.h>
970 #endif
971 #if HAVE_SYS_TYPES_H
972 # include <sys/types.h>
973 #endif
974 #if HAVE_NETINET_IN_SYSTM_H
975 # include <netinet/in_systm.h>
976 #endif
977 #if HAVE_NETINET_IN_H
978 # include <netinet/in.h>
979 #endif
980 #if HAVE_NETINET_IP_H
981 # include <netinet/ip.h>
982 #endif
983 #if HAVE_NETINET_UDP_H
984 # include <netinet/udp.h>
985 #endif
986 ])
987
988 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
989         [],
990         [],
991         [
992 #if HAVE_KSTAT_H
993 # include <kstat.h>
994 #endif
995         ])
996
997 #
998 # Checks for libraries begin here
999 #
1000 with_libresolv="yes"
1001 AC_CHECK_LIB(resolv, res_search,
1002 [
1003         AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1004 ],
1005 [with_libresolv="no"])
1006 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1007
1008 dnl Check for HAL (hardware abstraction library)
1009 with_libhal="yes"
1010 AC_CHECK_LIB(hal,libhal_device_property_exists,
1011              [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1012              [with_libhal="no"])
1013 if test "x$with_libhal" = "xyes"; then
1014         if test "x$PKG_CONFIG" != "x"; then
1015                 BUILD_WITH_LIBHAL_CFLAGS="`pkg-config --cflags hal`"
1016                 BUILD_WITH_LIBHAL_LIBS="`pkg-config --libs hal`"
1017                 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1018                 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1019         fi
1020 fi
1021
1022 m4_divert_once([HELP_WITH], [
1023 collectd additional packages:])
1024
1025 if test "x$ac_system" = "xSolaris"
1026 then
1027         with_kstat="yes"
1028         with_devinfo="yes"
1029 else
1030         with_kstat="no (Solaris only)"
1031         with_devinfo="no (Solaris only)"
1032 fi
1033
1034 if test "x$with_kstat" = "xyes"
1035 then
1036         AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1037 fi
1038 if test "x$with_kstat" = "xyes"
1039 then
1040         AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1041         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1042 fi
1043 if test "x$with_kstat" = "xyes"
1044 then
1045         AC_DEFINE(HAVE_LIBKSTAT, 1,
1046                   [Define to 1 if you have the 'kstat' library (-lkstat)])
1047 fi
1048 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1049 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1050
1051 with_libiokit="no"
1052 AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices,
1053 [
1054         with_libiokit="yes"
1055 ], 
1056 [
1057         with_libiokit="no"
1058 ])
1059 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1060
1061 with_libkvm="no"
1062 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1063 if test "x$with_kvm_getprocs" = "xyes"
1064 then
1065         AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1066                   [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1067         with_libkvm="yes"
1068 fi
1069 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1070
1071 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1072 if test "x$with_kvm_getswapinfo" = "xyes"
1073 then
1074         AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1075                   [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1076         with_libkvm="yes"
1077 fi
1078 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1079
1080 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1081 if test "x$with_kvm_nlist" = "xyes"
1082 then
1083         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1084                   [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1085         with_libkvm="yes"
1086 fi
1087 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1088
1089 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1090 if test "x$with_kvm_openfiles" = "xyes"
1091 then
1092         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1093                   [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1094         with_libkvm="yes"
1095 fi
1096 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1097
1098 # --with-libcurl {{{
1099 with_curl_config="curl-config"
1100 with_curl_cflags=""
1101 with_curl_libs=""
1102 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1103 [
1104         if test "x$withval" = "xno"
1105         then
1106                 with_libcurl="no"
1107         else if test "x$withval" = "xyes"
1108         then
1109                 with_libcurl="yes"
1110         else
1111                 if test -f "$withval" && test -x "$withval"
1112                 then
1113                         with_curl_config="$withval"
1114                         with_libcurl="yes"
1115                 else if test -x "$withval/bin/curl-config"
1116                 then
1117                         with_curl_config="$withval/bin/curl-config"
1118                         with_libcurl="yes"
1119                 fi; fi
1120                 with_libcurl="yes"
1121         fi; fi
1122 ],
1123 [
1124         with_libcurl="yes"
1125 ])
1126 if test "x$with_libcurl" = "xyes"
1127 then
1128         with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1129         curl_config_status=$?
1130
1131         if test $curl_config_status -ne 0
1132         then
1133                 with_libcurl="no ($with_curl_config failed)"
1134         else
1135                 SAVE_CPPFLAGS="$CPPFLAGS"
1136                 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1137
1138                 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1139
1140                 CPPFLAGS="$SAVE_CPPFLAGS"
1141         fi
1142 fi
1143 if test "x$with_libcurl" = "xyes"
1144 then
1145         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1146         curl_config_status=$?
1147
1148         if test $curl_config_status -ne 0
1149         then
1150                 with_libcurl="no ($with_curl_config failed)"
1151         else
1152                 AC_CHECK_LIB(curl, curl_easy_init,
1153                  [with_libcurl="yes"],
1154                  [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1155                  [$with_curl_libs])
1156         fi
1157 fi
1158 if test "x$with_libcurl" = "xyes"
1159 then
1160         BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1161         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1162         AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1163         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1164 fi
1165 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1166 # }}}
1167
1168 # --with-libdbi {{{
1169 with_libdbi_cppflags=""
1170 with_libdbi_ldflags=""
1171 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1172 [
1173         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1174         then
1175                 with_libdbi_cppflags="-I$withval/include"
1176                 with_libdbi_ldflags="-L$withval/lib"
1177                 with_libdbi="yes"
1178         else
1179                 with_libdbi="$withval"
1180         fi
1181 ],
1182 [
1183         with_libdbi="yes"
1184 ])
1185 if test "x$with_libdbi" = "xyes"
1186 then
1187         SAVE_CPPFLAGS="$CPPFLAGS"
1188         CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1189
1190         AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1191
1192         CPPFLAGS="$SAVE_CPPFLAGS"
1193 fi
1194 if test "x$with_libdbi" = "xyes"
1195 then
1196         SAVE_CPPFLAGS="$CPPFLAGS"
1197         SAVE_LDFLAGS="$LDFLAGS"
1198         CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1199         LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1200
1201         AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1202
1203         CPPFLAGS="$SAVE_CPPFLAGS"
1204         LDFLAGS="$SAVE_LDFLAGS"
1205 fi
1206 if test "x$with_libdbi" = "xyes"
1207 then
1208         BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1209         BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1210         BUILD_WITH_LIBDBI_LIBS="-ldbi"
1211         AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1212         AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1213         AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1214 fi
1215 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1216 # }}}
1217
1218 # --with-libesmtp {{{
1219 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1220 [
1221         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1222         then
1223                 LDFLAGS="$LDFLAGS -L$withval/lib"
1224                 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1225                 with_libesmtp="yes"
1226         else
1227                 with_libesmtp="$withval"
1228         fi
1229 ],
1230 [
1231         with_libesmtp="yes"
1232 ])
1233 if test "x$with_libesmtp" = "xyes"
1234 then
1235         AC_CHECK_LIB(esmtp, smtp_create_session,
1236         [
1237                 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1238         ], [with_libesmtp="no (libesmtp not found)"])
1239 fi
1240 if test "x$with_libesmtp" = "xyes"
1241 then
1242         AC_CHECK_HEADERS(libesmtp.h,
1243         [
1244                 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1245         ], [with_libesmtp="no (libesmtp.h not found)"])
1246 fi
1247 if test "x$with_libesmtp" = "xyes"
1248 then
1249         collect_libesmtp=1
1250 else
1251         collect_libesmtp=0
1252 fi
1253 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1254         [Wether or not to use the esmtp library])
1255 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1256 # }}}
1257
1258 # --with-libganglia {{{
1259 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1260 [
1261  if test -f "$withval" && test -x "$withval"
1262  then
1263          with_libganglia_config="$withval"
1264          with_libganglia="yes"
1265  else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1266  then
1267          with_libganglia_config="$withval/bin/ganglia-config"
1268          with_libganglia="yes"
1269  else if test -d "$withval"
1270  then
1271          GANGLIA_CPPFLAGS="-I$withval/include"
1272          GANGLIA_LDFLAGS="-L$withval/lib"
1273          with_libganglia="yes"
1274  else
1275          with_libganglia_config="ganglia-config"
1276          with_libganglia="$withval"
1277  fi; fi; fi
1278 ],
1279 [
1280  with_libganglia_config="ganglia-config"
1281  with_libganglia="yes"
1282 ])
1283
1284 if test "x$with_libganglia" = "xyes" && test "x$with_libganglia_config" != "x"
1285 then
1286         if test "x$GANGLIA_CPPFLAGS" = "x"
1287         then
1288                 GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1289         fi
1290
1291         if test "x$GANGLIA_LDFLAGS" = "x"
1292         then
1293                 GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1294         fi
1295
1296         if test "x$GANGLIA_LIBS" = "x"
1297         then
1298                 GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1299         fi
1300 fi
1301
1302 SAVE_CPPFLAGS="$CPPFLAGS"
1303 SAVE_LDFLAGS="$LDFLAGS"
1304 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1305 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1306
1307 if test "x$with_libganglia" = "xyes"
1308 then
1309         AC_CHECK_HEADERS(gm_protocol.h,
1310         [
1311                 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1312                           [Define to 1 if you have the <gm_protocol.h> header file.])
1313         ], [with_libganglia="no (gm_protocol.h not found)"])
1314 fi
1315
1316 if test "x$with_libganglia" = "xyes"
1317 then
1318         AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1319         [
1320                 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1321                           [Define to 1 if you have the ganglia library (-lganglia).])
1322         ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1323 fi
1324
1325 CPPFLAGS="$SAVE_CPPFLAGS"
1326 LDFLAGS="$SAVE_LDFLAGS"
1327
1328 AC_SUBST(GANGLIA_CPPFLAGS)
1329 AC_SUBST(GANGLIA_LDFLAGS)
1330 AC_SUBST(GANGLIA_LIBS)
1331 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1332 # }}}
1333
1334 # --with-libgcrypt {{{
1335 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1336 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1337 GCRYPT_LIBS="$GCRYPT_LIBS"
1338 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1339 [
1340  if test -f "$withval" && test -x "$withval"
1341  then
1342          with_libgcrypt_config="$withval"
1343          with_libgcrypt="yes"
1344  else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1345  then
1346          with_libgcrypt_config="$withval/bin/gcrypt-config"
1347          with_libgcrypt="yes"
1348  else if test -d "$withval"
1349  then
1350          GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1351          GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1352          with_libgcrypt="yes"
1353  else
1354          with_libgcrypt_config="gcrypt-config"
1355          with_libgcrypt="$withval"
1356  fi; fi; fi
1357 ],
1358 [
1359  with_libgcrypt_config="libgcrypt-config"
1360  with_libgcrypt="yes"
1361 ])
1362
1363 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1364 then
1365         if test "x$GCRYPT_CPPFLAGS" = "x"
1366         then
1367                 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1368         fi
1369
1370         if test "x$GCRYPT_LDFLAGS" = "x"
1371         then
1372                 gcrypt_exec_prefix=`"$with_libgcrypt_config" --exec-prefix 2>/dev/null`
1373                 GCRYPT_LDFLAGS="-L$gcrypt_exec_prefix/lib"
1374         fi
1375
1376         if test "x$GCRYPT_LIBS" = "x"
1377         then
1378                 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1379         fi
1380 fi
1381
1382 SAVE_CPPFLAGS="$CPPFLAGS"
1383 SAVE_LDFLAGS="$LDFLAGS"
1384 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1385 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1386
1387 if test "x$with_libgcrypt" = "xyes"
1388 then
1389         if test "x$GCRYPT_CPPFLAGS" != "x"
1390         then
1391                 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1392         fi
1393         AC_CHECK_HEADERS(gcrypt.h,
1394                 [with_libgcrypt="yes"],
1395                 [with_libgcrypt="no (gcrypt.h not found)"])
1396 fi
1397
1398 if test "x$with_libgcrypt" = "xyes"
1399 then
1400         if test "x$GCRYPT_LDFLAGS" != "x"
1401         then
1402                 AC_MSG_NOTICE([gcrypt LDFLAGS: $GCRYPT_LDFLAGS])
1403         fi
1404         AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1405                 [with_libgcrypt="yes"],
1406                 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1407
1408         if test "$with_libgcrypt" != "no"; then
1409                 AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")
1410         fi
1411 fi
1412
1413 CPPFLAGS="$SAVE_CPPFLAGS"
1414 LDFLAGS="$SAVE_LDFLAGS"
1415
1416 if test "x$with_libgcrypt" = "xyes"
1417 then
1418         AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
1419 fi
1420
1421 AC_SUBST(GCRYPT_CPPFLAGS)
1422 AC_SUBST(GCRYPT_LDFLAGS)
1423 AC_SUBST(GCRYPT_LIBS)
1424 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
1425 # }}}
1426
1427 # --with-libiptc {{{
1428 with_own_libiptc="no"
1429 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
1430 [
1431         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1432         then
1433                 LDFLAGS="$LDFLAGS -L$withval/lib"
1434                 CPPFLAGS="$CPPFLAGS -I$withval/include"
1435                 with_libiptc="yes"
1436         else
1437                 with_libiptc="$withval"
1438         fi
1439 ],
1440 [
1441         if test "x$ac_system" = "xLinux"
1442         then
1443                 with_libiptc="yes"
1444         else
1445                 with_libiptc="no (Linux only)"
1446         fi
1447 ])
1448 if test "x$with_libiptc" = "xyes"
1449 then
1450         AC_CHECK_LIB(iptc, iptc_init,
1451         [
1452                 AC_DEFINE(HAVE_LIBIPTC, 1, [Define to 1 if you have the iptc library (-liptc).])
1453         ],
1454         [
1455                 with_libiptc="yes"
1456                 with_own_libiptc="yes"
1457         ])
1458 fi
1459 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" != "xyes"
1460 then
1461         AC_CHECK_HEADERS(libiptc/libiptc.h,
1462         [
1463                 AC_DEFINE(HAVE_LIBIPTC_LIBIPTC_H, 1, [Define to 1 if you have the <libiptc/libiptc.h> header file.])
1464         ],
1465         [
1466                 with_libiptc="yes"
1467                 with_own_libiptc="yes"
1468         ])
1469 fi
1470 if test "x$with_libiptc" = "xyes"
1471 then
1472         SAVE_CFLAGS=$CFLAGS
1473         CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1474
1475         AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h, [],
1476         [
1477                 with_libiptc="no (Linux iptables headers not found - check KERNEL_DIR)"
1478                 with_own_libiptc="no"
1479         ],
1480         [
1481 #include "$srcdir/src/libiptc/ipt_kernel_headers.h"
1482         ])
1483
1484         CFLAGS=$SAVE_CFLAGS
1485 fi
1486 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
1487 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_own_libiptc" = "xyes")
1488 if test "x$with_own_libiptc" = "xyes"
1489 then
1490         AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
1491 fi
1492 # }}}
1493
1494 # --with-java {{{
1495 with_java_home="$JAVA_HOME"
1496 with_java_vmtype="client"
1497 with_java_cflags=""
1498 with_java_libs=""
1499 JAVAC="$JAVAC"
1500 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1501 [
1502         if test "x$withval" = "xno"
1503         then
1504                 with_java="no"
1505         else if test "x$withval" = "xyes"
1506         then
1507                 with_java="yes"
1508         else
1509                 with_java_home="$withval"
1510                 with_java="yes"
1511         fi; fi
1512 ],
1513 [with_java="yes"])
1514 if test "x$with_java" = "xyes"
1515 then
1516         if test -d "$with_java_home"
1517         then
1518                 AC_MSG_CHECKING([for jni.h])
1519                 TMPDIR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1520                 if test "x$TMPDIR" != "x"
1521                 then
1522                         AC_MSG_RESULT([found in $TMPDIR])
1523                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1524                 else
1525                         AC_MSG_RESULT([not found])
1526                 fi
1527
1528                 AC_MSG_CHECKING([for jni_md.h])
1529                 TMPDIR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1530                 if test "x$TMPDIR" != "x"
1531                 then
1532                         AC_MSG_RESULT([found in $TMPDIR])
1533                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1534                 else
1535                         AC_MSG_RESULT([not found])
1536                 fi
1537
1538                 AC_MSG_CHECKING([for libjvm.so])
1539                 TMPDIR=`find -L "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1540                 if test "x$TMPDIR" != "x"
1541                 then
1542                         AC_MSG_RESULT([found in $TMPDIR])
1543                         JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1544                 else
1545                         AC_MSG_RESULT([not found])
1546                 fi
1547
1548                 if test "x$JAVAC" = "x"
1549                 then
1550                         AC_MSG_CHECKING([for javac])
1551                         TMPDIR=`find -L "$with_java_home" -name javac -type f | head -n 1`
1552                         if test "x$TMPDIR" != "x"
1553                         then
1554                                 JAVAC="$TMPDIR"
1555                                 AC_MSG_RESULT([$JAVAC])
1556                         else
1557                                 AC_MSG_RESULT([not found])
1558                         fi
1559                 fi
1560         else if test "x$with_java_home" != "x"
1561         then
1562                 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1563         fi; fi
1564 fi
1565
1566 if test "x$JAVA_CPPFLAGS" != "x"
1567 then
1568         AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1569 fi
1570 if test "x$JAVA_CFLAGS" != "x"
1571 then
1572         AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1573 fi
1574 if test "x$JAVA_LDFLAGS" != "x"
1575 then
1576         AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1577 fi
1578 if test "x$JAVAC" = "x"
1579 then
1580         with_javac_path="$PATH"
1581         if test "x$with_java_home" != "x"
1582         then
1583                 with_javac_path="$with_java_home:with_javac_path"
1584                 if test -d "$with_java_home/bin"
1585                 then
1586                         with_javac_path="$with_java_home/bin:with_javac_path"
1587                 fi
1588         fi
1589
1590         AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1591 fi
1592 if test "x$JAVAC" = "x"
1593 then
1594         with_java="no (javac not found)"
1595 fi
1596
1597 SAVE_CPPFLAGS="$CPPFLAGS"
1598 SAVE_CFLAGS="$CFLAGS"
1599 SAVE_LDFLAGS="$LDFLAGS"
1600 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1601 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1602 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1603
1604 if test "x$with_java" = "xyes"
1605 then
1606         AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1607 fi
1608 if test "x$with_java" = "xyes"
1609 then
1610         AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1611         [with_java="yes"],
1612         [with_java="no (libjvm not found)"],
1613         [$JAVA_LIBS])
1614 fi
1615 if test "x$with_java" = "xyes"
1616 then
1617         JAVA_LIBS="$JAVA_LIBS -ljvm"
1618         AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1619 fi
1620
1621 CPPFLAGS="$SAVE_CPPFLAGS"
1622 CFLAGS="$SAVE_CFLAGS"
1623 LDFLAGS="$SAVE_LDFLAGS"
1624
1625 AC_SUBST(JAVA_CPPFLAGS)
1626 AC_SUBST(JAVA_CFLAGS)
1627 AC_SUBST(JAVA_LDFLAGS)
1628 AC_SUBST(JAVA_LIBS)
1629 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1630 # }}}
1631
1632 # --with-libmemcached {{{
1633 with_libmemcached_cppflags=""
1634 with_libmemcached_ldflags=""
1635 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1636 [
1637         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1638         then
1639                 with_libmemcached_cppflags="-I$withval/include"
1640                 with_libmemcached_ldflags="-L$withval/lib"
1641                 with_libmemcached="yes"
1642         else
1643                 with_libmemcached="$withval"
1644         fi
1645 ],
1646 [
1647         with_libmemcached="yes"
1648 ])
1649 if test "x$with_libmemcached" = "xyes"
1650 then
1651         SAVE_CPPFLAGS="$CPPFLAGS"
1652         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1653
1654         AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1655
1656         CPPFLAGS="$SAVE_CPPFLAGS"
1657 fi
1658 if test "x$with_libmemcached" = "xyes"
1659 then
1660         SAVE_CPPFLAGS="$CPPFLAGS"
1661         SAVE_LDFLAGS="$LDFLAGS"
1662         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1663         LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1664
1665         AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1666
1667         CPPFLAGS="$SAVE_CPPFLAGS"
1668         LDFLAGS="$SAVE_LDFLAGS"
1669 fi
1670 if test "x$with_libmemcached" = "xyes"
1671 then
1672         BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1673         BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1674         BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1675         AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1676         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1677         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1678         AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1679 fi
1680 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1681 # }}}
1682
1683 # --with-libmysql {{{
1684 with_mysql_config="mysql_config"
1685 with_mysql_cflags=""
1686 with_mysql_libs=""
1687 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1688 [
1689         if test "x$withval" = "xno"
1690         then
1691                 with_libmysql="no"
1692         else if test "x$withval" = "xyes"
1693         then
1694                 with_libmysql="yes"
1695         else
1696                 if test -f "$withval" && test -x "$withval";
1697                 then
1698                         with_mysql_config="$withval"
1699                 else if test -x "$withval/bin/mysql_config"
1700                 then
1701                         with_mysql_config="$withval/bin/mysql_config"
1702                 fi; fi
1703                 with_libmysql="yes"
1704         fi; fi
1705 ],
1706 [
1707         with_libmysql="yes"
1708 ])
1709 if test "x$with_libmysql" = "xyes"
1710 then
1711         with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1712         mysql_config_status=$?
1713
1714         if test $mysql_config_status -ne 0
1715         then
1716                 with_libmysql="no ($with_mysql_config failed)"
1717         else
1718                 SAVE_CPPFLAGS="$CPPFLAGS"
1719                 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1720
1721                 have_mysql_h="no"
1722                 have_mysql_mysql_h="no"
1723                 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1724
1725                 if test "x$have_mysql_h" = "xno"
1726                 then
1727                         AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1728                 fi
1729
1730                 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1731                 then
1732                         with_libmysql="no (mysql.h not found)"
1733                 fi
1734
1735                 CPPFLAGS="$SAVE_CPPFLAGS"
1736         fi
1737 fi
1738 if test "x$with_libmysql" = "xyes"
1739 then
1740         with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1741         mysql_config_status=$?
1742
1743         if test $mysql_config_status -ne 0
1744         then
1745                 with_libmysql="no ($with_mysql_config failed)"
1746         else
1747                 AC_CHECK_LIB(mysqlclient, mysql_init,
1748                  [with_libmysql="yes"],
1749                  [with_libmysql="no (symbol 'mysql_init' not found)"],
1750                  [$with_mysql_libs])
1751
1752                 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
1753                  [with_libmysql="yes"],
1754                  [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
1755                  [$with_mysql_libs])
1756         fi
1757 fi
1758 if test "x$with_libmysql" = "xyes"
1759 then
1760         BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1761         BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1762         AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1763         AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1764 fi
1765 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1766 # }}}
1767
1768 # --with-libnetlink {{{
1769 with_libnetlink_cflags=""
1770 with_libnetlink_libs="-lnetlink"
1771 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1772 [
1773  echo "libnetlink: withval = $withval"
1774  if test "x$withval" = "xyes"
1775  then
1776          with_libnetlink="yes"
1777  else if test "x$withval" = "xno"
1778  then
1779          with_libnetlink="no"
1780  else
1781          if test -d "$withval/include"
1782          then
1783                  with_libnetlink_cflags="-I$withval/include"
1784                  with_libnetlink_libs="-L$withval/lib -lnetlink"
1785                  with_libnetlink="yes"
1786          else
1787                  AC_MSG_ERROR("no such directory: $withval/include")
1788          fi
1789  fi; fi
1790 ],
1791 [
1792  if test "x$ac_system" = "xLinux"
1793  then
1794          with_libnetlink="yes"
1795  else
1796          with_libnetlink="no (Linux only library)"
1797  fi
1798 ])
1799 if test "x$with_libnetlink" = "xyes"
1800 then
1801         SAVE_CFLAGS=$CFLAGS
1802         CFLAGS="$CFLAGS $with_libnetlink_cflags"
1803
1804         with_libnetlink="no (libnetlink.h not found)"
1805
1806         AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1807         [
1808          with_libnetlink="yes"
1809          break
1810         ], [],
1811 [#include <stdio.h>
1812 #include <sys/types.h>
1813 #include <asm/types.h>
1814 #include <sys/socket.h>
1815 #include <linux/netlink.h>
1816 #include <linux/rtnetlink.h>])
1817         AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1818 [#include <stdio.h>
1819 #include <sys/types.h>
1820 #include <asm/types.h>
1821 #include <sys/socket.h>])
1822
1823         AC_COMPILE_IFELSE(
1824 [#include <stdio.h>
1825 #include <sys/types.h>
1826 #include <asm/types.h>
1827 #include <sys/socket.h>
1828 #include <linux/netlink.h>
1829 #include <linux/rtnetlink.h>
1830
1831 int main (void)
1832 {
1833         int retval = TCA_STATS2;
1834         return (retval);
1835 }],
1836         [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1837         []);
1838
1839         AC_COMPILE_IFELSE(
1840 [#include <stdio.h>
1841 #include <sys/types.h>
1842 #include <asm/types.h>
1843 #include <sys/socket.h>
1844 #include <linux/netlink.h>
1845 #include <linux/rtnetlink.h>
1846
1847 int main (void)
1848 {
1849         int retval = TCA_STATS;
1850         return (retval);
1851 }],
1852         [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1853         []);
1854
1855         CFLAGS="$SAVE_CFLAGS"
1856 fi
1857 if test "x$with_libnetlink" = "xyes"
1858 then
1859         AC_CHECK_LIB(netlink, rtnl_open,
1860                      [with_libnetlink="yes"],
1861                      [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1862                      [$with_libnetlink_libs])
1863 fi
1864 if test "x$with_libnetlink" = "xyes"
1865 then
1866         BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1867         BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1868         AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1869         AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1870 fi
1871 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1872 # }}}
1873
1874 # --with-libnetsnmp {{{
1875 with_snmp_config="net-snmp-config"
1876 with_snmp_cflags=""
1877 with_snmp_libs=""
1878 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1879 [
1880         if test "x$withval" = "xno"
1881         then
1882                 with_libnetsnmp="no"
1883         else if test "x$withval" = "xyes"
1884         then
1885                 with_libnetsnmp="yes"
1886         else
1887                 if test -x "$withval"
1888                 then
1889                         with_snmp_config="$withval"
1890                         with_libnetsnmp="yes"
1891                 else
1892                         with_snmp_config="$withval/bin/net-snmp-config"
1893                         with_libnetsnmp="yes"
1894                 fi
1895         fi; fi
1896 ],
1897 [with_libnetsnmp="yes"])
1898 if test "x$with_libnetsnmp" = "xyes"
1899 then
1900         with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1901         snmp_config_status=$?
1902
1903         if test $snmp_config_status -ne 0
1904         then
1905                 with_libnetsnmp="no ($with_snmp_config failed)"
1906         else
1907                 SAVE_CPPFLAGS="$CPPFLAGS"
1908                 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1909                 
1910                 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1911
1912                 CPPFLAGS="$SAVE_CPPFLAGS"
1913         fi
1914 fi
1915 if test "x$with_libnetsnmp" = "xyes"
1916 then
1917         with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1918         snmp_config_status=$?
1919
1920         if test $snmp_config_status -ne 0
1921         then
1922                 with_libnetsnmp="no ($with_snmp_config failed)"
1923         else
1924                 AC_CHECK_LIB(netsnmp, init_snmp,
1925                 [with_libnetsnmp="yes"],
1926                 [with_libnetsnmp="no (libnetsnmp not found)"],
1927                 [$with_snmp_libs])
1928         fi
1929 fi
1930 if test "x$with_libnetsnmp" = "xyes"
1931 then
1932         BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1933         BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1934         AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1935         AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1936 fi
1937 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1938 # }}}
1939
1940 # --with-liboconfig {{{
1941 with_own_liboconfig="no"
1942 liboconfig_LDFLAGS="$LDFLAGS"
1943 liboconfig_CPPFLAGS="$CPPFLAGS"
1944 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1945 [
1946         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1947         then
1948                 if test -d "$withval/lib"
1949                 then
1950                         liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1951                 fi
1952                 if test -d "$withval/include"
1953                 then
1954                         liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1955                 fi
1956         fi
1957         if test "x$withval" = "xno"
1958         then
1959                 AC_MSG_ERROR("liboconfig is required")
1960         fi
1961 ],
1962 [
1963         with_liboconfig="yes"
1964 ])
1965
1966 save_LDFLAGS="$LDFLAGS"
1967 save_CPPFLAGS="$CPPFLAGS"
1968 LDFLAGS="$liboconfig_LDFLAGS"
1969 CPPFLAGS="$liboconfig_CPPFLAGS"
1970 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
1971 [
1972         with_liboconfig="yes"
1973         with_own_liboconfig="no"
1974 ],
1975 [
1976         with_liboconfig="yes"
1977         with_own_liboconfig="yes"
1978         LDFLAGS="$save_LDFLAGS"
1979         CPPFLAGS="$save_CPPFLAGS"
1980 ])
1981
1982 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
1983 if test "x$with_own_liboconfig" = "xyes"
1984 then
1985         with_liboconfig="yes (shipped version)"
1986 fi
1987 # }}}
1988
1989 # --with-liboping {{{
1990 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
1991 [
1992  if test "x$withval" = "xyes"
1993  then
1994          with_liboping="yes"
1995  else if test "x$withval" = "xno"
1996  then
1997          with_liboping="no"
1998  else
1999          with_liboping="yes"
2000          LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2001          LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2002  fi; fi
2003 ],
2004 [with_liboping="yes"])
2005
2006 SAVE_CPPFLAGS="$CPPFLAGS"
2007 SAVE_LDFLAGS="$LDFLAGS"
2008
2009 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2010 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2011
2012 if test "x$with_liboping" = "xyes"
2013 then
2014         if test "x$LIBOPING_CPPFLAGS" != "x"
2015         then
2016                 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2017         fi
2018         AC_CHECK_HEADERS(oping.h,
2019         [with_liboping="yes"],
2020         [with_liboping="no ('oping.h' not found)"])
2021 fi
2022 if test "x$with_liboping" = "xyes"
2023 then
2024         if test "x$LIBOPING_LDFLAGS" != "x"
2025         then
2026                 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2027         fi
2028         AC_CHECK_LIB(oping, ping_construct,
2029         [with_liboping="yes"],
2030         [with_liboping="no (symbol 'ping_construct' not found)"])
2031 fi
2032
2033 CPPFLAGS="$SAVE_CPPFLAGS"
2034 LDFLAGS="$SAVE_LDFLAGS"
2035
2036 if test "x$with_liboping" = "xyes"
2037 then
2038         BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2039         BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2040         AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2041         AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2042 fi
2043 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2044 # }}}
2045
2046 # --with-oracle {{{
2047 with_oracle_cppflags=""
2048 with_oracle_libs=""
2049 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2050 [
2051         if test "x$withval" = "xyes"
2052         then
2053                 if test "x$ORACLE_HOME" = "x"
2054                 then
2055                         AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2056                 fi
2057                 with_oracle="yes"
2058         else if test "x$withval" = "xno"
2059         then
2060                 with_oracle="no"
2061         else
2062                 with_oracle="yes"
2063                 ORACLE_HOME="$withval"
2064         fi; fi
2065 ],
2066 [
2067         if test "x$ORACLE_HOME" = "x"
2068         then
2069                 with_oracle="no (ORACLE_HOME is not set)"
2070         else
2071                 with_oracle="yes"
2072         fi
2073 ])
2074 if test "x$ORACLE_HOME" != "x"
2075 then
2076         with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2077
2078         if test -e "$ORACLE_HOME/lib/ldflags"
2079         then
2080                 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2081         fi
2082         #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2083         with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2084 fi
2085 if test "x$with_oracle" = "xyes"
2086 then
2087         SAVE_CPPFLAGS="$CPPFLAGS"
2088         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2089
2090         AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2091
2092         CPPFLAGS="$SAVE_CPPFLAGS"
2093 fi
2094 if test "x$with_oracle" = "xyes"
2095 then
2096         SAVE_CPPFLAGS="$CPPFLAGS"
2097         SAVE_LDFLAGS="$LDFLAGS"
2098         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2099         LDFLAGS="$LDFLAGS $with_oracle_libs"
2100
2101         AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2102
2103         CPPFLAGS="$SAVE_CPPFLAGS"
2104         LDFLAGS="$SAVE_LDFLAGS"
2105 fi
2106 if test "x$with_oracle" = "xyes"
2107 then
2108         BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2109         BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2110         AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2111         AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2112 fi
2113 # }}}
2114
2115 # --with-libowcapi {{{
2116 with_libowcapi_cppflags=""
2117 with_libowcapi_libs="-lowcapi"
2118 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2119 [
2120         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2121         then
2122                 with_libowcapi_cppflags="-I$withval/include"
2123                 with_libowcapi_libs="-L$withval/lib -lowcapi"
2124                 with_libowcapi="yes"
2125         else
2126                 with_libowcapi="$withval"
2127         fi
2128 ],
2129 [
2130         with_libowcapi="yes"
2131 ])
2132 if test "x$with_libowcapi" = "xyes"
2133 then
2134         SAVE_CPPFLAGS="$CPPFLAGS"
2135         CPPFLAGS="$with_libowcapi_cppflags"
2136         
2137         AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2138
2139         CPPFLAGS="$SAVE_CPPFLAGS"
2140 fi
2141 if test "x$with_libowcapi" = "xyes"
2142 then
2143         SAVE_LDFLAGS="$LDFLAGS"
2144         SAVE_CPPFLAGS="$CPPFLAGS"
2145         LDFLAGS="$with_libowcapi_libs"
2146         CPPFLAGS="$with_libowcapi_cppflags"
2147         
2148         AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2149
2150         LDFLAGS="$SAVE_LDFLAGS"
2151         CPPFLAGS="$SAVE_CPPFLAGS"
2152 fi
2153 if test "x$with_libowcapi" = "xyes"
2154 then
2155         BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2156         BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2157         AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2158         AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2159 fi
2160 # }}}
2161
2162 # --with-libpcap {{{
2163 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2164 [
2165         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2166         then
2167                 LDFLAGS="$LDFLAGS -L$withval/lib"
2168                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2169                 with_libpcap="yes"
2170         else
2171                 with_libpcap="$withval"
2172         fi
2173 ],
2174 [
2175         with_libpcap="yes"
2176 ])
2177 if test "x$with_libpcap" = "xyes"
2178 then
2179         AC_CHECK_LIB(pcap, pcap_open_live,
2180         [
2181                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2182         ], [with_libpcap="no (libpcap not found)"])
2183 fi
2184 if test "x$with_libpcap" = "xyes"
2185 then
2186         AC_CHECK_HEADERS(pcap.h,
2187         [
2188                 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2189         ], [with_libpcap="no (pcap.h not found)"])
2190 fi
2191 if test "x$with_libpcap" = "xyes"
2192 then
2193         collect_libpcap=1
2194 else
2195         collect_libpcap=0
2196 fi
2197 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2198         [Wether or not to use the pcap library])
2199 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2200 # }}}
2201
2202 # --with-libperl {{{
2203 perl_interpreter="perl"
2204 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2205 [
2206         if test -x "$withval"
2207         then
2208                 perl_interpreter="$withval"
2209                 with_libperl="yes"
2210         else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2211         then
2212                 LDFLAGS="$LDFLAGS -L$withval/lib"
2213                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2214                 perl_interpreter="$withval/bin/perl"
2215                 with_libperl="yes"
2216         else
2217                 with_libperl="$withval"
2218         fi; fi
2219 ],
2220 [
2221         with_libperl="yes"
2222 ])
2223
2224 AC_MSG_CHECKING([for perl])
2225 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2226 if test -x "$perl_interpreter"
2227 then
2228         AC_MSG_RESULT([yes ($perl_interpreter)])
2229 else
2230         perl_interpreter=""
2231         AC_MSG_RESULT([no])
2232 fi
2233
2234 AC_SUBST(PERL, "$perl_interpreter")
2235
2236 if test "x$with_libperl" = "xyes" \
2237         && test -n "$perl_interpreter"
2238 then
2239   SAVE_CFLAGS=$CFLAGS
2240   SAVE_LDFLAGS=$LDFLAGS
2241 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2242   PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2243   PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2244   CFLAGS="$CFLAGS $PERL_CFLAGS"
2245   LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2246
2247   AC_CACHE_CHECK([for libperl],
2248     [c_cv_have_libperl],
2249     AC_LINK_IFELSE(
2250       AC_LANG_PROGRAM(
2251       [[
2252 #define PERL_NO_GET_CONTEXT
2253 #include <EXTERN.h>
2254 #include <perl.h>
2255 #include <XSUB.h>
2256       ]],
2257       [[
2258        dTHX;
2259        load_module (PERL_LOADMOD_NOIMPORT,
2260                          newSVpv ("Collectd::Plugin::FooBar", 24),
2261                          Nullsv);
2262       ]]),
2263       [c_cv_have_libperl="yes"],
2264       [c_cv_have_libperl="no"]
2265     )
2266   )
2267
2268   if test "x$c_cv_have_libperl" = "xyes"
2269   then
2270           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2271           AC_SUBST(PERL_CFLAGS)
2272           AC_SUBST(PERL_LDFLAGS)
2273   else
2274           with_libperl="no"
2275   fi
2276
2277   CFLAGS=$SAVE_CFLAGS
2278   LDFLAGS=$SAVE_LDFLAGS
2279 else if test -z "$perl_interpreter"; then
2280   with_libperl="no (no perl interpreter found)"
2281   c_cv_have_libperl="no"
2282 fi; fi
2283 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2284
2285 if test "x$with_libperl" = "xyes"
2286 then
2287         SAVE_CFLAGS=$CFLAGS
2288         SAVE_LDFLAGS=$LDFLAGS
2289         CFLAGS="$CFLAGS $PERL_CFLAGS"
2290         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2291
2292         AC_CACHE_CHECK([if perl supports ithreads],
2293                 [c_cv_have_perl_ithreads],
2294                 AC_LINK_IFELSE(
2295                         AC_LANG_PROGRAM(
2296                         [[
2297 #include <EXTERN.h>
2298 #include <perl.h>
2299 #include <XSUB.h>
2300
2301 #if !defined(USE_ITHREADS)
2302 # error "Perl does not support ithreads!"
2303 #endif /* !defined(USE_ITHREADS) */
2304                         ]],
2305                         [[ ]]),
2306                         [c_cv_have_perl_ithreads="yes"],
2307                         [c_cv_have_perl_ithreads="no"]
2308                 )
2309         )
2310
2311         if test "x$c_cv_have_perl_ithreads" = "xyes"
2312         then
2313                 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2314         fi
2315
2316         CFLAGS=$SAVE_CFLAGS
2317         LDFLAGS=$SAVE_LDFLAGS
2318 fi
2319
2320 if test "x$with_libperl" = "xyes"
2321 then
2322         SAVE_CFLAGS=$CFLAGS
2323         SAVE_LDFLAGS=$LDFLAGS
2324         # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2325         # (see issues #41 and #42)
2326         CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2327         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2328
2329         AC_CACHE_CHECK([for broken Perl_load_module()],
2330                 [c_cv_have_broken_perl_load_module],
2331                 AC_LINK_IFELSE(
2332                         AC_LANG_PROGRAM(
2333                         [[
2334 #define PERL_NO_GET_CONTEXT
2335 #include <EXTERN.h>
2336 #include <perl.h>
2337 #include <XSUB.h>
2338                         ]],
2339                         [[
2340                          dTHX;
2341                          load_module (PERL_LOADMOD_NOIMPORT,
2342                              newSVpv ("Collectd::Plugin::FooBar", 24),
2343                              Nullsv);
2344                         ]]),
2345                         [c_cv_have_broken_perl_load_module="no"],
2346                         [c_cv_have_broken_perl_load_module="yes"]
2347                 )
2348         )
2349
2350         CFLAGS=$SAVE_CFLAGS
2351         LDFLAGS=$SAVE_LDFLAGS
2352 fi
2353 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2354                 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2355
2356 if test "x$with_libperl" = "xyes"
2357 then
2358         SAVE_CFLAGS=$CFLAGS
2359         SAVE_LDFLAGS=$LDFLAGS
2360         CFLAGS="$CFLAGS $PERL_CFLAGS"
2361         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2362
2363         AC_CHECK_MEMBER(
2364                 [struct mgvtbl.svt_local],
2365                 [have_struct_mgvtbl_svt_local="yes"],
2366                 [have_struct_mgvtbl_svt_local="no"],
2367                 [
2368 #include <EXTERN.h>
2369 #include <perl.h>
2370 #include <XSUB.h>
2371                 ])
2372
2373         if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2374         then
2375                 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2376                                   [Define if Perl's struct mgvtbl has member svt_local.])
2377         fi
2378
2379         CFLAGS=$SAVE_CFLAGS
2380         LDFLAGS=$SAVE_LDFLAGS
2381 fi
2382 # }}}
2383
2384 # --with-libpq {{{
2385 with_pg_config="pg_config"
2386 with_libpq_includedir=""
2387 with_libpq_libdir=""
2388 with_libpq_cppflags=""
2389 with_libpq_ldflags=""
2390 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2391         [Path to libpq.])],
2392 [
2393         if test "x$withval" = "xno"
2394         then
2395                 with_libpq="no"
2396         else if test "x$withval" = "xyes"
2397         then
2398                 with_libpq="yes"
2399         else
2400                 if test -f "$withval" && test -x "$withval";
2401                 then
2402                         with_pg_config="$withval"
2403                 else if test -x "$withval/bin/pg_config"
2404                 then
2405                         with_pg_config="$withval/bin/pg_config"
2406                 fi; fi
2407                 with_libpq="yes"
2408         fi; fi
2409 ],
2410 [
2411         with_libpq="yes"
2412 ])
2413 if test "x$with_libpq" = "xyes"
2414 then
2415         with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2416         pg_config_status=$?
2417
2418         if test $pg_config_status -eq 0
2419         then
2420                 if test -n "$with_libpq_includedir"; then
2421                         for dir in $with_libpq_includedir; do
2422                                 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2423                         done
2424                 fi
2425         else
2426                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2427         fi
2428
2429         SAVE_CPPFLAGS="$CPPFLAGS"
2430         CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2431
2432         AC_CHECK_HEADERS(libpq-fe.h, [],
2433                 [with_libpq="no (libpq-fe.h not found)"], [])
2434
2435         CPPFLAGS="$SAVE_CPPFLAGS"
2436 fi
2437 if test "x$with_libpq" = "xyes"
2438 then
2439         with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2440         pg_config_status=$?
2441
2442         if test $pg_config_status -eq 0
2443         then
2444                 if test -n "$with_libpq_libdir"; then
2445                         for dir in $with_libpq_libdir; do
2446                                 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2447                         done
2448                 fi
2449         else
2450                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2451         fi
2452
2453         SAVE_LDFLAGS="$LDFLAGS"
2454         LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2455
2456         AC_CHECK_LIB(pq, PQconnectdb,
2457                 [with_libpq="yes"],
2458                 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2459
2460         AC_CHECK_LIB(pq, PQserverVersion,
2461                 [with_libpq="yes"],
2462                 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2463
2464         LDFLAGS="$SAVE_LDFLAGS"
2465 fi
2466 if test "x$with_libpq" = "xyes"
2467 then
2468         BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2469         BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2470         AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2471         AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2472 fi
2473 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2474 # }}}
2475
2476 # --with-libpthread {{{
2477 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2478 [       if test "x$withval" != "xno" \
2479                 && test "x$withval" != "xyes"
2480         then
2481                 LDFLAGS="$LDFLAGS -L$withval/lib"
2482                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2483                 with_libpthread="yes"
2484         else
2485                 if test "x$withval" = "xno"
2486                 then
2487                         with_libpthread="no (disabled)"
2488                 fi
2489         fi
2490 ], [with_libpthread="yes"])
2491 if test "x$with_libpthread" = "xyes"
2492 then
2493         AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2494 fi
2495
2496 if test "x$with_libpthread" = "xyes"
2497 then
2498         AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2499 fi
2500 if test "x$with_libpthread" = "xyes"
2501 then
2502         collect_pthread=1
2503 else
2504         collect_pthread=0
2505 fi
2506 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2507         [Wether or not to use pthread (POSIX threads) library])
2508 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2509 # }}}
2510
2511 # --with-librrd {{{
2512 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
2513 librrd_cflags=""
2514 librrd_ldflags=""
2515 librrd_threadsafe="yes"
2516 librrd_rrdc_update="no"
2517 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
2518 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
2519         then
2520                 librrd_cflags="-I$withval/include"
2521                 librrd_ldflags="-L$withval/lib"
2522                 with_librrd="yes"
2523         else
2524                 with_librrd="$withval"
2525         fi
2526 ], [with_librrd="yes"])
2527 if test "x$with_librrd" = "xyes"
2528 then
2529         SAVE_CPPFLAGS="$CPPFLAGS"
2530         SAVE_LDFLAGS="$LDFLAGS"
2531
2532         CPPFLAGS="$CPPFLAGS $librrd_cflags"
2533         LDFLAGS="$LDFLAGS $librrd_ldflags"
2534
2535         AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
2536
2537         CPPFLAGS="$SAVE_CPPFLAGS"
2538         LDFLAGS="$SAVE_LDFLAGS"
2539 fi
2540 if test "x$with_librrd" = "xyes"
2541 then
2542         SAVE_CPPFLAGS="$CPPFLAGS"
2543         SAVE_LDFLAGS="$LDFLAGS"
2544
2545         CPPFLAGS="$CPPFLAGS $librrd_cflags"
2546         LDFLAGS="$LDFLAGS $librrd_ldflags"
2547
2548         AC_CHECK_LIB(rrd_th, rrd_update_r,
2549         [with_librrd="yes"
2550          librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
2551         ],
2552         [librrd_threadsafe="no"
2553          AC_CHECK_LIB(rrd, rrd_update,
2554          [with_librrd="yes"
2555           librrd_ldflags="$librrd_ldflags -lrrd -lm"
2556          ],
2557          [with_librrd="no (symbol 'rrd_update' not found)"],
2558          [-lm])
2559         ],
2560         [-lm])
2561
2562         if test "x$librrd_threadsafe" = "xyes"
2563         then
2564                 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2565         else
2566                 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2567         fi
2568
2569         CPPFLAGS="$SAVE_CPPFLAGS"
2570         LDFLAGS="$SAVE_LDFLAGS"
2571 fi
2572 if test "x$with_librrd" = "xyes"
2573 then
2574         BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
2575         BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
2576         AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
2577         AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
2578 fi
2579 if test "x$librrd_threadsafe" = "xyes"
2580 then
2581         AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
2582 fi
2583 # }}}
2584
2585 # --with-libsensors {{{
2586 with_sensors_cflags=""
2587 with_sensors_ldflags=""
2588 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
2589 [
2590         if test "x$withval" = "xno"
2591         then
2592                 with_libsensors="no"
2593         else
2594                 with_libsensors="yes"
2595                 if test "x$withval" != "xyes"
2596                 then
2597                         with_sensors_cflags="-I$withval/include"
2598                         with_sensors_ldflags="-L$withval/lib"
2599                         with_libsensors="yes"
2600                 fi
2601         fi
2602 ],
2603 [
2604         if test "x$ac_system" = "xLinux"
2605         then
2606                 with_libsensors="yes"
2607         else
2608                 with_libsensors="no (Linux only library)"
2609         fi
2610 ])
2611 if test "x$with_libsensors" = "xyes"
2612 then
2613         SAVE_CPPFLAGS="$CPPFLAGS"
2614         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2615
2616 #       AC_CHECK_HEADERS(sensors/sensors.h,
2617 #       [
2618 #               AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
2619 #       ],
2620 #       [with_libsensors="no (sensors/sensors.h not found)"])
2621         AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
2622
2623         CPPFLAGS="$SAVE_CPPFLAGS"
2624 fi
2625 if test "x$with_libsensors" = "xyes"
2626 then
2627         SAVE_CPPFLAGS="$CPPFLAGS"
2628         SAVE_LDFLAGS="$LDFLAGS"
2629         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2630         LDFLAGS="$LDFLAGS $with_sensors_ldflags"
2631
2632         AC_CHECK_LIB(sensors, sensors_init,
2633         [
2634                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
2635         ],
2636         [with_libsensors="no (libsensors not found)"])
2637
2638         CPPFLAGS="$SAVE_CPPFLAGS"
2639         LDFLAGS="$SAVE_LDFLAGS"
2640 fi
2641 if test "x$with_libsensors" = "xyes"
2642 then
2643         BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
2644         BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
2645         AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
2646         AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
2647 fi
2648 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
2649 # }}}
2650
2651 # --with-libstatgrab {{{
2652 with_libstatgrab_cflags=""
2653 with_libstatgrab_ldflags=""
2654 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
2655 [
2656  if test "x$withval" != "xno" \
2657    && test "x$withval" != "xyes"
2658  then
2659    with_libstatgrab_cflags="-I$withval/include"
2660    with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
2661    with_libstatgrab="yes"
2662    with_libstatgrab_pkg_config="no"
2663  else
2664    with_libstatgrab="$withval"
2665    with_libstatgrab_pkg_config="yes"
2666  fi
2667  ],
2668 [
2669  with_libstatgrab="yes"
2670  with_libstatgrab_pkg_config="yes"
2671 ])
2672
2673 if test "x$with_libstatgrab" = "xyes" \
2674   && test "x$with_libstatgrab_pkg_config" = "xyes"
2675 then
2676   if test "x$PKG_CONFIG" != "x"
2677   then
2678     AC_MSG_CHECKING([pkg-config for libstatgrab])
2679     temp_result="found"
2680     $PKG_CONFIG --exists libstatgrab 2>/dev/null
2681     if test "$?" != "0"
2682     then
2683       with_libstatgrab_pkg_config="no"
2684       with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
2685       temp_result="not found"
2686     fi
2687     AC_MSG_RESULT([$temp_result])
2688   else
2689     AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
2690     with_libstatgrab_pkg_config="no"
2691     with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
2692   fi
2693 fi
2694
2695 if test "x$with_libstatgrab" = "xyes" \
2696   && test "x$with_libstatgrab_pkg_config" = "xyes" \
2697   && test "x$with_libstatgrab_cflags" = "x"
2698 then
2699   AC_MSG_CHECKING([for libstatgrab CFLAGS])
2700   temp_result="`$PKG_CONFIG --cflags libstatgrab`"
2701   if test "$?" = "0"
2702   then
2703     with_libstatgrab_cflags="$temp_result"
2704   else
2705     with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
2706     temp_result="$PKG_CONFIG --cflags libstatgrab failed"
2707   fi
2708   AC_MSG_RESULT([$temp_result])
2709 fi
2710
2711 if test "x$with_libstatgrab" = "xyes" \
2712   && test "x$with_libstatgrab_pkg_config" = "xyes" \
2713   && test "x$with_libstatgrab_ldflags" = "x"
2714 then
2715   AC_MSG_CHECKING([for libstatgrab LDFLAGS])
2716   temp_result="`$PKG_CONFIG --libs libstatgrab`"
2717   if test "$?" = "0"
2718   then
2719     with_libstatgrab_ldflags="$temp_result"
2720   else
2721     with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
2722     temp_result="$PKG_CONFIG --libs libstatgrab failed"
2723   fi
2724   AC_MSG_RESULT([$temp_result])
2725 fi
2726
2727 if test "x$with_libstatgrab" = "xyes"
2728 then
2729   SAVE_CPPFLAGS="$CPPFLAGS"
2730   CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
2731
2732   AC_CHECK_HEADERS(statgrab.h,
2733                    [with_libstatgrab="yes"],
2734                    [with_libstatgrab="no (statgrab.h not found)"])
2735
2736   CPPFLAGS="$SAVE_CPPFLAGS"
2737 fi
2738
2739 if test "x$with_libstatgrab" = "xyes"
2740 then
2741   SAVE_CFLAGS="$CFLAGS"
2742   SAVE_LDFLAGS="$LDFLAGS"
2743
2744   CFLAGS="$CFLAGS $with_libstatgrab_cflags"
2745   LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
2746
2747   AC_CHECK_LIB(statgrab, sg_init,
2748                [with_libstatgrab="yes"],
2749                [with_libstatgrab="no (symbol sg_init not found)"])
2750
2751   CFLAGS="$SAVE_CFLAGS"
2752   LDFLAGS="$SAVE_LDFLAGS"
2753 fi
2754
2755 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
2756 if test "x$with_libstatgrab" = "xyes"
2757 then
2758   AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
2759   BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
2760   BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
2761   AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
2762   AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
2763 fi
2764 # }}}
2765
2766 # --with-libtokyotyrant {{{
2767 with_libtokyotyrant_cppflags=""
2768 with_libtokyotyrant_ldflags=""
2769 with_libtokyotyrant_libs=""
2770 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
2771 [
2772   if test "x$withval" = "xno"
2773   then
2774     with_libtokyotyrant="no"
2775   else if test "x$withval" = "xyes"
2776   then
2777     with_libtokyotyrant="yes"
2778   else
2779     with_libtokyotyrant_cppflags="-I$withval/include"
2780     with_libtokyotyrant_ldflags="-L$withval/include"
2781     with_libtokyotyrant_libs="-ltokyotyrant"
2782     with_libtokyotyrant="yes"
2783   fi; fi
2784 ],
2785 [
2786   with_libtokyotyrant="yes"
2787 ])
2788
2789 if test "x$with_libtokyotyrant" = "xyes"
2790 then
2791   if $PKG_CONFIG --exists tokyotyrant
2792   then
2793     with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
2794     with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
2795     with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
2796   fi
2797 fi
2798
2799 SAVE_CPPFLAGS="$CPPFLAGS"
2800 SAVE_LDFLAGS="$LDFLAGS"
2801 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
2802 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
2803
2804 if test "x$with_libtokyotyrant" = "xyes"
2805 then
2806   AC_CHECK_HEADERS(tcrdb.h,
2807   [
2808           AC_DEFINE(HAVE_TCRDB_H, 1,
2809                     [Define to 1 if you have the <tcrdb.h> header file.])
2810   ], [with_libtokyotyrant="no (tcrdb.h not found)"])
2811 fi
2812
2813 if test "x$with_libtokyotyrant" = "xyes"
2814 then
2815   AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
2816   [
2817           AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
2818                     [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
2819   ],
2820   [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
2821   [$with_libtokyotyrant_libs])
2822 fi
2823
2824 CPPFLAGS="$SAVE_CPPFLAGS"
2825 LDFLAGS="$SAVE_LDFLAGS"
2826
2827 if test "x$with_libtokyotyrant" = "xyes"
2828 then 
2829   BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
2830   BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
2831   BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
2832   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
2833   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
2834   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
2835 fi
2836 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
2837 # }}}
2838
2839 # --with-libupsclient {{{
2840 with_libupsclient_config=""
2841 with_libupsclient_cflags=""
2842 with_libupsclient_libs=""
2843 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2844 [
2845         if test "x$withval" = "xno"
2846         then
2847                 with_libupsclient="no"
2848         else if test "x$withval" = "xyes"
2849         then
2850                 with_libupsclient="use_pkgconfig"
2851         else
2852                 if test -x "$withval"
2853                 then
2854                         with_libupsclient_config="$withval"
2855                         with_libupsclient="use_libupsclient_config"
2856                 else if test -x "$withval/bin/libupsclient-config"
2857                 then
2858                         with_libupsclient_config="$withval/bin/net-snmp-config"
2859                         with_libupsclient="use_libupsclient_config"
2860                 else
2861                         AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
2862                         with_libupsclient_cflags="-I$withval/include"
2863                         with_libupsclient_libs="-L$withval/lib -lupsclient"
2864                         with_libupsclient="yes"
2865                 fi; fi
2866         fi; fi
2867 ],
2868 [with_libupsclient="use_pkgconfig"])
2869
2870 # configure using libupsclient-config
2871 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2872 then
2873         AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
2874         with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
2875         if test $? -ne 0
2876         then
2877                 with_libupsclient="no ($with_libupsclient_config failed)"
2878         fi
2879         with_libupsclient_libs="`$with_libupsclient_config --libs`"
2880         if test $? -ne 0
2881         then
2882                 with_libupsclient="no ($with_libupsclient_config failed)"
2883         fi
2884 fi
2885 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2886 then
2887         with_libupsclient="yes"
2888 fi
2889
2890 # configure using pkg-config
2891 if test "x$with_libupsclient" = "xuse_pkgconfig"
2892 then
2893         if test "x$PKG_CONFIG" = "x"
2894         then
2895                 with_libupsclient="no (Don't have pkg-config)"
2896         fi
2897 fi
2898 if test "x$with_libupsclient" = "xuse_pkgconfig"
2899 then
2900         AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
2901         $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
2902         if test $? -ne 0
2903         then
2904                 with_libupsclient="no (pkg-config doesn't know library)"
2905         fi
2906 fi
2907 if test "x$with_libupsclient" = "xuse_pkgconfig"
2908 then
2909         with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
2910         if test $? -ne 0
2911         then
2912                 with_libupsclient="no ($PKG_CONFIG failed)"
2913         fi
2914         with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
2915         if test $? -ne 0
2916         then
2917                 with_libupsclient="no ($PKG_CONFIG failed)"
2918         fi
2919 fi
2920 if test "x$with_libupsclient" = "xuse_pkgconfig"
2921 then
2922         with_libupsclient="yes"
2923 fi
2924
2925 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
2926 # the actual checks.
2927 if test "x$with_libupsclient" = "xyes"
2928 then
2929         SAVE_CPPFLAGS="$CPPFLAGS"
2930         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2931
2932         AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
2933
2934         CPPFLAGS="$SAVE_CPPFLAGS"
2935 fi
2936 if test "x$with_libupsclient" = "xyes"
2937 then
2938         SAVE_CPPFLAGS="$CPPFLAGS"
2939         SAVE_LDFLAGS="$LDFLAGS"
2940
2941         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2942         LDFLAGS="$LDFLAGS $with_libupsclient_libs"
2943
2944         AC_CHECK_LIB(upsclient, upscli_connect,
2945                      [with_libupsclient="yes"],
2946                      [with_libupsclient="no (symbol upscli_connect not found)"])
2947
2948         CPPFLAGS="$SAVE_CPPFLAGS"
2949         LDFLAGS="$SAVE_LDFLAGS"
2950 fi
2951 if test "x$with_libupsclient" = "xyes"
2952 then
2953         SAVE_CPPFLAGS="$CPPFLAGS"
2954         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2955
2956         AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
2957 [#include <stdlib.h>
2958 #include <stdio.h>
2959 #include <upsclient.h>])
2960
2961         CPPFLAGS="$SAVE_CPPFLAGS"
2962 fi
2963 if test "x$with_libupsclient" = "xyes"
2964 then
2965         BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
2966         BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
2967         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
2968         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
2969 fi
2970 # }}}
2971
2972 # --with-libxmms {{{
2973 with_xmms_config="xmms-config"
2974 with_xmms_cflags=""
2975 with_xmms_libs=""
2976 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
2977 [
2978         if test "x$withval" != "xno" \
2979                 && test "x$withval" != "xyes"
2980         then
2981                 if test -f "$withval" && test -x "$withval";
2982                 then
2983                         with_xmms_config="$withval"
2984                 else if test -x "$withval/bin/xmms-config"
2985                 then
2986                         with_xmms_config="$withval/bin/xmms-config"
2987                 fi; fi
2988                 with_libxmms="yes"
2989         else if test "x$withval" = "xno"
2990         then
2991                 with_libxmms="no"
2992         else
2993                 with_libxmms="yes"
2994         fi; fi
2995 ],
2996 [
2997         with_libxmms="yes"
2998 ])
2999 if test "x$with_libxmms" = "xyes"
3000 then
3001         with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3002         xmms_config_status=$?
3003
3004         if test $xmms_config_status -ne 0
3005         then
3006                 with_libxmms="no"
3007         fi
3008 fi
3009 if test "x$with_libxmms" = "xyes"
3010 then
3011         with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3012         xmms_config_status=$?
3013
3014         if test $xmms_config_status -ne 0
3015         then
3016                 with_libxmms="no"
3017         fi
3018 fi
3019 if test "x$with_libxmms" = "xyes"
3020 then
3021         AC_CHECK_LIB(xmms, xmms_remote_get_info,
3022         [
3023                 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3024                 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3025                 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3026                 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3027         ],
3028         [
3029                 with_libxmms="no"
3030         ],
3031         [$with_xmms_libs])
3032 fi
3033 with_libxmms_numeric=0
3034 if test "x$with_libxmms" = "xyes"
3035 then
3036         with_libxmms_numeric=1
3037 fi
3038 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3039 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3040 # }}}
3041
3042 # --with-libyajl {{{
3043 with_libyajl_cppflags=""
3044 with_libyajl_ldflags=""
3045 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3046 [
3047         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3048         then
3049                 with_libyajl_cppflags="-I$withval/include"
3050                 with_libyajl_ldflags="-L$withval/lib"
3051                 with_libyajl="yes"
3052         else
3053                 with_libyajl="$withval"
3054         fi
3055 ],
3056 [
3057         with_libyajl="yes"
3058 ])
3059 if test "x$with_libyajl" = "xyes"
3060 then
3061         SAVE_CPPFLAGS="$CPPFLAGS"
3062         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3063
3064         AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3065
3066         CPPFLAGS="$SAVE_CPPFLAGS"
3067 fi
3068 if test "x$with_libyajl" = "xyes"
3069 then
3070         SAVE_CPPFLAGS="$CPPFLAGS"
3071         SAVE_LDFLAGS="$LDFLAGS"
3072         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3073         LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3074
3075         AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3076
3077         CPPFLAGS="$SAVE_CPPFLAGS"
3078         LDFLAGS="$SAVE_LDFLAGS"
3079 fi
3080 if test "x$with_libyajl" = "xyes"
3081 then
3082         BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3083         BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3084         BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3085         AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3086         AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3087         AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3088         AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3089 fi
3090 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3091 # }}}
3092
3093 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3094 with_libxml2="no (pkg-config isn't available)"
3095 with_libxml2_cflags=""
3096 with_libxml2_ldflags=""
3097 with_libvirt="no (pkg-config isn't available)"
3098 with_libvirt_cflags=""
3099 with_libvirt_ldflags=""
3100 if test "x$PKG_CONFIG" != "x"
3101 then
3102         pkg-config --exists 'libxml-2.0' 2>/dev/null
3103         if test "$?" = "0"
3104         then
3105                 with_libxml2="yes"
3106         else
3107                 with_libxml2="no (pkg-config doesn't know library)"
3108         fi
3109
3110         pkg-config --exists libvirt 2>/dev/null
3111         if test "$?" = "0"
3112         then
3113                 with_libvirt="yes"
3114         else
3115                 with_libvirt="no (pkg-config doesn't know library)"
3116         fi
3117 fi
3118 if test "x$with_libxml2" = "xyes"
3119 then
3120         with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
3121         if test $? -ne 0
3122         then
3123                 with_libxml2="no"
3124         fi
3125         with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
3126         if test $? -ne 0
3127         then
3128                 with_libxml2="no"
3129         fi
3130 fi
3131 if test "x$with_libxml2" = "xyes"
3132 then
3133         SAVE_CPPFLAGS="$CPPFLAGS"
3134         CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3135
3136         AC_CHECK_HEADERS(libxml/parser.h, [],
3137                       [with_libxml2="no (libxml/parser.h not found)"])
3138
3139         CPPFLAGS="$SAVE_CPPFLAGS"
3140 fi
3141 if test "x$with_libxml2" = "xyes"
3142 then
3143         SAVE_CFLAGS="$CFLAGS"
3144         SAVE_LDFLAGS="$LDFLAGS"
3145
3146         CFLAGS="$CFLAGS $with_libxml2_cflags"
3147         LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3148
3149         AC_CHECK_LIB(xml2, xmlXPathEval,
3150                      [with_libxml2="yes"],
3151                      [with_libxml2="no (symbol xmlXPathEval not found)"])
3152
3153         CFLAGS="$SAVE_CFLAGS"
3154         LDFLAGS="$SAVE_LDFLAGS"
3155 fi
3156 dnl Add the right compiler flags and libraries.
3157 if test "x$with_libxml2" = "xyes"; then
3158         BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3159         BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3160         AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3161         AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3162 fi
3163 if test "x$with_libvirt" = "xyes"
3164 then
3165         with_libvirt_cflags="`pkg-config --cflags libvirt`"
3166         if test $? -ne 0
3167         then
3168                 with_libvirt="no"
3169         fi
3170         with_libvirt_ldflags="`pkg-config --libs libvirt`"
3171         if test $? -ne 0
3172         then
3173                 with_libvirt="no"
3174         fi
3175 fi
3176 if test "x$with_libvirt" = "xyes"
3177 then
3178         SAVE_CPPFLAGS="$CPPFLAGS"
3179         CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3180
3181         AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3182                       [with_libvirt="no (libvirt/libvirt.h not found)"])
3183
3184         CPPFLAGS="$SAVE_CPPFLAGS"
3185 fi
3186 if test "x$with_libvirt" = "xyes"
3187 then
3188         SAVE_CFLAGS="$CFLAGS"
3189         SAVE_LDFLAGS="$LDFLAGS"
3190
3191         CFLAGS="$CFLAGS $with_libvirt_cflags"
3192         LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3193
3194         AC_CHECK_LIB(virt, virDomainBlockStats,
3195                      [with_libvirt="yes"],
3196                      [with_libvirt="no (symbol virDomainBlockStats not found)"])
3197
3198         CFLAGS="$SAVE_CFLAGS"
3199         LDFLAGS="$SAVE_LDFLAGS"
3200 fi
3201 dnl Add the right compiler flags and libraries.
3202 if test "x$with_libvirt" = "xyes"; then
3203         BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3204         BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3205         AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3206         AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3207 fi
3208 # }}}
3209
3210 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3211 with_libopenipmipthread="yes"
3212 with_libopenipmipthread_cflags=""
3213 with_libopenipmipthread_libs=""
3214
3215 AC_MSG_CHECKING([for pkg-config])
3216 temp_result="no"
3217 if test "x$PKG_CONFIG" = "x"
3218 then
3219         with_libopenipmipthread="no"
3220         temp_result="no"
3221 else
3222         temp_result="$PKG_CONFIG"
3223 fi
3224 AC_MSG_RESULT([$temp_result])
3225
3226 if test "x$with_libopenipmipthread" = "xyes"
3227 then
3228         AC_MSG_CHECKING([for libOpenIPMIpthread])
3229         $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3230         if test "$?" != "0"
3231         then
3232                 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3233         fi
3234         AC_MSG_RESULT([$with_libopenipmipthread])
3235 fi
3236
3237 if test "x$with_libopenipmipthread" = "xyes"
3238 then
3239         AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3240         temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3241         if test "$?" = "0"
3242         then
3243                 with_libopenipmipthread_cflags="$temp_result"
3244         else
3245                 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3246                 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3247         fi
3248         AC_MSG_RESULT([$temp_result])
3249 fi
3250
3251 if test "x$with_libopenipmipthread" = "xyes"
3252 then
3253         AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3254         temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3255         if test "$?" = "0"
3256         then
3257                 with_libopenipmipthread_ldflags="$temp_result"
3258         else
3259                 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3260                 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3261         fi
3262         AC_MSG_RESULT([$temp_result])
3263 fi
3264
3265 if test "x$with_libopenipmipthread" = "xyes"
3266 then
3267         SAVE_CPPFLAGS="$CPPFLAGS"
3268         CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3269
3270         AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3271                          [with_libopenipmipthread="yes"],
3272                          [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3273 [#include <OpenIPMI/ipmiif.h>
3274 #include <OpenIPMI/ipmi_err.h>
3275 #include <OpenIPMI/ipmi_posix.h>
3276 #include <OpenIPMI/ipmi_conn.h>
3277 ])
3278
3279         CPPFLAGS="$SAVE_CPPFLAGS"
3280 fi
3281
3282 if test "x$with_libopenipmipthread" = "xyes"
3283 then
3284         BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3285         BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3286         AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3287         AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3288 fi
3289 # }}}
3290
3291 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3292                 [with_libnotify="yes"],
3293                 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3294
3295 # Check for enabled/disabled features
3296 #
3297
3298 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3299 # ------------------------------------------------------------
3300 dnl
3301 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3302 dnl
3303 AC_DEFUN(
3304         [AC_COLLECTD],
3305         [
3306         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3307         m4_if(
3308                 [$2],
3309                 [enable],
3310                 [dnl
3311                 m4_define([EnDis],[disabled])dnl
3312                 m4_define([YesNo],[no])dnl
3313                 ],dnl
3314                 [m4_if(
3315                         [$2],
3316                         [disable],
3317                         [dnl
3318                         m4_define([EnDis],[enabled])dnl
3319                         m4_define([YesNo],[yes])dnl
3320                         ],
3321                         [dnl
3322                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3323                         ]dnl
3324                 )]dnl
3325         )dnl
3326         m4_if([$3], [feature], [],
3327                 [m4_if(
3328                         [$3], [module], [],
3329                         [dnl
3330                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3331                         ]dnl
3332                 )]dnl
3333         )dnl
3334         AC_ARG_ENABLE(
3335                 [$1],
3336                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3337                 [],
3338                 enable_$1='[YesNo]'dnl
3339         )# AC_ARG_ENABLE
3340 if test "x$enable_$1" = "xno"
3341 then
3342         collectd_$1=0
3343 else
3344         if test "x$enable_$1" = "xyes"
3345         then
3346                 collectd_$1=1
3347         else
3348                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3349                 collectd_$1=1
3350                 enable_$1='yes'
3351         fi
3352 fi
3353         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3354         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3355         ]dnl
3356 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3357
3358 # AC_PLUGIN(name, default, info)
3359 # ------------------------------------------------------------
3360 dnl
3361 AC_DEFUN(
3362   [AC_PLUGIN],
3363   [
3364     enable_plugin="no"
3365     force="no"
3366     AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3367     [
3368      if test "x$enableval" = "xyes"
3369      then
3370              enable_plugin="yes"
3371      else if test "x$enableval" = "xforce"
3372      then
3373              enable_plugin="yes"
3374              force="yes"
3375      else
3376              enable_plugin="no"
3377      fi; fi
3378     ],
3379     [
3380          if test "x$enable_all_plugins" = "xauto"
3381          then
3382              if test "x$2" = "xyes"
3383              then
3384                      enable_plugin="yes"
3385              else
3386                      enable_plugin="no"
3387              fi
3388          else
3389              enable_plugin="$enable_all_plugins"
3390          fi
3391     ])
3392     if test "x$enable_plugin" = "xyes"
3393     then
3394             if test "x$2" = "xyes" || test "x$force" = "xyes"
3395             then
3396                     AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3397                     if test "x$2" != "xyes"
3398                     then
3399                             dependency_warning="yes"
3400                     fi
3401             else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3402                     dependency_error="yes"
3403                     enable_plugin="no (dependency error)"
3404             fi
3405     fi
3406     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3407     enable_$1="$enable_plugin"
3408   ]
3409 )# AC_PLUGIN(name, default, info)
3410
3411 m4_divert_once([HELP_ENABLE], [
3412 collectd features:])
3413 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3414 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
3415 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
3416 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
3417
3418 dependency_warning="no"
3419 dependency_error="no"
3420
3421 plugin_ascent="no"
3422 plugin_battery="no"
3423 plugin_bind="no"
3424 plugin_conntrack="no"
3425 plugin_couchdb="no"
3426 plugin_cpu="no"
3427 plugin_cpufreq="no"
3428 plugin_df="no"
3429 plugin_disk="no"
3430 plugin_entropy="no"
3431 plugin_interface="no"
3432 plugin_ipmi="no"
3433 plugin_ipvs="no"
3434 plugin_irq="no"
3435 plugin_libvirt="no"
3436 plugin_load="no"
3437 plugin_madwifi="no"
3438 plugin_memory="no"
3439 plugin_multimeter="no"
3440 plugin_nfs="no"
3441 plugin_fscache="no"
3442 plugin_perl="no"
3443 plugin_processes="no"
3444 plugin_protocols="no"
3445 plugin_serial="no"
3446 plugin_swap="no"
3447 plugin_tape="no"
3448 plugin_tcpconns="no"
3449 plugin_ted="no"
3450 plugin_thermal="no"
3451 plugin_users="no"
3452 plugin_uptime="no"
3453 plugin_vmem="no"
3454 plugin_vserver="no"
3455 plugin_wireless="no"
3456
3457 # Linux
3458 if test "x$ac_system" = "xLinux"
3459 then
3460         plugin_battery="yes"
3461         plugin_conntrack="yes"
3462         plugin_cpu="yes"
3463         plugin_cpufreq="yes"
3464         plugin_disk="yes"
3465         plugin_entropy="yes"
3466         plugin_interface="yes"
3467         plugin_irq="yes"
3468         plugin_load="yes"
3469         plugin_madwifi="yes"
3470         plugin_memory="yes"
3471         plugin_nfs="yes"
3472         plugin_fscache="yes"
3473         plugin_processes="yes"
3474         plugin_protocols="yes"
3475         plugin_serial="yes"
3476         plugin_swap="yes"
3477         plugin_tcpconns="yes"
3478         plugin_thermal="yes"
3479         plugin_uptime="yes"
3480         plugin_vmem="yes"
3481         plugin_vserver="yes"
3482         plugin_wireless="yes"
3483
3484         if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
3485         then
3486                 plugin_ipvs="yes"
3487         fi
3488 fi
3489
3490 if test "x$ac_system" = "xOpenBSD"
3491 then
3492         plugin_tcpconns="yes"
3493 fi
3494
3495 # Mac OS X devices
3496 if test "x$with_libiokit" = "xyes"
3497 then
3498         plugin_battery="yes"
3499         plugin_disk="yes"
3500 fi
3501
3502 # Solaris
3503 if test "x$with_kstat" = "xyes"
3504 then
3505         plugin_uptime="yes"
3506 fi
3507
3508 if test "x$with_devinfo$with_kstat" = "xyesyes"
3509 then
3510         plugin_cpu="yes"
3511         plugin_disk="yes"
3512         plugin_interface="yes"
3513         plugin_memory="yes"
3514         plugin_tape="yes"
3515 fi
3516
3517 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
3518 then
3519         plugin_swap="yes"
3520 fi
3521
3522 # libstatgrab
3523 if test "x$with_libstatgrab" = "xyes"
3524 then
3525         plugin_cpu="yes"
3526         plugin_disk="yes"
3527         plugin_interface="yes"
3528         plugin_load="yes"
3529         plugin_memory="yes"
3530         plugin_swap="yes"
3531         plugin_users="yes"
3532 fi
3533
3534 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
3535 then
3536         plugin_ascent="yes"
3537         plugin_bind="yes"
3538 fi
3539
3540 if test "x$with_libopenipmipthread" = "xyes"
3541 then
3542         plugin_ipmi="yes"
3543 fi
3544
3545 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
3546 then
3547         plugin_couchdb="yes"
3548 fi
3549
3550 if test "x$have_processor_info" = "xyes"
3551 then
3552         plugin_cpu="yes"
3553 fi
3554 if test "x$have_sysctl" = "xyes"
3555 then
3556         plugin_cpu="yes"
3557         plugin_memory="yes"
3558         plugin_swap="yes"
3559         plugin_uptime="yes"
3560 fi
3561 if test "x$have_sysctlbyname" = "xyes"
3562 then
3563         plugin_cpu="yes"
3564         plugin_memory="yes"
3565         plugin_tcpconns="yes"
3566 fi
3567
3568 # Df plugin: Check if we know how to determine mount points first.
3569 #if test "x$have_listmntent" = "xyes"; then
3570 #       plugin_df="yes"
3571 #fi
3572 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
3573 then
3574         plugin_df="yes"
3575 fi
3576 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
3577 then
3578         plugin_df="yes"
3579 fi
3580 #if test "x$have_getmntent" = "xseq"
3581 #then
3582 #       plugin_df="yes"
3583 #fi
3584 if test "x$c_cv_have_one_getmntent" = "xyes"
3585 then
3586         plugin_df="yes"
3587 fi
3588
3589 # Df plugin: Check if we have either `statfs' or `statvfs' second.
3590 if test "x$plugin_df" = "xyes"
3591 then
3592         plugin_df="no"
3593         if test "x$have_statfs" = "xyes"
3594         then
3595                 plugin_df="yes"
3596         fi
3597         if test "x$have_statvfs" = "xyes"
3598         then
3599                 plugin_df="yes"
3600         fi
3601 fi
3602
3603 if test "x$have_getifaddrs" = "xyes"
3604 then
3605         plugin_interface="yes"
3606 fi
3607
3608 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
3609 then
3610         plugin_libvirt="yes"
3611 fi
3612
3613 if test "x$have_getloadavg" = "xyes"
3614 then
3615         plugin_load="yes"
3616 fi
3617
3618 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
3619 then
3620         plugin_perl="yes"
3621 fi
3622
3623 # Mac OS X memory interface
3624 if test "x$have_host_statistics" = "xyes"
3625 then
3626         plugin_memory="yes"
3627 fi
3628
3629 if test "x$have_termios_h" = "xyes"
3630 then
3631         plugin_multimeter="yes"
3632         plugin_ted="yes"
3633 fi
3634
3635 if test "x$have_thread_info" = "xyes"
3636 then
3637         plugin_processes="yes"
3638 fi
3639
3640 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
3641 then
3642         plugin_processes="yes"
3643 fi
3644
3645 if test "x$with_kvm_getswapinfo" = "xyes"
3646 then
3647         plugin_swap="yes"
3648 fi
3649
3650 if test "x$have_swapctl" = "xyes"
3651 then
3652         plugin_swap="yes"
3653 fi
3654
3655 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
3656 then
3657         plugin_tcpconns="yes"
3658 fi
3659
3660 if test "x$have_getutent" = "xyes"
3661 then
3662         plugin_users="yes"
3663 fi
3664 if test "x$have_getutxent" = "xyes"
3665 then
3666         plugin_users="yes"
3667 fi
3668
3669 m4_divert_once([HELP_ENABLE], [
3670 collectd plugins:])
3671
3672 AC_ARG_ENABLE([all-plugins],
3673                 AC_HELP_STRING([--enable-all-plugins],
3674                                 [enable all plugins (auto by def)]),
3675                 [
3676                  if test "x$enableval" = "xyes"
3677                  then
3678                          enable_all_plugins="yes"
3679                  else if test "x$enableval" = "xauto"
3680                  then
3681                          enable_all_plugins="auto"
3682                  else
3683                          enable_all_plugins="no"
3684                  fi; fi
3685                 ],
3686                 [enable_all_plugins="auto"])
3687
3688 m4_divert_once([HELP_ENABLE], [])
3689
3690 AC_PLUGIN([apache],      [$with_libcurl],      [Apache httpd statistics])
3691 AC_PLUGIN([apcups],      [yes],                [Statistics of UPSes by APC])
3692 AC_PLUGIN([apple_sensors], [$with_libiokit],   [Apple's hardware sensors])
3693 AC_PLUGIN([ascent],      [$plugin_ascent],     [AscentEmu player statistics])
3694 AC_PLUGIN([battery],     [$plugin_battery],    [Battery statistics])
3695 AC_PLUGIN([bind],        [$plugin_bind],       [ISC Bind nameserver statistics])
3696 AC_PLUGIN([conntrack],   [$plugin_conntrack],  [nf_conntrack statistics])
3697 AC_PLUGIN([couchdb],     [$plugin_couchdb],    [CouchDB statistics])
3698 AC_PLUGIN([cpufreq],     [$plugin_cpufreq],    [CPU frequency statistics])
3699 AC_PLUGIN([cpu],         [$plugin_cpu],        [CPU usage statistics])
3700 AC_PLUGIN([csv],         [yes],                [CSV output plugin])
3701 AC_PLUGIN([curl],        [$with_libcurl],      [CURL generic web statistics])
3702 AC_PLUGIN([dbi],         [$with_libdbi],       [General database statistics])
3703 AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
3704 AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
3705 AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
3706 AC_PLUGIN([email],       [yes],                [EMail statistics])
3707 AC_PLUGIN([entropy],     [$plugin_entropy],    [Entropy statistics])
3708 AC_PLUGIN([exec],        [yes],                [Execution of external programs])
3709 AC_PLUGIN([filecount],   [yes],                [Count files in directories])
3710 AC_PLUGIN([fscache],     [$plugin_fscache],    [fscache statistics])
3711 AC_PLUGIN([gmond],       [$with_libganglia],   [Ganglia plugin])
3712 AC_PLUGIN([hddtemp],     [yes],                [Query hddtempd])
3713 AC_PLUGIN([interface],   [$plugin_interface],  [Interface traffic statistics])
3714 AC_PLUGIN([ipmi],        [$plugin_ipmi],       [IPMI sensor statistics])
3715 AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
3716 AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
3717 AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
3718 AC_PLUGIN([java],        [$with_java],         [Embed the Java Virtual Machine])
3719 AC_PLUGIN([libvirt],     [$plugin_libvirt],    [Virtual machine statistics])
3720 AC_PLUGIN([load],        [$plugin_load],       [System load])
3721 AC_PLUGIN([logfile],     [yes],                [File logging plugin])
3722 AC_PLUGIN([madwifi],     [$plugin_madwifi],    [Madwifi wireless statistics])
3723 AC_PLUGIN([match_empty_counter], [yes],        [The empty counter match])
3724 AC_PLUGIN([match_regex], [yes],                [The regex match])
3725 AC_PLUGIN([match_timediff], [yes],             [The timediff match])
3726 AC_PLUGIN([match_value], [yes],                [The value match])
3727 AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
3728 AC_PLUGIN([memcachec],   [$with_libmemcached], [memcachec statistics])
3729 AC_PLUGIN([memcached],   [yes],                [memcached statistics])
3730 AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
3731 AC_PLUGIN([multimeter],  [$plugin_multimeter], [Read multimeter values])
3732 AC_PLUGIN([mysql],       [$with_libmysql],     [MySQL statistics])
3733 AC_PLUGIN([netlink],     [$with_libnetlink],   [Enhanced Linux network statistics])
3734 AC_PLUGIN([network],     [yes],                [Network communication plugin])
3735 AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
3736 AC_PLUGIN([nginx],       [$with_libcurl],      [nginx statistics])
3737 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
3738 AC_PLUGIN([notify_email], [$with_libesmtp],    [Email notifier])
3739 AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
3740 AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
3741 AC_PLUGIN([olsrd],       [yes],                [olsrd statistics])
3742 AC_PLUGIN([onewire],     [$with_libowcapi],    [OneWire sensor statistics])
3743 AC_PLUGIN([openvpn],     [yes],                [OpenVPN client statistics])
3744 AC_PLUGIN([oracle],      [$with_oracle],       [Oracle plugin])
3745 AC_PLUGIN([perl],        [$plugin_perl],       [Embed a Perl interpreter])
3746 AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
3747 AC_PLUGIN([postgresql],  [$with_libpq],        [PostgreSQL database statistics])
3748 AC_PLUGIN([powerdns],    [yes],                [PowerDNS statistics])
3749 AC_PLUGIN([processes],   [$plugin_processes],  [Process statistics])
3750 AC_PLUGIN([protocols],   [$plugin_protocols],  [Protocol (IP, TCP, ...) statistics])
3751 AC_PLUGIN([rrdcached],   [$librrd_rrdc_update], [RRDTool output plugin])
3752 AC_PLUGIN([rrdtool],     [$with_librrd],       [RRDTool output plugin])
3753 AC_PLUGIN([sensors],     [$with_libsensors],   [lm_sensors statistics])
3754 AC_PLUGIN([serial],      [$plugin_serial],     [serial port traffic])
3755 AC_PLUGIN([snmp],        [$with_libnetsnmp],   [SNMP querying plugin])
3756 AC_PLUGIN([swap],        [$plugin_swap],       [Swap usage statistics])
3757 AC_PLUGIN([syslog],      [$have_syslog],       [Syslog logging plugin])
3758 AC_PLUGIN([table],       [yes],                [Parsing of tabular data])
3759 AC_PLUGIN([tail],        [yes],                [Parsing of logfiles])
3760 AC_PLUGIN([tape],        [$plugin_tape],       [Tape drive statistics])
3761 AC_PLUGIN([target_notification], [yes],        [The notification target])
3762 AC_PLUGIN([target_replace], [yes],             [The replace target])
3763 AC_PLUGIN([target_set],  [yes],                [The set target])
3764 AC_PLUGIN([tcpconns],    [$plugin_tcpconns],   [TCP connection statistics])
3765 AC_PLUGIN([teamspeak2],  [yes],                [TeamSpeak2 server statistics])
3766 AC_PLUGIN([ted],         [$plugin_ted],        [Read The Energy Detective values])
3767 AC_PLUGIN([thermal],     [$plugin_thermal],    [Linux ACPI thermal zone statistics])
3768 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant],  [TokyoTyrant database statistics])
3769 AC_PLUGIN([unixsock],    [yes],                [Unixsock communication plugin])
3770 AC_PLUGIN([uptime],      [$plugin_uptime],     [Uptime statistics])
3771 AC_PLUGIN([users],       [$plugin_users],      [User statistics])
3772 AC_PLUGIN([uuid],        [yes],                [UUID as hostname plugin])
3773 AC_PLUGIN([vmem],        [$plugin_vmem],       [Virtual memory statistics])
3774 AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
3775 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
3776 AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
3777
3778 dnl Default configuration file
3779 # Load either syslog or logfile
3780 LOAD_PLUGIN_SYSLOG=""
3781 LOAD_PLUGIN_LOGFILE=""
3782
3783 AC_MSG_CHECKING([which default log plugin to load])
3784 default_log_plugin="none"
3785 if test "x$enable_syslog" = "xyes"
3786 then
3787         default_log_plugin="syslog"
3788 else
3789         LOAD_PLUGIN_SYSLOG="##"
3790 fi
3791
3792 if test "x$enable_logfile" = "xyes"
3793 then
3794         if test "x$default_log_plugin" = "xnone"
3795         then
3796                 default_log_plugin="logfile"
3797         else
3798                 LOAD_PLUGIN_LOGFILE="#"
3799         fi
3800 else
3801         LOAD_PLUGIN_LOGFILE="##"
3802 fi
3803 AC_MSG_RESULT([$default_log_plugin])
3804
3805 AC_SUBST(LOAD_PLUGIN_SYSLOG)
3806 AC_SUBST(LOAD_PLUGIN_LOGFILE)
3807
3808 DEFAULT_LOG_LEVEL="info"
3809 if test "x$enable_debug" = "xyes"
3810 then
3811         DEFAULT_LOG_LEVEL="debug"
3812 fi
3813 AC_SUBST(DEFAULT_LOG_LEVEL)
3814
3815 # Load only one of rrdtool, network, csv in the default config.
3816 LOAD_PLUGIN_RRDTOOL=""
3817 LOAD_PLUGIN_NETWORK=""
3818 LOAD_PLUGIN_CSV=""
3819
3820 AC_MSG_CHECKING([which default write plugin to load])
3821 default_write_plugin="none"
3822 if test "x$enable_rrdtool" = "xyes"
3823 then
3824         default_write_plugin="rrdtool"
3825 else
3826         LOAD_PLUGIN_RRDTOOL="##"
3827 fi
3828
3829 if test "x$enable_network" = "xyes"
3830 then
3831         if test "x$default_write_plugin" = "xnone"
3832         then
3833                 default_write_plugin="network"
3834         else
3835                 LOAD_PLUGIN_NETWORK="#"
3836         fi
3837 else
3838         LOAD_PLUGIN_NETWORK="##"
3839 fi
3840
3841 if test "x$enable_csv" = "xyes"
3842 then
3843         if test "x$default_write_plugin" = "xnone"
3844         then
3845                 default_write_plugin="csv"
3846         else
3847                 LOAD_PLUGIN_CSV="#"
3848         fi
3849 else
3850         LOAD_PLUGIN_CSV="##"
3851 fi
3852 AC_MSG_RESULT([$default_write_plugin])
3853
3854 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
3855 AC_SUBST(LOAD_PLUGIN_NETWORK)
3856 AC_SUBST(LOAD_PLUGIN_CSV)
3857
3858 dnl ip_vs.h
3859 if test "x$ac_system" = "xLinux" \
3860         && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
3861 then
3862         enable_ipvs="$enable_ipvs (ip_vs.h not found)"
3863 fi
3864
3865 dnl Perl bindings
3866 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
3867 [
3868         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3869         then
3870                 PERL_BINDINGS_OPTIONS="$withval"
3871                 with_perl_bindings="yes"
3872         else
3873                 PERL_BINDINGS_OPTIONS=""
3874                 with_perl_bindings="$withval"
3875         fi
3876 ],
3877 [
3878         PERL_BINDINGS_OPTIONS=""
3879         if test -n "$perl_interpreter"
3880         then
3881                 with_perl_bindings="yes"
3882         else
3883                 with_perl_bindings="no (no perl interpreter found)"
3884         fi
3885 ])
3886 if test "x$with_perl_bindings" = "xyes"
3887 then
3888         PERL_BINDINGS="perl"
3889 else
3890         PERL_BINDINGS=""
3891 fi
3892 AC_SUBST(PERL_BINDINGS)
3893 AC_SUBST(PERL_BINDINGS_OPTIONS)
3894
3895 dnl libcollectdclient
3896 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
3897 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
3898 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
3899
3900 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
3901
3902 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
3903
3904 AC_SUBST(LCC_VERSION_MAJOR)
3905 AC_SUBST(LCC_VERSION_MINOR)
3906 AC_SUBST(LCC_VERSION_PATCH)
3907 AC_SUBST(LCC_VERSION_EXTRA)
3908 AC_SUBST(LCC_VERSION_STRING)
3909
3910 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
3911
3912 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/libiptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
3913
3914 if test "x$with_librrd" = "xyes" \
3915         && test "x$librrd_threadsafe" != "xyes"
3916 then
3917         with_librrd="yes (warning: librrd is not thread-safe)"
3918 fi
3919
3920 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
3921 then
3922         with_libiptc="yes (shipped version)"
3923 fi
3924
3925 if test "x$with_libperl" = "xyes"
3926 then
3927         with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
3928 else
3929         enable_perl="no (needs libperl)"
3930 fi
3931
3932 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
3933 then
3934         enable_perl="no (libperl doesn't support ithreads)"
3935 fi
3936
3937 if test "x$with_perl_bindings" = "xyes" \
3938         && test "x$PERL_BINDINGS_OPTIONS" != "x"
3939 then
3940         with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
3941 fi
3942
3943 cat <<EOF;
3944
3945 Configuration:
3946   Libraries:
3947     libcurl . . . . . . . $with_libcurl
3948     libdbi  . . . . . . . $with_libdbi
3949     libesmtp  . . . . . . $with_libesmtp
3950     libganglia  . . . . . $with_libganglia
3951     libgcrypt . . . . . . $with_libgcrypt
3952     libiokit  . . . . . . $with_libiokit
3953     libiptc . . . . . . . $with_libiptc
3954     libjvm  . . . . . . . $with_java
3955     libkstat  . . . . . . $with_kstat
3956     libkvm  . . . . . . . $with_libkvm
3957     libmemcached  . . . . $with_libmemcached
3958     libmysql  . . . . . . $with_libmysql
3959     libnetlink  . . . . . $with_libnetlink
3960     libnetsnmp  . . . . . $with_libnetsnmp
3961     libnotify . . . . . . $with_libnotify
3962     liboconfig  . . . . . $with_liboconfig
3963     libopenipmi . . . . . $with_libopenipmipthread
3964     liboping  . . . . . . $with_liboping
3965     libpcap . . . . . . . $with_libpcap
3966     libperl . . . . . . . $with_libperl
3967     libpq . . . . . . . . $with_libpq
3968     libpthread  . . . . . $with_libpthread
3969     librrd  . . . . . . . $with_librrd
3970     libsensors  . . . . . $with_libsensors
3971     libstatgrab . . . . . $with_libstatgrab
3972     libtokyotyrant  . . . $with_libtokyotyrant
3973     libupsclient  . . . . $with_libupsclient
3974     libvirt . . . . . . . $with_libvirt
3975     libxml2 . . . . . . . $with_libxml2
3976     libxmms . . . . . . . $with_libxmms
3977     libyajl . . . . . . . $with_libyajl
3978     oracle  . . . . . . . $with_oracle
3979
3980   Features:
3981     daemon mode . . . . . $enable_daemon
3982     debug . . . . . . . . $enable_debug
3983
3984   Bindings:
3985     perl  . . . . . . . . $with_perl_bindings
3986
3987   Modules:
3988     apache  . . . . . . . $enable_apache
3989     apcups  . . . . . . . $enable_apcups
3990     apple_sensors . . . . $enable_apple_sensors
3991     ascent  . . . . . . . $enable_ascent
3992     battery . . . . . . . $enable_battery
3993     bind  . . . . . . . . $enable_bind
3994     conntrack . . . . . . $enable_conntrack
3995     couchdb . . . . . . . $enable_couchdb
3996     cpu . . . . . . . . . $enable_cpu
3997     cpufreq . . . . . . . $enable_cpufreq
3998     csv . . . . . . . . . $enable_csv
3999     curl  . . . . . . . . $enable_curl
4000     dbi . . . . . . . . . $enable_dbi
4001     df  . . . . . . . . . $enable_df
4002     disk  . . . . . . . . $enable_disk
4003     dns . . . . . . . . . $enable_dns
4004     email . . . . . . . . $enable_email
4005     entropy . . . . . . . $enable_entropy
4006     exec  . . . . . . . . $enable_exec
4007     filecount . . . . . . $enable_filecount
4008     fscache . . . . . . . $enable_fscache
4009     gmond . . . . . . . . $enable_gmond
4010     hddtemp . . . . . . . $enable_hddtemp
4011     interface . . . . . . $enable_interface
4012     ipmi  . . . . . . . . $enable_ipmi
4013     iptables  . . . . . . $enable_iptables
4014     ipvs  . . . . . . . . $enable_ipvs
4015     irq . . . . . . . . . $enable_irq
4016     java  . . . . . . . . $enable_java
4017     libvirt . . . . . . . $enable_libvirt
4018     load  . . . . . . . . $enable_load
4019     logfile . . . . . . . $enable_logfile
4020     madwifi . . . . . . . $enable_madwifi
4021     match_empty_counter . $enable_match_empty_counter
4022     match_regex . . . . . $enable_match_regex
4023     match_timediff  . . . $enable_match_timediff
4024     match_value . . . . . $enable_match_value
4025     mbmon . . . . . . . . $enable_mbmon
4026     memcachec . . . . . . $enable_memcachec
4027     memcached . . . . . . $enable_memcached
4028     memory  . . . . . . . $enable_memory
4029     multimeter  . . . . . $enable_multimeter
4030     mysql . . . . . . . . $enable_mysql
4031     netlink . . . . . . . $enable_netlink
4032     network . . . . . . . $enable_network
4033     nfs . . . . . . . . . $enable_nfs
4034     nginx . . . . . . . . $enable_nginx
4035     notify_desktop  . . . $enable_notify_desktop
4036     notify_email  . . . . $enable_notify_email
4037     ntpd  . . . . . . . . $enable_ntpd
4038     nut . . . . . . . . . $enable_nut
4039     olsrd . . . . . . . . $enable_olsrd
4040     onewire . . . . . . . $enable_onewire
4041     openvpn . . . . . . . $enable_openvpn
4042     oracle  . . . . . . . $enable_oracle
4043     perl  . . . . . . . . $enable_perl
4044     ping  . . . . . . . . $enable_ping
4045     postgresql  . . . . . $enable_postgresql
4046     powerdns  . . . . . . $enable_powerdns
4047     processes . . . . . . $enable_processes
4048     protocols . . . . . . $enable_protocols
4049     rrdcached . . . . . . $enable_rrdcached
4050     rrdtool . . . . . . . $enable_rrdtool
4051     sensors . . . . . . . $enable_sensors
4052     serial  . . . . . . . $enable_serial
4053     snmp  . . . . . . . . $enable_snmp
4054     swap  . . . . . . . . $enable_swap
4055     syslog  . . . . . . . $enable_syslog
4056     table . . . . . . . . $enable_table
4057     tail  . . . . . . . . $enable_tail
4058     tape  . . . . . . . . $enable_tape
4059     target_notification . $enable_target_notification
4060     target_replace  . . . $enable_target_replace
4061     target_set  . . . . . $enable_target_set
4062     tcpconns  . . . . . . $enable_tcpconns
4063     teamspeak2  . . . . . $enable_teamspeak2
4064     ted . . . . . . . . . $enable_ted
4065     tokyotyrant . . . . . $enable_tokyotyrant
4066     thermal . . . . . . . $enable_thermal
4067     unixsock  . . . . . . $enable_unixsock
4068     uptime  . . . . . . . $enable_uptime
4069     users . . . . . . . . $enable_users
4070     uuid  . . . . . . . . $enable_uuid
4071     vmem  . . . . . . . . $enable_vmem
4072     vserver . . . . . . . $enable_vserver
4073     wireless  . . . . . . $enable_wireless
4074     xmms  . . . . . . . . $enable_xmms
4075
4076 EOF
4077
4078 if test "x$dependency_error" = "xyes"; then
4079         AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4080 fi
4081
4082 if test "x$dependency_warning" = "xyes"; then
4083         AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4084 fi
4085
4086 # vim: set fdm=marker :