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