Merge branch 'collectd-4.7' into collectd-4.8
[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/owniptc/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 if test "x$with_libiptc" = "xyes"
1507 then
1508         SAVE_CFLAGS=$CFLAGS
1509         CFLAGS="$CFLAGS $KERNEL_CFLAGS"
1510
1511         AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [],
1512         [
1513 #if OWN_LIBIPTC
1514 # include "$srcdir/src/owniptc/libiptc.h"
1515 # include "$srcdir/src/owniptc/libip6tc.h"
1516 #else
1517 # include <libiptc/libiptc.h>
1518 # include <libiptc/libip6tc.h>
1519 #endif
1520         ])
1521
1522         CFLAGS=$SAVE_CFLAGS
1523 fi
1524 # }}}
1525
1526 # --with-java {{{
1527 with_java_home="$JAVA_HOME"
1528 with_java_vmtype="client"
1529 with_java_cflags=""
1530 with_java_libs=""
1531 JAVAC="$JAVAC"
1532 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
1533 [
1534         if test "x$withval" = "xno"
1535         then
1536                 with_java="no"
1537         else if test "x$withval" = "xyes"
1538         then
1539                 with_java="yes"
1540         else
1541                 with_java_home="$withval"
1542                 with_java="yes"
1543         fi; fi
1544 ],
1545 [with_java="yes"])
1546 if test "x$with_java" = "xyes"
1547 then
1548         if test -d "$with_java_home"
1549         then
1550                 AC_MSG_CHECKING([for jni.h])
1551                 TMPDIR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1552                 if test "x$TMPDIR" != "x"
1553                 then
1554                         AC_MSG_RESULT([found in $TMPDIR])
1555                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1556                 else
1557                         AC_MSG_RESULT([not found])
1558                 fi
1559
1560                 AC_MSG_CHECKING([for jni_md.h])
1561                 TMPDIR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
1562                 if test "x$TMPDIR" != "x"
1563                 then
1564                         AC_MSG_RESULT([found in $TMPDIR])
1565                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
1566                 else
1567                         AC_MSG_RESULT([not found])
1568                 fi
1569
1570                 AC_MSG_CHECKING([for libjvm.so])
1571                 TMPDIR=`find -L "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
1572                 if test "x$TMPDIR" != "x"
1573                 then
1574                         AC_MSG_RESULT([found in $TMPDIR])
1575                         JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
1576                 else
1577                         AC_MSG_RESULT([not found])
1578                 fi
1579
1580                 if test "x$JAVAC" = "x"
1581                 then
1582                         AC_MSG_CHECKING([for javac])
1583                         TMPDIR=`find -L "$with_java_home" -name javac -type f | head -n 1`
1584                         if test "x$TMPDIR" != "x"
1585                         then
1586                                 JAVAC="$TMPDIR"
1587                                 AC_MSG_RESULT([$JAVAC])
1588                         else
1589                                 AC_MSG_RESULT([not found])
1590                         fi
1591                 fi
1592         else if test "x$with_java_home" != "x"
1593         then
1594                 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
1595         fi; fi
1596 fi
1597
1598 if test "x$JAVA_CPPFLAGS" != "x"
1599 then
1600         AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
1601 fi
1602 if test "x$JAVA_CFLAGS" != "x"
1603 then
1604         AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
1605 fi
1606 if test "x$JAVA_LDFLAGS" != "x"
1607 then
1608         AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
1609 fi
1610 if test "x$JAVAC" = "x"
1611 then
1612         with_javac_path="$PATH"
1613         if test "x$with_java_home" != "x"
1614         then
1615                 with_javac_path="$with_java_home:with_javac_path"
1616                 if test -d "$with_java_home/bin"
1617                 then
1618                         with_javac_path="$with_java_home/bin:with_javac_path"
1619                 fi
1620         fi
1621
1622         AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
1623 fi
1624 if test "x$JAVAC" = "x"
1625 then
1626         with_java="no (javac not found)"
1627 fi
1628
1629 SAVE_CPPFLAGS="$CPPFLAGS"
1630 SAVE_CFLAGS="$CFLAGS"
1631 SAVE_LDFLAGS="$LDFLAGS"
1632 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
1633 CFLAGS="$CFLAGS $JAVA_CFLAGS"
1634 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
1635
1636 if test "x$with_java" = "xyes"
1637 then
1638         AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
1639 fi
1640 if test "x$with_java" = "xyes"
1641 then
1642         AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
1643         [with_java="yes"],
1644         [with_java="no (libjvm not found)"],
1645         [$JAVA_LIBS])
1646 fi
1647 if test "x$with_java" = "xyes"
1648 then
1649         JAVA_LIBS="$JAVA_LIBS -ljvm"
1650         AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
1651 fi
1652
1653 CPPFLAGS="$SAVE_CPPFLAGS"
1654 CFLAGS="$SAVE_CFLAGS"
1655 LDFLAGS="$SAVE_LDFLAGS"
1656
1657 AC_SUBST(JAVA_CPPFLAGS)
1658 AC_SUBST(JAVA_CFLAGS)
1659 AC_SUBST(JAVA_LDFLAGS)
1660 AC_SUBST(JAVA_LIBS)
1661 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
1662 # }}}
1663
1664 # --with-libmemcached {{{
1665 with_libmemcached_cppflags=""
1666 with_libmemcached_ldflags=""
1667 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
1668 [
1669         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1670         then
1671                 with_libmemcached_cppflags="-I$withval/include"
1672                 with_libmemcached_ldflags="-L$withval/lib"
1673                 with_libmemcached="yes"
1674         else
1675                 with_libmemcached="$withval"
1676         fi
1677 ],
1678 [
1679         with_libmemcached="yes"
1680 ])
1681 if test "x$with_libmemcached" = "xyes"
1682 then
1683         SAVE_CPPFLAGS="$CPPFLAGS"
1684         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1685
1686         AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
1687
1688         CPPFLAGS="$SAVE_CPPFLAGS"
1689 fi
1690 if test "x$with_libmemcached" = "xyes"
1691 then
1692         SAVE_CPPFLAGS="$CPPFLAGS"
1693         SAVE_LDFLAGS="$LDFLAGS"
1694         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
1695         LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
1696
1697         AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
1698
1699         CPPFLAGS="$SAVE_CPPFLAGS"
1700         LDFLAGS="$SAVE_LDFLAGS"
1701 fi
1702 if test "x$with_libmemcached" = "xyes"
1703 then
1704         BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
1705         BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
1706         BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
1707         AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
1708         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
1709         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
1710         AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
1711 fi
1712 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
1713 # }}}
1714
1715 # --with-libmysql {{{
1716 with_mysql_config="mysql_config"
1717 with_mysql_cflags=""
1718 with_mysql_libs=""
1719 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
1720 [
1721         if test "x$withval" = "xno"
1722         then
1723                 with_libmysql="no"
1724         else if test "x$withval" = "xyes"
1725         then
1726                 with_libmysql="yes"
1727         else
1728                 if test -f "$withval" && test -x "$withval";
1729                 then
1730                         with_mysql_config="$withval"
1731                 else if test -x "$withval/bin/mysql_config"
1732                 then
1733                         with_mysql_config="$withval/bin/mysql_config"
1734                 fi; fi
1735                 with_libmysql="yes"
1736         fi; fi
1737 ],
1738 [
1739         with_libmysql="yes"
1740 ])
1741 if test "x$with_libmysql" = "xyes"
1742 then
1743         with_mysql_cflags=`$with_mysql_config --cflags 2>/dev/null`
1744         mysql_config_status=$?
1745
1746         if test $mysql_config_status -ne 0
1747         then
1748                 with_libmysql="no ($with_mysql_config failed)"
1749         else
1750                 SAVE_CPPFLAGS="$CPPFLAGS"
1751                 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
1752
1753                 have_mysql_h="no"
1754                 have_mysql_mysql_h="no"
1755                 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
1756
1757                 if test "x$have_mysql_h" = "xno"
1758                 then
1759                         AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
1760                 fi
1761
1762                 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
1763                 then
1764                         with_libmysql="no (mysql.h not found)"
1765                 fi
1766
1767                 CPPFLAGS="$SAVE_CPPFLAGS"
1768         fi
1769 fi
1770 if test "x$with_libmysql" = "xyes"
1771 then
1772         with_mysql_libs=`$with_mysql_config --libs 2>/dev/null`
1773         mysql_config_status=$?
1774
1775         if test $mysql_config_status -ne 0
1776         then
1777                 with_libmysql="no ($with_mysql_config failed)"
1778         else
1779                 AC_CHECK_LIB(mysqlclient, mysql_init,
1780                  [with_libmysql="yes"],
1781                  [with_libmysql="no (symbol 'mysql_init' not found)"],
1782                  [$with_mysql_libs])
1783
1784                 AC_CHECK_LIB(mysqlclient, mysql_get_server_version,
1785                  [with_libmysql="yes"],
1786                  [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
1787                  [$with_mysql_libs])
1788         fi
1789 fi
1790 if test "x$with_libmysql" = "xyes"
1791 then
1792         BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
1793         BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
1794         AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
1795         AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
1796 fi
1797 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
1798 # }}}
1799
1800 # --with-libnetlink {{{
1801 with_libnetlink_cflags=""
1802 with_libnetlink_libs="-lnetlink"
1803 AC_ARG_WITH(libnetlink, [AS_HELP_STRING([--with-libnetlink@<:@=PREFIX@:>@], [Path to libnetlink.])],
1804 [
1805  echo "libnetlink: withval = $withval"
1806  if test "x$withval" = "xyes"
1807  then
1808          with_libnetlink="yes"
1809  else if test "x$withval" = "xno"
1810  then
1811          with_libnetlink="no"
1812  else
1813          if test -d "$withval/include"
1814          then
1815                  with_libnetlink_cflags="-I$withval/include"
1816                  with_libnetlink_libs="-L$withval/lib -lnetlink"
1817                  with_libnetlink="yes"
1818          else
1819                  AC_MSG_ERROR("no such directory: $withval/include")
1820          fi
1821  fi; fi
1822 ],
1823 [
1824  if test "x$ac_system" = "xLinux"
1825  then
1826          with_libnetlink="yes"
1827  else
1828          with_libnetlink="no (Linux only library)"
1829  fi
1830 ])
1831 if test "x$with_libnetlink" = "xyes"
1832 then
1833         SAVE_CFLAGS=$CFLAGS
1834         CFLAGS="$CFLAGS $with_libnetlink_cflags"
1835
1836         with_libnetlink="no (libnetlink.h not found)"
1837
1838         AC_CHECK_HEADERS(libnetlink.h iproute/libnetlink.h linux/libnetlink.h,
1839         [
1840          with_libnetlink="yes"
1841          break
1842         ], [],
1843 [#include <stdio.h>
1844 #include <sys/types.h>
1845 #include <asm/types.h>
1846 #include <sys/socket.h>
1847 #include <linux/netlink.h>
1848 #include <linux/rtnetlink.h>])
1849         AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
1850 [#include <stdio.h>
1851 #include <sys/types.h>
1852 #include <asm/types.h>
1853 #include <sys/socket.h>])
1854
1855         AC_COMPILE_IFELSE(
1856 [#include <stdio.h>
1857 #include <sys/types.h>
1858 #include <asm/types.h>
1859 #include <sys/socket.h>
1860 #include <linux/netlink.h>
1861 #include <linux/rtnetlink.h>
1862
1863 int main (void)
1864 {
1865         int retval = TCA_STATS2;
1866         return (retval);
1867 }],
1868         [AC_DEFINE([HAVE_TCA_STATS2], 1, [True if the enum-member TCA_STATS2 exists])]
1869         []);
1870
1871         AC_COMPILE_IFELSE(
1872 [#include <stdio.h>
1873 #include <sys/types.h>
1874 #include <asm/types.h>
1875 #include <sys/socket.h>
1876 #include <linux/netlink.h>
1877 #include <linux/rtnetlink.h>
1878
1879 int main (void)
1880 {
1881         int retval = TCA_STATS;
1882         return (retval);
1883 }],
1884         [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])]
1885         []);
1886
1887         CFLAGS="$SAVE_CFLAGS"
1888 fi
1889 if test "x$with_libnetlink" = "xyes"
1890 then
1891         AC_CHECK_LIB(netlink, rtnl_open,
1892                      [with_libnetlink="yes"],
1893                      [with_libnetlink="no (symbol 'rtnl_open' not found)"],
1894                      [$with_libnetlink_libs])
1895 fi
1896 if test "x$with_libnetlink" = "xyes"
1897 then
1898         BUILD_WITH_LIBNETLINK_CFLAGS="$with_libnetlink_cflags"
1899         BUILD_WITH_LIBNETLINK_LIBS="$with_libnetlink_libs"
1900         AC_SUBST(BUILD_WITH_LIBNETLINK_CFLAGS)
1901         AC_SUBST(BUILD_WITH_LIBNETLINK_LIBS)
1902 fi
1903 AM_CONDITIONAL(BUILD_WITH_LIBNETLINK, test "x$with_libnetlink" = "xyes")
1904 # }}}
1905
1906 # --with-libnetsnmp {{{
1907 with_snmp_config="net-snmp-config"
1908 with_snmp_cflags=""
1909 with_snmp_libs=""
1910 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
1911 [
1912         if test "x$withval" = "xno"
1913         then
1914                 with_libnetsnmp="no"
1915         else if test "x$withval" = "xyes"
1916         then
1917                 with_libnetsnmp="yes"
1918         else
1919                 if test -x "$withval"
1920                 then
1921                         with_snmp_config="$withval"
1922                         with_libnetsnmp="yes"
1923                 else
1924                         with_snmp_config="$withval/bin/net-snmp-config"
1925                         with_libnetsnmp="yes"
1926                 fi
1927         fi; fi
1928 ],
1929 [with_libnetsnmp="yes"])
1930 if test "x$with_libnetsnmp" = "xyes"
1931 then
1932         with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
1933         snmp_config_status=$?
1934
1935         if test $snmp_config_status -ne 0
1936         then
1937                 with_libnetsnmp="no ($with_snmp_config failed)"
1938         else
1939                 SAVE_CPPFLAGS="$CPPFLAGS"
1940                 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
1941                 
1942                 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
1943
1944                 CPPFLAGS="$SAVE_CPPFLAGS"
1945         fi
1946 fi
1947 if test "x$with_libnetsnmp" = "xyes"
1948 then
1949         with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
1950         snmp_config_status=$?
1951
1952         if test $snmp_config_status -ne 0
1953         then
1954                 with_libnetsnmp="no ($with_snmp_config failed)"
1955         else
1956                 AC_CHECK_LIB(netsnmp, init_snmp,
1957                 [with_libnetsnmp="yes"],
1958                 [with_libnetsnmp="no (libnetsnmp not found)"],
1959                 [$with_snmp_libs])
1960         fi
1961 fi
1962 if test "x$with_libnetsnmp" = "xyes"
1963 then
1964         BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
1965         BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
1966         AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
1967         AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
1968 fi
1969 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
1970 # }}}
1971
1972 # --with-liboconfig {{{
1973 with_own_liboconfig="no"
1974 liboconfig_LDFLAGS="$LDFLAGS"
1975 liboconfig_CPPFLAGS="$CPPFLAGS"
1976 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
1977 [
1978         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1979         then
1980                 if test -d "$withval/lib"
1981                 then
1982                         liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
1983                 fi
1984                 if test -d "$withval/include"
1985                 then
1986                         liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
1987                 fi
1988         fi
1989         if test "x$withval" = "xno"
1990         then
1991                 AC_MSG_ERROR("liboconfig is required")
1992         fi
1993 ],
1994 [
1995         with_liboconfig="yes"
1996 ])
1997
1998 save_LDFLAGS="$LDFLAGS"
1999 save_CPPFLAGS="$CPPFLAGS"
2000 LDFLAGS="$liboconfig_LDFLAGS"
2001 CPPFLAGS="$liboconfig_CPPFLAGS"
2002 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2003 [
2004         with_liboconfig="yes"
2005         with_own_liboconfig="no"
2006 ],
2007 [
2008         with_liboconfig="yes"
2009         with_own_liboconfig="yes"
2010         LDFLAGS="$save_LDFLAGS"
2011         CPPFLAGS="$save_CPPFLAGS"
2012 ])
2013
2014 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2015 if test "x$with_own_liboconfig" = "xyes"
2016 then
2017         with_liboconfig="yes (shipped version)"
2018 fi
2019 # }}}
2020
2021 # --with-liboping {{{
2022 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2023 [
2024  if test "x$withval" = "xyes"
2025  then
2026          with_liboping="yes"
2027  else if test "x$withval" = "xno"
2028  then
2029          with_liboping="no"
2030  else
2031          with_liboping="yes"
2032          LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2033          LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2034  fi; fi
2035 ],
2036 [with_liboping="yes"])
2037
2038 SAVE_CPPFLAGS="$CPPFLAGS"
2039 SAVE_LDFLAGS="$LDFLAGS"
2040
2041 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2042 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2043
2044 if test "x$with_liboping" = "xyes"
2045 then
2046         if test "x$LIBOPING_CPPFLAGS" != "x"
2047         then
2048                 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2049         fi
2050         AC_CHECK_HEADERS(oping.h,
2051         [with_liboping="yes"],
2052         [with_liboping="no ('oping.h' not found)"])
2053 fi
2054 if test "x$with_liboping" = "xyes"
2055 then
2056         if test "x$LIBOPING_LDFLAGS" != "x"
2057         then
2058                 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2059         fi
2060         AC_CHECK_LIB(oping, ping_construct,
2061         [with_liboping="yes"],
2062         [with_liboping="no (symbol 'ping_construct' not found)"])
2063 fi
2064
2065 CPPFLAGS="$SAVE_CPPFLAGS"
2066 LDFLAGS="$SAVE_LDFLAGS"
2067
2068 if test "x$with_liboping" = "xyes"
2069 then
2070         BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
2071         BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
2072         AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
2073         AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
2074 fi
2075 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
2076 # }}}
2077
2078 # --with-oracle {{{
2079 with_oracle_cppflags=""
2080 with_oracle_libs=""
2081 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
2082 [
2083         if test "x$withval" = "xyes"
2084         then
2085                 if test "x$ORACLE_HOME" = "x"
2086                 then
2087                         AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
2088                 fi
2089                 with_oracle="yes"
2090         else if test "x$withval" = "xno"
2091         then
2092                 with_oracle="no"
2093         else
2094                 with_oracle="yes"
2095                 ORACLE_HOME="$withval"
2096         fi; fi
2097 ],
2098 [
2099         if test "x$ORACLE_HOME" = "x"
2100         then
2101                 with_oracle="no (ORACLE_HOME is not set)"
2102         else
2103                 with_oracle="yes"
2104         fi
2105 ])
2106 if test "x$ORACLE_HOME" != "x"
2107 then
2108         with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
2109
2110         if test -e "$ORACLE_HOME/lib/ldflags"
2111         then
2112                 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
2113         fi
2114         #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
2115         with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
2116 fi
2117 if test "x$with_oracle" = "xyes"
2118 then
2119         SAVE_CPPFLAGS="$CPPFLAGS"
2120         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2121
2122         AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
2123
2124         CPPFLAGS="$SAVE_CPPFLAGS"
2125 fi
2126 if test "x$with_oracle" = "xyes"
2127 then
2128         SAVE_CPPFLAGS="$CPPFLAGS"
2129         SAVE_LDFLAGS="$LDFLAGS"
2130         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
2131         LDFLAGS="$LDFLAGS $with_oracle_libs"
2132
2133         AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
2134
2135         CPPFLAGS="$SAVE_CPPFLAGS"
2136         LDFLAGS="$SAVE_LDFLAGS"
2137 fi
2138 if test "x$with_oracle" = "xyes"
2139 then
2140         BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
2141         BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
2142         AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
2143         AC_SUBST(BUILD_WITH_ORACLE_LIBS)
2144 fi
2145 # }}}
2146
2147 # --with-libowcapi {{{
2148 with_libowcapi_cppflags=""
2149 with_libowcapi_libs="-lowcapi"
2150 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
2151 [
2152         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2153         then
2154                 with_libowcapi_cppflags="-I$withval/include"
2155                 with_libowcapi_libs="-L$withval/lib -lowcapi"
2156                 with_libowcapi="yes"
2157         else
2158                 with_libowcapi="$withval"
2159         fi
2160 ],
2161 [
2162         with_libowcapi="yes"
2163 ])
2164 if test "x$with_libowcapi" = "xyes"
2165 then
2166         SAVE_CPPFLAGS="$CPPFLAGS"
2167         CPPFLAGS="$with_libowcapi_cppflags"
2168         
2169         AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
2170
2171         CPPFLAGS="$SAVE_CPPFLAGS"
2172 fi
2173 if test "x$with_libowcapi" = "xyes"
2174 then
2175         SAVE_LDFLAGS="$LDFLAGS"
2176         SAVE_CPPFLAGS="$CPPFLAGS"
2177         LDFLAGS="$with_libowcapi_libs"
2178         CPPFLAGS="$with_libowcapi_cppflags"
2179         
2180         AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
2181
2182         LDFLAGS="$SAVE_LDFLAGS"
2183         CPPFLAGS="$SAVE_CPPFLAGS"
2184 fi
2185 if test "x$with_libowcapi" = "xyes"
2186 then
2187         BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
2188         BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
2189         AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
2190         AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
2191 fi
2192 # }}}
2193
2194 # --with-libpcap {{{
2195 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
2196 [
2197         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2198         then
2199                 LDFLAGS="$LDFLAGS -L$withval/lib"
2200                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2201                 with_libpcap="yes"
2202         else
2203                 with_libpcap="$withval"
2204         fi
2205 ],
2206 [
2207         with_libpcap="yes"
2208 ])
2209 if test "x$with_libpcap" = "xyes"
2210 then
2211         AC_CHECK_LIB(pcap, pcap_open_live,
2212         [
2213                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
2214         ], [with_libpcap="no (libpcap not found)"])
2215 fi
2216 if test "x$with_libpcap" = "xyes"
2217 then
2218         AC_CHECK_HEADERS(pcap.h,
2219         [
2220                 AC_DEFINE(HAVE_PCAP_H, 1, [Define to 1 if you have the <pcap.h> header file.])
2221         ], [with_libpcap="no (pcap.h not found)"])
2222 fi
2223 if test "x$with_libpcap" = "xyes"
2224 then
2225         collect_libpcap=1
2226 else
2227         collect_libpcap=0
2228 fi
2229 AC_DEFINE_UNQUOTED(COLLECT_LIBPCAP, [$collect_libpcap],
2230         [Wether or not to use the pcap library])
2231 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
2232 # }}}
2233
2234 # --with-libperl {{{
2235 perl_interpreter="perl"
2236 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
2237 [
2238         if test -x "$withval"
2239         then
2240                 perl_interpreter="$withval"
2241                 with_libperl="yes"
2242         else if test "x$withval" != "xno" && test "x$withval" != "xyes"
2243         then
2244                 LDFLAGS="$LDFLAGS -L$withval/lib"
2245                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2246                 perl_interpreter="$withval/bin/perl"
2247                 with_libperl="yes"
2248         else
2249                 with_libperl="$withval"
2250         fi; fi
2251 ],
2252 [
2253         with_libperl="yes"
2254 ])
2255
2256 AC_MSG_CHECKING([for perl])
2257 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
2258 if test -x "$perl_interpreter"
2259 then
2260         AC_MSG_RESULT([yes ($perl_interpreter)])
2261 else
2262         perl_interpreter=""
2263         AC_MSG_RESULT([no])
2264 fi
2265
2266 AC_SUBST(PERL, "$perl_interpreter")
2267
2268 if test "x$with_libperl" = "xyes" \
2269         && test -n "$perl_interpreter"
2270 then
2271   SAVE_CFLAGS=$CFLAGS
2272   SAVE_LDFLAGS=$LDFLAGS
2273 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
2274   PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
2275   PERL_LDFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
2276   CFLAGS="$CFLAGS $PERL_CFLAGS"
2277   LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2278
2279   AC_CACHE_CHECK([for libperl],
2280     [c_cv_have_libperl],
2281     AC_LINK_IFELSE(
2282       AC_LANG_PROGRAM(
2283       [[
2284 #define PERL_NO_GET_CONTEXT
2285 #include <EXTERN.h>
2286 #include <perl.h>
2287 #include <XSUB.h>
2288       ]],
2289       [[
2290        dTHX;
2291        load_module (PERL_LOADMOD_NOIMPORT,
2292                          newSVpv ("Collectd::Plugin::FooBar", 24),
2293                          Nullsv);
2294       ]]),
2295       [c_cv_have_libperl="yes"],
2296       [c_cv_have_libperl="no"]
2297     )
2298   )
2299
2300   if test "x$c_cv_have_libperl" = "xyes"
2301   then
2302           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
2303           AC_SUBST(PERL_CFLAGS)
2304           AC_SUBST(PERL_LDFLAGS)
2305   else
2306           with_libperl="no"
2307   fi
2308
2309   CFLAGS=$SAVE_CFLAGS
2310   LDFLAGS=$SAVE_LDFLAGS
2311 else if test -z "$perl_interpreter"; then
2312   with_libperl="no (no perl interpreter found)"
2313   c_cv_have_libperl="no"
2314 fi; fi
2315 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
2316
2317 if test "x$with_libperl" = "xyes"
2318 then
2319         SAVE_CFLAGS=$CFLAGS
2320         SAVE_LDFLAGS=$LDFLAGS
2321         CFLAGS="$CFLAGS $PERL_CFLAGS"
2322         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2323
2324         AC_CACHE_CHECK([if perl supports ithreads],
2325                 [c_cv_have_perl_ithreads],
2326                 AC_LINK_IFELSE(
2327                         AC_LANG_PROGRAM(
2328                         [[
2329 #include <EXTERN.h>
2330 #include <perl.h>
2331 #include <XSUB.h>
2332
2333 #if !defined(USE_ITHREADS)
2334 # error "Perl does not support ithreads!"
2335 #endif /* !defined(USE_ITHREADS) */
2336                         ]],
2337                         [[ ]]),
2338                         [c_cv_have_perl_ithreads="yes"],
2339                         [c_cv_have_perl_ithreads="no"]
2340                 )
2341         )
2342
2343         if test "x$c_cv_have_perl_ithreads" = "xyes"
2344         then
2345                 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
2346         fi
2347
2348         CFLAGS=$SAVE_CFLAGS
2349         LDFLAGS=$SAVE_LDFLAGS
2350 fi
2351
2352 if test "x$with_libperl" = "xyes"
2353 then
2354         SAVE_CFLAGS=$CFLAGS
2355         SAVE_LDFLAGS=$LDFLAGS
2356         # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
2357         # (see issues #41 and #42)
2358         CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
2359         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2360
2361         AC_CACHE_CHECK([for broken Perl_load_module()],
2362                 [c_cv_have_broken_perl_load_module],
2363                 AC_LINK_IFELSE(
2364                         AC_LANG_PROGRAM(
2365                         [[
2366 #define PERL_NO_GET_CONTEXT
2367 #include <EXTERN.h>
2368 #include <perl.h>
2369 #include <XSUB.h>
2370                         ]],
2371                         [[
2372                          dTHX;
2373                          load_module (PERL_LOADMOD_NOIMPORT,
2374                              newSVpv ("Collectd::Plugin::FooBar", 24),
2375                              Nullsv);
2376                         ]]),
2377                         [c_cv_have_broken_perl_load_module="no"],
2378                         [c_cv_have_broken_perl_load_module="yes"]
2379                 )
2380         )
2381
2382         CFLAGS=$SAVE_CFLAGS
2383         LDFLAGS=$SAVE_LDFLAGS
2384 fi
2385 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
2386                 test "x$c_cv_have_broken_perl_load_module" = "xyes")
2387
2388 if test "x$with_libperl" = "xyes"
2389 then
2390         SAVE_CFLAGS=$CFLAGS
2391         SAVE_LDFLAGS=$LDFLAGS
2392         CFLAGS="$CFLAGS $PERL_CFLAGS"
2393         LDFLAGS="$LDFLAGS $PERL_LDFLAGS"
2394
2395         AC_CHECK_MEMBER(
2396                 [struct mgvtbl.svt_local],
2397                 [have_struct_mgvtbl_svt_local="yes"],
2398                 [have_struct_mgvtbl_svt_local="no"],
2399                 [
2400 #include <EXTERN.h>
2401 #include <perl.h>
2402 #include <XSUB.h>
2403                 ])
2404
2405         if test "x$have_struct_mgvtbl_svt_local" = "xyes"
2406         then
2407                 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
2408                                   [Define if Perl's struct mgvtbl has member svt_local.])
2409         fi
2410
2411         CFLAGS=$SAVE_CFLAGS
2412         LDFLAGS=$SAVE_LDFLAGS
2413 fi
2414 # }}}
2415
2416 # --with-libpq {{{
2417 with_pg_config="pg_config"
2418 with_libpq_includedir=""
2419 with_libpq_libdir=""
2420 with_libpq_cppflags=""
2421 with_libpq_ldflags=""
2422 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
2423         [Path to libpq.])],
2424 [
2425         if test "x$withval" = "xno"
2426         then
2427                 with_libpq="no"
2428         else if test "x$withval" = "xyes"
2429         then
2430                 with_libpq="yes"
2431         else
2432                 if test -f "$withval" && test -x "$withval";
2433                 then
2434                         with_pg_config="$withval"
2435                 else if test -x "$withval/bin/pg_config"
2436                 then
2437                         with_pg_config="$withval/bin/pg_config"
2438                 fi; fi
2439                 with_libpq="yes"
2440         fi; fi
2441 ],
2442 [
2443         with_libpq="yes"
2444 ])
2445 if test "x$with_libpq" = "xyes"
2446 then
2447         with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
2448         pg_config_status=$?
2449
2450         if test $pg_config_status -eq 0
2451         then
2452                 if test -n "$with_libpq_includedir"; then
2453                         for dir in $with_libpq_includedir; do
2454                                 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
2455                         done
2456                 fi
2457         else
2458                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2459         fi
2460
2461         SAVE_CPPFLAGS="$CPPFLAGS"
2462         CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
2463
2464         AC_CHECK_HEADERS(libpq-fe.h, [],
2465                 [with_libpq="no (libpq-fe.h not found)"], [])
2466
2467         CPPFLAGS="$SAVE_CPPFLAGS"
2468 fi
2469 if test "x$with_libpq" = "xyes"
2470 then
2471         with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
2472         pg_config_status=$?
2473
2474         if test $pg_config_status -eq 0
2475         then
2476                 if test -n "$with_libpq_libdir"; then
2477                         for dir in $with_libpq_libdir; do
2478                                 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
2479                         done
2480                 fi
2481         else
2482                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
2483         fi
2484
2485         SAVE_LDFLAGS="$LDFLAGS"
2486         LDFLAGS="$LDFLAGS $with_libpq_ldflags"
2487
2488         AC_CHECK_LIB(pq, PQconnectdb,
2489                 [with_libpq="yes"],
2490                 [with_libpq="no (symbol 'PQconnectdb' not found)"])
2491
2492         AC_CHECK_LIB(pq, PQserverVersion,
2493                 [with_libpq="yes"],
2494                 [with_libpq="no (symbol 'PQserverVersion' not found)"])
2495
2496         LDFLAGS="$SAVE_LDFLAGS"
2497 fi
2498 if test "x$with_libpq" = "xyes"
2499 then
2500         BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
2501         BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
2502         AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
2503         AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
2504 fi
2505 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
2506 # }}}
2507
2508 # --with-libpthread {{{
2509 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
2510 [       if test "x$withval" != "xno" \
2511                 && test "x$withval" != "xyes"
2512         then
2513                 LDFLAGS="$LDFLAGS -L$withval/lib"
2514                 CPPFLAGS="$CPPFLAGS -I$withval/include"
2515                 with_libpthread="yes"
2516         else
2517                 if test "x$withval" = "xno"
2518                 then
2519                         with_libpthread="no (disabled)"
2520                 fi
2521         fi
2522 ], [with_libpthread="yes"])
2523 if test "x$with_libpthread" = "xyes"
2524 then
2525         AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
2526 fi
2527
2528 if test "x$with_libpthread" = "xyes"
2529 then
2530         AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
2531 fi
2532 if test "x$with_libpthread" = "xyes"
2533 then
2534         collect_pthread=1
2535 else
2536         collect_pthread=0
2537 fi
2538 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
2539         [Wether or not to use pthread (POSIX threads) library])
2540 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
2541 # }}}
2542
2543 # --with-librrd {{{
2544 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
2545 librrd_cflags=""
2546 librrd_ldflags=""
2547 librrd_threadsafe="yes"
2548 librrd_rrdc_update="no"
2549 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
2550 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
2551         then
2552                 librrd_cflags="-I$withval/include"
2553                 librrd_ldflags="-L$withval/lib"
2554                 with_librrd="yes"
2555         else
2556                 with_librrd="$withval"
2557         fi
2558 ], [with_librrd="yes"])
2559 if test "x$with_librrd" = "xyes"
2560 then
2561         SAVE_CPPFLAGS="$CPPFLAGS"
2562         SAVE_LDFLAGS="$LDFLAGS"
2563
2564         CPPFLAGS="$CPPFLAGS $librrd_cflags"
2565         LDFLAGS="$LDFLAGS $librrd_ldflags"
2566
2567         AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
2568
2569         CPPFLAGS="$SAVE_CPPFLAGS"
2570         LDFLAGS="$SAVE_LDFLAGS"
2571 fi
2572 if test "x$with_librrd" = "xyes"
2573 then
2574         SAVE_CPPFLAGS="$CPPFLAGS"
2575         SAVE_LDFLAGS="$LDFLAGS"
2576
2577         CPPFLAGS="$CPPFLAGS $librrd_cflags"
2578         LDFLAGS="$LDFLAGS $librrd_ldflags"
2579
2580         AC_CHECK_LIB(rrd_th, rrd_update_r,
2581         [with_librrd="yes"
2582          librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
2583         ],
2584         [librrd_threadsafe="no"
2585          AC_CHECK_LIB(rrd, rrd_update,
2586          [with_librrd="yes"
2587           librrd_ldflags="$librrd_ldflags -lrrd -lm"
2588          ],
2589          [with_librrd="no (symbol 'rrd_update' not found)"],
2590          [-lm])
2591         ],
2592         [-lm])
2593
2594         if test "x$librrd_threadsafe" = "xyes"
2595         then
2596                 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2597         else
2598                 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
2599         fi
2600
2601         CPPFLAGS="$SAVE_CPPFLAGS"
2602         LDFLAGS="$SAVE_LDFLAGS"
2603 fi
2604 if test "x$with_librrd" = "xyes"
2605 then
2606         BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
2607         BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
2608         AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
2609         AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
2610 fi
2611 if test "x$librrd_threadsafe" = "xyes"
2612 then
2613         AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
2614 fi
2615 # }}}
2616
2617 # --with-libsensors {{{
2618 with_sensors_cflags=""
2619 with_sensors_ldflags=""
2620 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
2621 [
2622         if test "x$withval" = "xno"
2623         then
2624                 with_libsensors="no"
2625         else
2626                 with_libsensors="yes"
2627                 if test "x$withval" != "xyes"
2628                 then
2629                         with_sensors_cflags="-I$withval/include"
2630                         with_sensors_ldflags="-L$withval/lib"
2631                         with_libsensors="yes"
2632                 fi
2633         fi
2634 ],
2635 [
2636         if test "x$ac_system" = "xLinux"
2637         then
2638                 with_libsensors="yes"
2639         else
2640                 with_libsensors="no (Linux only library)"
2641         fi
2642 ])
2643 if test "x$with_libsensors" = "xyes"
2644 then
2645         SAVE_CPPFLAGS="$CPPFLAGS"
2646         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2647
2648 #       AC_CHECK_HEADERS(sensors/sensors.h,
2649 #       [
2650 #               AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
2651 #       ],
2652 #       [with_libsensors="no (sensors/sensors.h not found)"])
2653         AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
2654
2655         CPPFLAGS="$SAVE_CPPFLAGS"
2656 fi
2657 if test "x$with_libsensors" = "xyes"
2658 then
2659         SAVE_CPPFLAGS="$CPPFLAGS"
2660         SAVE_LDFLAGS="$LDFLAGS"
2661         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
2662         LDFLAGS="$LDFLAGS $with_sensors_ldflags"
2663
2664         AC_CHECK_LIB(sensors, sensors_init,
2665         [
2666                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
2667         ],
2668         [with_libsensors="no (libsensors not found)"])
2669
2670         CPPFLAGS="$SAVE_CPPFLAGS"
2671         LDFLAGS="$SAVE_LDFLAGS"
2672 fi
2673 if test "x$with_libsensors" = "xyes"
2674 then
2675         BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
2676         BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
2677         AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
2678         AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
2679 fi
2680 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
2681 # }}}
2682
2683 # --with-libstatgrab {{{
2684 with_libstatgrab_cflags=""
2685 with_libstatgrab_ldflags=""
2686 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
2687 [
2688  if test "x$withval" != "xno" \
2689    && test "x$withval" != "xyes"
2690  then
2691    with_libstatgrab_cflags="-I$withval/include"
2692    with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
2693    with_libstatgrab="yes"
2694    with_libstatgrab_pkg_config="no"
2695  else
2696    with_libstatgrab="$withval"
2697    with_libstatgrab_pkg_config="yes"
2698  fi
2699  ],
2700 [
2701  with_libstatgrab="yes"
2702  with_libstatgrab_pkg_config="yes"
2703 ])
2704
2705 if test "x$with_libstatgrab" = "xyes" \
2706   && test "x$with_libstatgrab_pkg_config" = "xyes"
2707 then
2708   if test "x$PKG_CONFIG" != "x"
2709   then
2710     AC_MSG_CHECKING([pkg-config for libstatgrab])
2711     temp_result="found"
2712     $PKG_CONFIG --exists libstatgrab 2>/dev/null
2713     if test "$?" != "0"
2714     then
2715       with_libstatgrab_pkg_config="no"
2716       with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
2717       temp_result="not found"
2718     fi
2719     AC_MSG_RESULT([$temp_result])
2720   else
2721     AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
2722     with_libstatgrab_pkg_config="no"
2723     with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
2724   fi
2725 fi
2726
2727 if test "x$with_libstatgrab" = "xyes" \
2728   && test "x$with_libstatgrab_pkg_config" = "xyes" \
2729   && test "x$with_libstatgrab_cflags" = "x"
2730 then
2731   AC_MSG_CHECKING([for libstatgrab CFLAGS])
2732   temp_result="`$PKG_CONFIG --cflags libstatgrab`"
2733   if test "$?" = "0"
2734   then
2735     with_libstatgrab_cflags="$temp_result"
2736   else
2737     with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
2738     temp_result="$PKG_CONFIG --cflags libstatgrab failed"
2739   fi
2740   AC_MSG_RESULT([$temp_result])
2741 fi
2742
2743 if test "x$with_libstatgrab" = "xyes" \
2744   && test "x$with_libstatgrab_pkg_config" = "xyes" \
2745   && test "x$with_libstatgrab_ldflags" = "x"
2746 then
2747   AC_MSG_CHECKING([for libstatgrab LDFLAGS])
2748   temp_result="`$PKG_CONFIG --libs libstatgrab`"
2749   if test "$?" = "0"
2750   then
2751     with_libstatgrab_ldflags="$temp_result"
2752   else
2753     with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
2754     temp_result="$PKG_CONFIG --libs libstatgrab failed"
2755   fi
2756   AC_MSG_RESULT([$temp_result])
2757 fi
2758
2759 if test "x$with_libstatgrab" = "xyes"
2760 then
2761   SAVE_CPPFLAGS="$CPPFLAGS"
2762   CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
2763
2764   AC_CHECK_HEADERS(statgrab.h,
2765                    [with_libstatgrab="yes"],
2766                    [with_libstatgrab="no (statgrab.h not found)"])
2767
2768   CPPFLAGS="$SAVE_CPPFLAGS"
2769 fi
2770
2771 if test "x$with_libstatgrab" = "xyes"
2772 then
2773   SAVE_CFLAGS="$CFLAGS"
2774   SAVE_LDFLAGS="$LDFLAGS"
2775
2776   CFLAGS="$CFLAGS $with_libstatgrab_cflags"
2777   LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
2778
2779   AC_CHECK_LIB(statgrab, sg_init,
2780                [with_libstatgrab="yes"],
2781                [with_libstatgrab="no (symbol sg_init not found)"])
2782
2783   CFLAGS="$SAVE_CFLAGS"
2784   LDFLAGS="$SAVE_LDFLAGS"
2785 fi
2786
2787 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
2788 if test "x$with_libstatgrab" = "xyes"
2789 then
2790   AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
2791   BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
2792   BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
2793   AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
2794   AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
2795 fi
2796 # }}}
2797
2798 # --with-libtokyotyrant {{{
2799 with_libtokyotyrant_cppflags=""
2800 with_libtokyotyrant_ldflags=""
2801 with_libtokyotyrant_libs=""
2802 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
2803 [
2804   if test "x$withval" = "xno"
2805   then
2806     with_libtokyotyrant="no"
2807   else if test "x$withval" = "xyes"
2808   then
2809     with_libtokyotyrant="yes"
2810   else
2811     with_libtokyotyrant_cppflags="-I$withval/include"
2812     with_libtokyotyrant_ldflags="-L$withval/include"
2813     with_libtokyotyrant_libs="-ltokyotyrant"
2814     with_libtokyotyrant="yes"
2815   fi; fi
2816 ],
2817 [
2818   with_libtokyotyrant="yes"
2819 ])
2820
2821 if test "x$with_libtokyotyrant" = "xyes"
2822 then
2823   if $PKG_CONFIG --exists tokyotyrant
2824   then
2825     with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
2826     with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `pkg-config --libs-only-L tokyotyrant`"
2827     with_libtokyotyrant_libs="$with_libtokyotyrant_libs `pkg-config --libs-only-l tokyotyrant`"
2828   fi
2829 fi
2830
2831 SAVE_CPPFLAGS="$CPPFLAGS"
2832 SAVE_LDFLAGS="$LDFLAGS"
2833 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
2834 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
2835
2836 if test "x$with_libtokyotyrant" = "xyes"
2837 then
2838   AC_CHECK_HEADERS(tcrdb.h,
2839   [
2840           AC_DEFINE(HAVE_TCRDB_H, 1,
2841                     [Define to 1 if you have the <tcrdb.h> header file.])
2842   ], [with_libtokyotyrant="no (tcrdb.h not found)"])
2843 fi
2844
2845 if test "x$with_libtokyotyrant" = "xyes"
2846 then
2847   AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
2848   [
2849           AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
2850                     [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
2851   ],
2852   [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
2853   [$with_libtokyotyrant_libs])
2854 fi
2855
2856 CPPFLAGS="$SAVE_CPPFLAGS"
2857 LDFLAGS="$SAVE_LDFLAGS"
2858
2859 if test "x$with_libtokyotyrant" = "xyes"
2860 then 
2861   BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
2862   BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
2863   BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
2864   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
2865   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
2866   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
2867 fi
2868 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
2869 # }}}
2870
2871 # --with-libupsclient {{{
2872 with_libupsclient_config=""
2873 with_libupsclient_cflags=""
2874 with_libupsclient_libs=""
2875 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2876 [
2877         if test "x$withval" = "xno"
2878         then
2879                 with_libupsclient="no"
2880         else if test "x$withval" = "xyes"
2881         then
2882                 with_libupsclient="use_pkgconfig"
2883         else
2884                 if test -x "$withval"
2885                 then
2886                         with_libupsclient_config="$withval"
2887                         with_libupsclient="use_libupsclient_config"
2888                 else if test -x "$withval/bin/libupsclient-config"
2889                 then
2890                         with_libupsclient_config="$withval/bin/net-snmp-config"
2891                         with_libupsclient="use_libupsclient_config"
2892                 else
2893                         AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
2894                         with_libupsclient_cflags="-I$withval/include"
2895                         with_libupsclient_libs="-L$withval/lib -lupsclient"
2896                         with_libupsclient="yes"
2897                 fi; fi
2898         fi; fi
2899 ],
2900 [with_libupsclient="use_pkgconfig"])
2901
2902 # configure using libupsclient-config
2903 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2904 then
2905         AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
2906         with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
2907         if test $? -ne 0
2908         then
2909                 with_libupsclient="no ($with_libupsclient_config failed)"
2910         fi
2911         with_libupsclient_libs="`$with_libupsclient_config --libs`"
2912         if test $? -ne 0
2913         then
2914                 with_libupsclient="no ($with_libupsclient_config failed)"
2915         fi
2916 fi
2917 if test "x$with_libupsclient" = "xuse_libupsclient_config"
2918 then
2919         with_libupsclient="yes"
2920 fi
2921
2922 # configure using pkg-config
2923 if test "x$with_libupsclient" = "xuse_pkgconfig"
2924 then
2925         if test "x$PKG_CONFIG" = "x"
2926         then
2927                 with_libupsclient="no (Don't have pkg-config)"
2928         fi
2929 fi
2930 if test "x$with_libupsclient" = "xuse_pkgconfig"
2931 then
2932         AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
2933         $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
2934         if test $? -ne 0
2935         then
2936                 with_libupsclient="no (pkg-config doesn't know library)"
2937         fi
2938 fi
2939 if test "x$with_libupsclient" = "xuse_pkgconfig"
2940 then
2941         with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
2942         if test $? -ne 0
2943         then
2944                 with_libupsclient="no ($PKG_CONFIG failed)"
2945         fi
2946         with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
2947         if test $? -ne 0
2948         then
2949                 with_libupsclient="no ($PKG_CONFIG failed)"
2950         fi
2951 fi
2952 if test "x$with_libupsclient" = "xuse_pkgconfig"
2953 then
2954         with_libupsclient="yes"
2955 fi
2956
2957 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
2958 # the actual checks.
2959 if test "x$with_libupsclient" = "xyes"
2960 then
2961         SAVE_CPPFLAGS="$CPPFLAGS"
2962         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2963
2964         AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
2965
2966         CPPFLAGS="$SAVE_CPPFLAGS"
2967 fi
2968 if test "x$with_libupsclient" = "xyes"
2969 then
2970         SAVE_CPPFLAGS="$CPPFLAGS"
2971         SAVE_LDFLAGS="$LDFLAGS"
2972
2973         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2974         LDFLAGS="$LDFLAGS $with_libupsclient_libs"
2975
2976         AC_CHECK_LIB(upsclient, upscli_connect,
2977                      [with_libupsclient="yes"],
2978                      [with_libupsclient="no (symbol upscli_connect not found)"])
2979
2980         CPPFLAGS="$SAVE_CPPFLAGS"
2981         LDFLAGS="$SAVE_LDFLAGS"
2982 fi
2983 if test "x$with_libupsclient" = "xyes"
2984 then
2985         SAVE_CPPFLAGS="$CPPFLAGS"
2986         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
2987
2988         AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
2989 [#include <stdlib.h>
2990 #include <stdio.h>
2991 #include <upsclient.h>])
2992
2993         CPPFLAGS="$SAVE_CPPFLAGS"
2994 fi
2995 if test "x$with_libupsclient" = "xyes"
2996 then
2997         BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
2998         BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
2999         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
3000         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
3001 fi
3002 # }}}
3003
3004 # --with-libxmms {{{
3005 with_xmms_config="xmms-config"
3006 with_xmms_cflags=""
3007 with_xmms_libs=""
3008 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
3009 [
3010         if test "x$withval" != "xno" \
3011                 && test "x$withval" != "xyes"
3012         then
3013                 if test -f "$withval" && test -x "$withval";
3014                 then
3015                         with_xmms_config="$withval"
3016                 else if test -x "$withval/bin/xmms-config"
3017                 then
3018                         with_xmms_config="$withval/bin/xmms-config"
3019                 fi; fi
3020                 with_libxmms="yes"
3021         else if test "x$withval" = "xno"
3022         then
3023                 with_libxmms="no"
3024         else
3025                 with_libxmms="yes"
3026         fi; fi
3027 ],
3028 [
3029         with_libxmms="yes"
3030 ])
3031 if test "x$with_libxmms" = "xyes"
3032 then
3033         with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
3034         xmms_config_status=$?
3035
3036         if test $xmms_config_status -ne 0
3037         then
3038                 with_libxmms="no"
3039         fi
3040 fi
3041 if test "x$with_libxmms" = "xyes"
3042 then
3043         with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
3044         xmms_config_status=$?
3045
3046         if test $xmms_config_status -ne 0
3047         then
3048                 with_libxmms="no"
3049         fi
3050 fi
3051 if test "x$with_libxmms" = "xyes"
3052 then
3053         AC_CHECK_LIB(xmms, xmms_remote_get_info,
3054         [
3055                 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
3056                 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
3057                 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
3058                 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
3059         ],
3060         [
3061                 with_libxmms="no"
3062         ],
3063         [$with_xmms_libs])
3064 fi
3065 with_libxmms_numeric=0
3066 if test "x$with_libxmms" = "xyes"
3067 then
3068         with_libxmms_numeric=1
3069 fi
3070 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
3071 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
3072 # }}}
3073
3074 # --with-libyajl {{{
3075 with_libyajl_cppflags=""
3076 with_libyajl_ldflags=""
3077 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
3078 [
3079         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3080         then
3081                 with_libyajl_cppflags="-I$withval/include"
3082                 with_libyajl_ldflags="-L$withval/lib"
3083                 with_libyajl="yes"
3084         else
3085                 with_libyajl="$withval"
3086         fi
3087 ],
3088 [
3089         with_libyajl="yes"
3090 ])
3091 if test "x$with_libyajl" = "xyes"
3092 then
3093         SAVE_CPPFLAGS="$CPPFLAGS"
3094         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3095
3096         AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
3097
3098         CPPFLAGS="$SAVE_CPPFLAGS"
3099 fi
3100 if test "x$with_libyajl" = "xyes"
3101 then
3102         SAVE_CPPFLAGS="$CPPFLAGS"
3103         SAVE_LDFLAGS="$LDFLAGS"
3104         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
3105         LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
3106
3107         AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
3108
3109         CPPFLAGS="$SAVE_CPPFLAGS"
3110         LDFLAGS="$SAVE_LDFLAGS"
3111 fi
3112 if test "x$with_libyajl" = "xyes"
3113 then
3114         BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
3115         BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
3116         BUILD_WITH_LIBYAJL_LIBS="-lyajl"
3117         AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
3118         AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
3119         AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
3120         AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
3121 fi
3122 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
3123 # }}}
3124
3125 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
3126 with_libxml2="no (pkg-config isn't available)"
3127 with_libxml2_cflags=""
3128 with_libxml2_ldflags=""
3129 with_libvirt="no (pkg-config isn't available)"
3130 with_libvirt_cflags=""
3131 with_libvirt_ldflags=""
3132 if test "x$PKG_CONFIG" != "x"
3133 then
3134         pkg-config --exists 'libxml-2.0' 2>/dev/null
3135         if test "$?" = "0"
3136         then
3137                 with_libxml2="yes"
3138         else
3139                 with_libxml2="no (pkg-config doesn't know library)"
3140         fi
3141
3142         pkg-config --exists libvirt 2>/dev/null
3143         if test "$?" = "0"
3144         then
3145                 with_libvirt="yes"
3146         else
3147                 with_libvirt="no (pkg-config doesn't know library)"
3148         fi
3149 fi
3150 if test "x$with_libxml2" = "xyes"
3151 then
3152         with_libxml2_cflags="`pkg-config --cflags libxml-2.0`"
3153         if test $? -ne 0
3154         then
3155                 with_libxml2="no"
3156         fi
3157         with_libxml2_ldflags="`pkg-config --libs libxml-2.0`"
3158         if test $? -ne 0
3159         then
3160                 with_libxml2="no"
3161         fi
3162 fi
3163 if test "x$with_libxml2" = "xyes"
3164 then
3165         SAVE_CPPFLAGS="$CPPFLAGS"
3166         CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
3167
3168         AC_CHECK_HEADERS(libxml/parser.h, [],
3169                       [with_libxml2="no (libxml/parser.h not found)"])
3170
3171         CPPFLAGS="$SAVE_CPPFLAGS"
3172 fi
3173 if test "x$with_libxml2" = "xyes"
3174 then
3175         SAVE_CFLAGS="$CFLAGS"
3176         SAVE_LDFLAGS="$LDFLAGS"
3177
3178         CFLAGS="$CFLAGS $with_libxml2_cflags"
3179         LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
3180
3181         AC_CHECK_LIB(xml2, xmlXPathEval,
3182                      [with_libxml2="yes"],
3183                      [with_libxml2="no (symbol xmlXPathEval not found)"])
3184
3185         CFLAGS="$SAVE_CFLAGS"
3186         LDFLAGS="$SAVE_LDFLAGS"
3187 fi
3188 dnl Add the right compiler flags and libraries.
3189 if test "x$with_libxml2" = "xyes"; then
3190         BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
3191         BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
3192         AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
3193         AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
3194 fi
3195 if test "x$with_libvirt" = "xyes"
3196 then
3197         with_libvirt_cflags="`pkg-config --cflags libvirt`"
3198         if test $? -ne 0
3199         then
3200                 with_libvirt="no"
3201         fi
3202         with_libvirt_ldflags="`pkg-config --libs libvirt`"
3203         if test $? -ne 0
3204         then
3205                 with_libvirt="no"
3206         fi
3207 fi
3208 if test "x$with_libvirt" = "xyes"
3209 then
3210         SAVE_CPPFLAGS="$CPPFLAGS"
3211         CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
3212
3213         AC_CHECK_HEADERS(libvirt/libvirt.h, [],
3214                       [with_libvirt="no (libvirt/libvirt.h not found)"])
3215
3216         CPPFLAGS="$SAVE_CPPFLAGS"
3217 fi
3218 if test "x$with_libvirt" = "xyes"
3219 then
3220         SAVE_CFLAGS="$CFLAGS"
3221         SAVE_LDFLAGS="$LDFLAGS"
3222
3223         CFLAGS="$CFLAGS $with_libvirt_cflags"
3224         LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
3225
3226         AC_CHECK_LIB(virt, virDomainBlockStats,
3227                      [with_libvirt="yes"],
3228                      [with_libvirt="no (symbol virDomainBlockStats not found)"])
3229
3230         CFLAGS="$SAVE_CFLAGS"
3231         LDFLAGS="$SAVE_LDFLAGS"
3232 fi
3233 dnl Add the right compiler flags and libraries.
3234 if test "x$with_libvirt" = "xyes"; then
3235         BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
3236         BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
3237         AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
3238         AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
3239 fi
3240 # }}}
3241
3242 # $PKG_CONFIG --exists OpenIPMIpthread {{{
3243 with_libopenipmipthread="yes"
3244 with_libopenipmipthread_cflags=""
3245 with_libopenipmipthread_libs=""
3246
3247 AC_MSG_CHECKING([for pkg-config])
3248 temp_result="no"
3249 if test "x$PKG_CONFIG" = "x"
3250 then
3251         with_libopenipmipthread="no"
3252         temp_result="no"
3253 else
3254         temp_result="$PKG_CONFIG"
3255 fi
3256 AC_MSG_RESULT([$temp_result])
3257
3258 if test "x$with_libopenipmipthread" = "xyes"
3259 then
3260         AC_MSG_CHECKING([for libOpenIPMIpthread])
3261         $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
3262         if test "$?" != "0"
3263         then
3264                 with_libopenipmipthread="no ($PKG_CONFIG doesn't know OpenIPMIpthread)"
3265         fi
3266         AC_MSG_RESULT([$with_libopenipmipthread])
3267 fi
3268
3269 if test "x$with_libopenipmipthread" = "xyes"
3270 then
3271         AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
3272         temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
3273         if test "$?" = "0"
3274         then
3275                 with_libopenipmipthread_cflags="$temp_result"
3276         else
3277                 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
3278                 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
3279         fi
3280         AC_MSG_RESULT([$temp_result])
3281 fi
3282
3283 if test "x$with_libopenipmipthread" = "xyes"
3284 then
3285         AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
3286         temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
3287         if test "$?" = "0"
3288         then
3289                 with_libopenipmipthread_ldflags="$temp_result"
3290         else
3291                 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
3292                 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
3293         fi
3294         AC_MSG_RESULT([$temp_result])
3295 fi
3296
3297 if test "x$with_libopenipmipthread" = "xyes"
3298 then
3299         SAVE_CPPFLAGS="$CPPFLAGS"
3300         CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
3301
3302         AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
3303                          [with_libopenipmipthread="yes"],
3304                          [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
3305 [#include <OpenIPMI/ipmiif.h>
3306 #include <OpenIPMI/ipmi_err.h>
3307 #include <OpenIPMI/ipmi_posix.h>
3308 #include <OpenIPMI/ipmi_conn.h>
3309 ])
3310
3311         CPPFLAGS="$SAVE_CPPFLAGS"
3312 fi
3313
3314 if test "x$with_libopenipmipthread" = "xyes"
3315 then
3316         BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
3317         BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
3318         AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
3319         AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
3320 fi
3321 # }}}
3322
3323 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
3324                 [with_libnotify="yes"],
3325                 [with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"])
3326
3327 # Check for enabled/disabled features
3328 #
3329
3330 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
3331 # ------------------------------------------------------------
3332 dnl
3333 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
3334 dnl
3335 AC_DEFUN(
3336         [AC_COLLECTD],
3337         [
3338         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
3339         m4_if(
3340                 [$2],
3341                 [enable],
3342                 [dnl
3343                 m4_define([EnDis],[disabled])dnl
3344                 m4_define([YesNo],[no])dnl
3345                 ],dnl
3346                 [m4_if(
3347                         [$2],
3348                         [disable],
3349                         [dnl
3350                         m4_define([EnDis],[enabled])dnl
3351                         m4_define([YesNo],[yes])dnl
3352                         ],
3353                         [dnl
3354                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
3355                         ]dnl
3356                 )]dnl
3357         )dnl
3358         m4_if([$3], [feature], [],
3359                 [m4_if(
3360                         [$3], [module], [],
3361                         [dnl
3362                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
3363                         ]dnl
3364                 )]dnl
3365         )dnl
3366         AC_ARG_ENABLE(
3367                 [$1],
3368                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
3369                 [],
3370                 enable_$1='[YesNo]'dnl
3371         )# AC_ARG_ENABLE
3372 if test "x$enable_$1" = "xno"
3373 then
3374         collectd_$1=0
3375 else
3376         if test "x$enable_$1" = "xyes"
3377         then
3378                 collectd_$1=1
3379         else
3380                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
3381                 collectd_$1=1
3382                 enable_$1='yes'
3383         fi
3384 fi
3385         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
3386         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
3387         ]dnl
3388 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
3389
3390 # AC_PLUGIN(name, default, info)
3391 # ------------------------------------------------------------
3392 dnl
3393 AC_DEFUN(
3394   [AC_PLUGIN],
3395   [
3396     enable_plugin="no"
3397     force="no"
3398     AC_ARG_ENABLE([$1], AC_HELP_STRING([--enable-$1], [$3]),
3399     [
3400      if test "x$enableval" = "xyes"
3401      then
3402              enable_plugin="yes"
3403      else if test "x$enableval" = "xforce"
3404      then
3405              enable_plugin="yes"
3406              force="yes"
3407      else
3408              enable_plugin="no"
3409      fi; fi
3410     ],
3411     [
3412          if test "x$enable_all_plugins" = "xauto"
3413          then
3414              if test "x$2" = "xyes"
3415              then
3416                      enable_plugin="yes"
3417              else
3418                      enable_plugin="no"
3419              fi
3420          else
3421              enable_plugin="$enable_all_plugins"
3422          fi
3423     ])
3424     if test "x$enable_plugin" = "xyes"
3425     then
3426             if test "x$2" = "xyes" || test "x$force" = "xyes"
3427             then
3428                     AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
3429                     if test "x$2" != "xyes"
3430                     then
3431                             dependency_warning="yes"
3432                     fi
3433             else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
3434                     dependency_error="yes"
3435                     enable_plugin="no (dependency error)"
3436             fi
3437     fi
3438     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
3439     enable_$1="$enable_plugin"
3440   ]
3441 )# AC_PLUGIN(name, default, info)
3442
3443 m4_divert_once([HELP_ENABLE], [
3444 collectd features:])
3445 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
3446 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
3447 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
3448 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
3449
3450 dependency_warning="no"
3451 dependency_error="no"
3452
3453 plugin_ascent="no"
3454 plugin_battery="no"
3455 plugin_bind="no"
3456 plugin_conntrack="no"
3457 plugin_cpu="no"
3458 plugin_cpufreq="no"
3459 plugin_curl_json="no"
3460 plugin_df="no"
3461 plugin_disk="no"
3462 plugin_entropy="no"
3463 plugin_interface="no"
3464 plugin_ipmi="no"
3465 plugin_ipvs="no"
3466 plugin_irq="no"
3467 plugin_libvirt="no"
3468 plugin_load="no"
3469 plugin_memory="no"
3470 plugin_multimeter="no"
3471 plugin_nfs="no"
3472 plugin_fscache="no"
3473 plugin_perl="no"
3474 plugin_processes="no"
3475 plugin_protocols="no"
3476 plugin_serial="no"
3477 plugin_swap="no"
3478 plugin_tape="no"
3479 plugin_tcpconns="no"
3480 plugin_ted="no"
3481 plugin_thermal="no"
3482 plugin_users="no"
3483 plugin_uptime="no"
3484 plugin_vmem="no"
3485 plugin_vserver="no"
3486 plugin_wireless="no"
3487 plugin_zfs_arc="no"
3488
3489 # Linux
3490 if test "x$ac_system" = "xLinux"
3491 then
3492         plugin_battery="yes"
3493         plugin_conntrack="yes"
3494         plugin_cpu="yes"
3495         plugin_cpufreq="yes"
3496         plugin_disk="yes"
3497         plugin_entropy="yes"
3498         plugin_interface="yes"
3499         plugin_irq="yes"
3500         plugin_load="yes"
3501         plugin_memory="yes"
3502         plugin_nfs="yes"
3503         plugin_fscache="yes"
3504         plugin_processes="yes"
3505         plugin_protocols="yes"
3506         plugin_serial="yes"
3507         plugin_swap="yes"
3508         plugin_tcpconns="yes"
3509         plugin_thermal="yes"
3510         plugin_uptime="yes"
3511         plugin_vmem="yes"
3512         plugin_vserver="yes"
3513         plugin_wireless="yes"
3514
3515         if test "x$have_net_ip_vs_h" = "xyes" -o "x$have_ip_vs_h" = "xyes"
3516         then
3517                 plugin_ipvs="yes"
3518         fi
3519 fi
3520
3521 if test "x$ac_system" = "xOpenBSD"
3522 then
3523         plugin_tcpconns="yes"
3524 fi
3525
3526 # Mac OS X devices
3527 if test "x$with_libiokit" = "xyes"
3528 then
3529         plugin_battery="yes"
3530         plugin_disk="yes"
3531 fi
3532
3533 # Solaris
3534 if test "x$with_kstat" = "xyes"
3535 then
3536         plugin_uptime="yes"
3537         plugin_zfs_arc="yes"
3538 fi
3539
3540 if test "x$with_devinfo$with_kstat" = "xyesyes"
3541 then
3542         plugin_cpu="yes"
3543         plugin_disk="yes"
3544         plugin_interface="yes"
3545         plugin_memory="yes"
3546         plugin_tape="yes"
3547 fi
3548
3549 if test "x$have_sys_swap_h$with_kstat$ac_system" = "xyesyesSolaris"
3550 then
3551         plugin_swap="yes"
3552 fi
3553
3554 # libstatgrab
3555 if test "x$with_libstatgrab" = "xyes"
3556 then
3557         plugin_cpu="yes"
3558         plugin_disk="yes"
3559         plugin_interface="yes"
3560         plugin_load="yes"
3561         plugin_memory="yes"
3562         plugin_swap="yes"
3563         plugin_users="yes"
3564 fi
3565
3566 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
3567 then
3568         plugin_ascent="yes"
3569         plugin_bind="yes"
3570 fi
3571
3572 if test "x$with_libopenipmipthread" = "xyes"
3573 then
3574         plugin_ipmi="yes"
3575 fi
3576
3577 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
3578 then
3579         plugin_curl_json="yes"
3580 fi
3581
3582 if test "x$have_processor_info" = "xyes"
3583 then
3584         plugin_cpu="yes"
3585 fi
3586 if test "x$have_sysctl" = "xyes"
3587 then
3588         plugin_cpu="yes"
3589         plugin_memory="yes"
3590         plugin_swap="yes"
3591         plugin_uptime="yes"
3592 fi
3593 if test "x$have_sysctlbyname" = "xyes"
3594 then
3595         plugin_cpu="yes"
3596         plugin_memory="yes"
3597         plugin_tcpconns="yes"
3598 fi
3599
3600 # Df plugin: Check if we know how to determine mount points first.
3601 #if test "x$have_listmntent" = "xyes"; then
3602 #       plugin_df="yes"
3603 #fi
3604 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
3605 then
3606         plugin_df="yes"
3607 fi
3608 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
3609 then
3610         plugin_df="yes"
3611 fi
3612 #if test "x$have_getmntent" = "xseq"
3613 #then
3614 #       plugin_df="yes"
3615 #fi
3616 if test "x$c_cv_have_one_getmntent" = "xyes"
3617 then
3618         plugin_df="yes"
3619 fi
3620
3621 # Df plugin: Check if we have either `statfs' or `statvfs' second.
3622 if test "x$plugin_df" = "xyes"
3623 then
3624         plugin_df="no"
3625         if test "x$have_statfs" = "xyes"
3626         then
3627                 plugin_df="yes"
3628         fi
3629         if test "x$have_statvfs" = "xyes"
3630         then
3631                 plugin_df="yes"
3632         fi
3633 fi
3634
3635 if test "x$have_getifaddrs" = "xyes"
3636 then
3637         plugin_interface="yes"
3638 fi
3639
3640 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
3641 then
3642         plugin_libvirt="yes"
3643 fi
3644
3645 if test "x$have_getloadavg" = "xyes"
3646 then
3647         plugin_load="yes"
3648 fi
3649
3650 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
3651 then
3652         plugin_perl="yes"
3653 fi
3654
3655 # Mac OS X memory interface
3656 if test "x$have_host_statistics" = "xyes"
3657 then
3658         plugin_memory="yes"
3659 fi
3660
3661 if test "x$have_termios_h" = "xyes"
3662 then
3663         plugin_multimeter="yes"
3664         plugin_ted="yes"
3665 fi
3666
3667 if test "x$have_thread_info" = "xyes"
3668 then
3669         plugin_processes="yes"
3670 fi
3671
3672 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
3673 then
3674         plugin_processes="yes"
3675 fi
3676
3677 if test "x$with_kvm_getswapinfo" = "xyes"
3678 then
3679         plugin_swap="yes"
3680 fi
3681
3682 if test "x$have_swapctl" = "xyes"
3683 then
3684         plugin_swap="yes"
3685 fi
3686
3687 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
3688 then
3689         plugin_tcpconns="yes"
3690 fi
3691
3692 if test "x$have_getutent" = "xyes"
3693 then
3694         plugin_users="yes"
3695 fi
3696 if test "x$have_getutxent" = "xyes"
3697 then
3698         plugin_users="yes"
3699 fi
3700
3701 m4_divert_once([HELP_ENABLE], [
3702 collectd plugins:])
3703
3704 AC_ARG_ENABLE([all-plugins],
3705                 AC_HELP_STRING([--enable-all-plugins],
3706                                 [enable all plugins (auto by def)]),
3707                 [
3708                  if test "x$enableval" = "xyes"
3709                  then
3710                          enable_all_plugins="yes"
3711                  else if test "x$enableval" = "xauto"
3712                  then
3713                          enable_all_plugins="auto"
3714                  else
3715                          enable_all_plugins="no"
3716                  fi; fi
3717                 ],
3718                 [enable_all_plugins="auto"])
3719
3720 m4_divert_once([HELP_ENABLE], [])
3721
3722 AC_PLUGIN([apache],      [$with_libcurl],      [Apache httpd statistics])
3723 AC_PLUGIN([apcups],      [yes],                [Statistics of UPSes by APC])
3724 AC_PLUGIN([apple_sensors], [$with_libiokit],   [Apple's hardware sensors])
3725 AC_PLUGIN([ascent],      [$plugin_ascent],     [AscentEmu player statistics])
3726 AC_PLUGIN([battery],     [$plugin_battery],    [Battery statistics])
3727 AC_PLUGIN([bind],        [$plugin_bind],       [ISC Bind nameserver statistics])
3728 AC_PLUGIN([conntrack],   [$plugin_conntrack],  [nf_conntrack statistics])
3729 AC_PLUGIN([cpufreq],     [$plugin_cpufreq],    [CPU frequency statistics])
3730 AC_PLUGIN([cpu],         [$plugin_cpu],        [CPU usage statistics])
3731 AC_PLUGIN([csv],         [yes],                [CSV output plugin])
3732 AC_PLUGIN([curl],        [$with_libcurl],      [CURL generic web statistics])
3733 AC_PLUGIN([curl_json],   [$plugin_curl_json],    [CouchDB statistics])
3734 AC_PLUGIN([dbi],         [$with_libdbi],       [General database statistics])
3735 AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
3736 AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
3737 AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
3738 AC_PLUGIN([email],       [yes],                [EMail statistics])
3739 AC_PLUGIN([entropy],     [$plugin_entropy],    [Entropy statistics])
3740 AC_PLUGIN([exec],        [yes],                [Execution of external programs])
3741 AC_PLUGIN([filecount],   [yes],                [Count files in directories])
3742 AC_PLUGIN([fscache],     [$plugin_fscache],    [fscache statistics])
3743 AC_PLUGIN([gmond],       [$with_libganglia],   [Ganglia plugin])
3744 AC_PLUGIN([hddtemp],     [yes],                [Query hddtempd])
3745 AC_PLUGIN([interface],   [$plugin_interface],  [Interface traffic statistics])
3746 AC_PLUGIN([ipmi],        [$plugin_ipmi],       [IPMI sensor statistics])
3747 AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
3748 AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
3749 AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
3750 AC_PLUGIN([java],        [$with_java],         [Embed the Java Virtual Machine])
3751 AC_PLUGIN([libvirt],     [$plugin_libvirt],    [Virtual machine statistics])
3752 AC_PLUGIN([load],        [$plugin_load],       [System load])
3753 AC_PLUGIN([logfile],     [yes],                [File logging plugin])
3754 AC_PLUGIN([madwifi],     [$have_linux_wireless_h], [Madwifi wireless statistics])
3755 AC_PLUGIN([match_empty_counter], [yes],        [The empty counter match])
3756 AC_PLUGIN([match_regex], [yes],                [The regex match])
3757 AC_PLUGIN([match_timediff], [yes],             [The timediff match])
3758 AC_PLUGIN([match_value], [yes],                [The value match])
3759 AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
3760 AC_PLUGIN([memcachec],   [$with_libmemcached], [memcachec statistics])
3761 AC_PLUGIN([memcached],   [yes],                [memcached statistics])
3762 AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
3763 AC_PLUGIN([multimeter],  [$plugin_multimeter], [Read multimeter values])
3764 AC_PLUGIN([mysql],       [$with_libmysql],     [MySQL statistics])
3765 AC_PLUGIN([netlink],     [$with_libnetlink],   [Enhanced Linux network statistics])
3766 AC_PLUGIN([network],     [yes],                [Network communication plugin])
3767 AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
3768 AC_PLUGIN([nginx],       [$with_libcurl],      [nginx statistics])
3769 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
3770 AC_PLUGIN([notify_email], [$with_libesmtp],    [Email notifier])
3771 AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
3772 AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
3773 AC_PLUGIN([olsrd],       [yes],                [olsrd statistics])
3774 AC_PLUGIN([onewire],     [$with_libowcapi],    [OneWire sensor statistics])
3775 AC_PLUGIN([openvpn],     [yes],                [OpenVPN client statistics])
3776 AC_PLUGIN([oracle],      [$with_oracle],       [Oracle plugin])
3777 AC_PLUGIN([perl],        [$plugin_perl],       [Embed a Perl interpreter])
3778 AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
3779 AC_PLUGIN([postgresql],  [$with_libpq],        [PostgreSQL database statistics])
3780 AC_PLUGIN([powerdns],    [yes],                [PowerDNS statistics])
3781 AC_PLUGIN([processes],   [$plugin_processes],  [Process statistics])
3782 AC_PLUGIN([protocols],   [$plugin_protocols],  [Protocol (IP, TCP, ...) statistics])
3783 AC_PLUGIN([rrdcached],   [$librrd_rrdc_update], [RRDTool output plugin])
3784 AC_PLUGIN([rrdtool],     [$with_librrd],       [RRDTool output plugin])
3785 AC_PLUGIN([sensors],     [$with_libsensors],   [lm_sensors statistics])
3786 AC_PLUGIN([serial],      [$plugin_serial],     [serial port traffic])
3787 AC_PLUGIN([snmp],        [$with_libnetsnmp],   [SNMP querying plugin])
3788 AC_PLUGIN([swap],        [$plugin_swap],       [Swap usage statistics])
3789 AC_PLUGIN([syslog],      [$have_syslog],       [Syslog logging plugin])
3790 AC_PLUGIN([table],       [yes],                [Parsing of tabular data])
3791 AC_PLUGIN([tail],        [yes],                [Parsing of logfiles])
3792 AC_PLUGIN([tape],        [$plugin_tape],       [Tape drive statistics])
3793 AC_PLUGIN([target_notification], [yes],        [The notification target])
3794 AC_PLUGIN([target_replace], [yes],             [The replace target])
3795 AC_PLUGIN([target_set],  [yes],                [The set target])
3796 AC_PLUGIN([tcpconns],    [$plugin_tcpconns],   [TCP connection statistics])
3797 AC_PLUGIN([teamspeak2],  [yes],                [TeamSpeak2 server statistics])
3798 AC_PLUGIN([ted],         [$plugin_ted],        [Read The Energy Detective values])
3799 AC_PLUGIN([thermal],     [$plugin_thermal],    [Linux ACPI thermal zone statistics])
3800 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant],  [TokyoTyrant database statistics])
3801 AC_PLUGIN([unixsock],    [yes],                [Unixsock communication plugin])
3802 AC_PLUGIN([uptime],      [$plugin_uptime],     [Uptime statistics])
3803 AC_PLUGIN([users],       [$plugin_users],      [User statistics])
3804 AC_PLUGIN([uuid],        [yes],                [UUID as hostname plugin])
3805 AC_PLUGIN([vmem],        [$plugin_vmem],       [Virtual memory statistics])
3806 AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
3807 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
3808 AC_PLUGIN([write_http],  [$with_libcurl],      [HTTP output plugin])
3809 AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
3810 AC_PLUGIN([zfs_arc],     [$plugin_zfs_arc],    [ZFS ARC statistics])
3811
3812 dnl Default configuration file
3813 # Load either syslog or logfile
3814 LOAD_PLUGIN_SYSLOG=""
3815 LOAD_PLUGIN_LOGFILE=""
3816
3817 AC_MSG_CHECKING([which default log plugin to load])
3818 default_log_plugin="none"
3819 if test "x$enable_syslog" = "xyes"
3820 then
3821         default_log_plugin="syslog"
3822 else
3823         LOAD_PLUGIN_SYSLOG="##"
3824 fi
3825
3826 if test "x$enable_logfile" = "xyes"
3827 then
3828         if test "x$default_log_plugin" = "xnone"
3829         then
3830                 default_log_plugin="logfile"
3831         else
3832                 LOAD_PLUGIN_LOGFILE="#"
3833         fi
3834 else
3835         LOAD_PLUGIN_LOGFILE="##"
3836 fi
3837 AC_MSG_RESULT([$default_log_plugin])
3838
3839 AC_SUBST(LOAD_PLUGIN_SYSLOG)
3840 AC_SUBST(LOAD_PLUGIN_LOGFILE)
3841
3842 DEFAULT_LOG_LEVEL="info"
3843 if test "x$enable_debug" = "xyes"
3844 then
3845         DEFAULT_LOG_LEVEL="debug"
3846 fi
3847 AC_SUBST(DEFAULT_LOG_LEVEL)
3848
3849 # Load only one of rrdtool, network, csv in the default config.
3850 LOAD_PLUGIN_RRDTOOL=""
3851 LOAD_PLUGIN_NETWORK=""
3852 LOAD_PLUGIN_CSV=""
3853
3854 AC_MSG_CHECKING([which default write plugin to load])
3855 default_write_plugin="none"
3856 if test "x$enable_rrdtool" = "xyes"
3857 then
3858         default_write_plugin="rrdtool"
3859 else
3860         LOAD_PLUGIN_RRDTOOL="##"
3861 fi
3862
3863 if test "x$enable_network" = "xyes"
3864 then
3865         if test "x$default_write_plugin" = "xnone"
3866         then
3867                 default_write_plugin="network"
3868         else
3869                 LOAD_PLUGIN_NETWORK="#"
3870         fi
3871 else
3872         LOAD_PLUGIN_NETWORK="##"
3873 fi
3874
3875 if test "x$enable_csv" = "xyes"
3876 then
3877         if test "x$default_write_plugin" = "xnone"
3878         then
3879                 default_write_plugin="csv"
3880         else
3881                 LOAD_PLUGIN_CSV="#"
3882         fi
3883 else
3884         LOAD_PLUGIN_CSV="##"
3885 fi
3886 AC_MSG_RESULT([$default_write_plugin])
3887
3888 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
3889 AC_SUBST(LOAD_PLUGIN_NETWORK)
3890 AC_SUBST(LOAD_PLUGIN_CSV)
3891
3892 dnl ip_vs.h
3893 if test "x$ac_system" = "xLinux" \
3894         && test "x$have_net_ip_vs_h$have_ip_vs_h" = "xnono"
3895 then
3896         enable_ipvs="$enable_ipvs (ip_vs.h not found)"
3897 fi
3898
3899 dnl Perl bindings
3900 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
3901 [
3902         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3903         then
3904                 PERL_BINDINGS_OPTIONS="$withval"
3905                 with_perl_bindings="yes"
3906         else
3907                 PERL_BINDINGS_OPTIONS=""
3908                 with_perl_bindings="$withval"
3909         fi
3910 ],
3911 [
3912         PERL_BINDINGS_OPTIONS=""
3913         if test -n "$perl_interpreter"
3914         then
3915                 with_perl_bindings="yes"
3916         else
3917                 with_perl_bindings="no (no perl interpreter found)"
3918         fi
3919 ])
3920 if test "x$with_perl_bindings" = "xyes"
3921 then
3922         PERL_BINDINGS="perl"
3923 else
3924         PERL_BINDINGS=""
3925 fi
3926 AC_SUBST(PERL_BINDINGS)
3927 AC_SUBST(PERL_BINDINGS_OPTIONS)
3928
3929 dnl libcollectdclient
3930 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
3931 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
3932 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
3933
3934 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
3935
3936 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
3937
3938 AC_SUBST(LCC_VERSION_MAJOR)
3939 AC_SUBST(LCC_VERSION_MINOR)
3940 AC_SUBST(LCC_VERSION_PATCH)
3941 AC_SUBST(LCC_VERSION_EXTRA)
3942 AC_SUBST(LCC_VERSION_STRING)
3943
3944 AC_CONFIG_FILES(src/libcollectdclient/lcc_features.h)
3945
3946 AC_OUTPUT(Makefile src/Makefile src/collectd.conf src/owniptc/Makefile src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile)
3947
3948 if test "x$with_librrd" = "xyes" \
3949         && test "x$librrd_threadsafe" != "xyes"
3950 then
3951         with_librrd="yes (warning: librrd is not thread-safe)"
3952 fi
3953
3954 if test "x$with_libiptc" = "xyes" -a "x$with_own_libiptc" = "xyes"
3955 then
3956         with_libiptc="yes (shipped version)"
3957 fi
3958
3959 if test "x$with_libperl" = "xyes"
3960 then
3961         with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
3962 else
3963         enable_perl="no (needs libperl)"
3964 fi
3965
3966 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
3967 then
3968         enable_perl="no (libperl doesn't support ithreads)"
3969 fi
3970
3971 if test "x$with_perl_bindings" = "xyes" \
3972         && test "x$PERL_BINDINGS_OPTIONS" != "x"
3973 then
3974         with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
3975 fi
3976
3977 cat <<EOF;
3978
3979 Configuration:
3980   Libraries:
3981     libcurl . . . . . . . $with_libcurl
3982     libdbi  . . . . . . . $with_libdbi
3983     libesmtp  . . . . . . $with_libesmtp
3984     libganglia  . . . . . $with_libganglia
3985     libgcrypt . . . . . . $with_libgcrypt
3986     libiokit  . . . . . . $with_libiokit
3987     libiptc . . . . . . . $with_libiptc
3988     libjvm  . . . . . . . $with_java
3989     libkstat  . . . . . . $with_kstat
3990     libkvm  . . . . . . . $with_libkvm
3991     libmemcached  . . . . $with_libmemcached
3992     libmysql  . . . . . . $with_libmysql
3993     libnetlink  . . . . . $with_libnetlink
3994     libnetsnmp  . . . . . $with_libnetsnmp
3995     libnotify . . . . . . $with_libnotify
3996     liboconfig  . . . . . $with_liboconfig
3997     libopenipmi . . . . . $with_libopenipmipthread
3998     liboping  . . . . . . $with_liboping
3999     libpcap . . . . . . . $with_libpcap
4000     libperl . . . . . . . $with_libperl
4001     libpq . . . . . . . . $with_libpq
4002     libpthread  . . . . . $with_libpthread
4003     librrd  . . . . . . . $with_librrd
4004     libsensors  . . . . . $with_libsensors
4005     libstatgrab . . . . . $with_libstatgrab
4006     libtokyotyrant  . . . $with_libtokyotyrant
4007     libupsclient  . . . . $with_libupsclient
4008     libvirt . . . . . . . $with_libvirt
4009     libxml2 . . . . . . . $with_libxml2
4010     libxmms . . . . . . . $with_libxmms
4011     libyajl . . . . . . . $with_libyajl
4012     oracle  . . . . . . . $with_oracle
4013
4014   Features:
4015     daemon mode . . . . . $enable_daemon
4016     debug . . . . . . . . $enable_debug
4017
4018   Bindings:
4019     perl  . . . . . . . . $with_perl_bindings
4020
4021   Modules:
4022     apache  . . . . . . . $enable_apache
4023     apcups  . . . . . . . $enable_apcups
4024     apple_sensors . . . . $enable_apple_sensors
4025     ascent  . . . . . . . $enable_ascent
4026     battery . . . . . . . $enable_battery
4027     bind  . . . . . . . . $enable_bind
4028     conntrack . . . . . . $enable_conntrack
4029     cpu . . . . . . . . . $enable_cpu
4030     cpufreq . . . . . . . $enable_cpufreq
4031     csv . . . . . . . . . $enable_csv
4032     curl  . . . . . . . . $enable_curl
4033     curl_json . . . . . . $enable_curl_json
4034     dbi . . . . . . . . . $enable_dbi
4035     df  . . . . . . . . . $enable_df
4036     disk  . . . . . . . . $enable_disk
4037     dns . . . . . . . . . $enable_dns
4038     email . . . . . . . . $enable_email
4039     entropy . . . . . . . $enable_entropy
4040     exec  . . . . . . . . $enable_exec
4041     filecount . . . . . . $enable_filecount
4042     fscache . . . . . . . $enable_fscache
4043     gmond . . . . . . . . $enable_gmond
4044     hddtemp . . . . . . . $enable_hddtemp
4045     interface . . . . . . $enable_interface
4046     ipmi  . . . . . . . . $enable_ipmi
4047     iptables  . . . . . . $enable_iptables
4048     ipvs  . . . . . . . . $enable_ipvs
4049     irq . . . . . . . . . $enable_irq
4050     java  . . . . . . . . $enable_java
4051     libvirt . . . . . . . $enable_libvirt
4052     load  . . . . . . . . $enable_load
4053     logfile . . . . . . . $enable_logfile
4054     madwifi . . . . . . . $enable_madwifi
4055     match_empty_counter . $enable_match_empty_counter
4056     match_regex . . . . . $enable_match_regex
4057     match_timediff  . . . $enable_match_timediff
4058     match_value . . . . . $enable_match_value
4059     mbmon . . . . . . . . $enable_mbmon
4060     memcachec . . . . . . $enable_memcachec
4061     memcached . . . . . . $enable_memcached
4062     memory  . . . . . . . $enable_memory
4063     multimeter  . . . . . $enable_multimeter
4064     mysql . . . . . . . . $enable_mysql
4065     netlink . . . . . . . $enable_netlink
4066     network . . . . . . . $enable_network
4067     nfs . . . . . . . . . $enable_nfs
4068     nginx . . . . . . . . $enable_nginx
4069     notify_desktop  . . . $enable_notify_desktop
4070     notify_email  . . . . $enable_notify_email
4071     ntpd  . . . . . . . . $enable_ntpd
4072     nut . . . . . . . . . $enable_nut
4073     olsrd . . . . . . . . $enable_olsrd
4074     onewire . . . . . . . $enable_onewire
4075     openvpn . . . . . . . $enable_openvpn
4076     oracle  . . . . . . . $enable_oracle
4077     perl  . . . . . . . . $enable_perl
4078     ping  . . . . . . . . $enable_ping
4079     postgresql  . . . . . $enable_postgresql
4080     powerdns  . . . . . . $enable_powerdns
4081     processes . . . . . . $enable_processes
4082     protocols . . . . . . $enable_protocols
4083     rrdcached . . . . . . $enable_rrdcached
4084     rrdtool . . . . . . . $enable_rrdtool
4085     sensors . . . . . . . $enable_sensors
4086     serial  . . . . . . . $enable_serial
4087     snmp  . . . . . . . . $enable_snmp
4088     swap  . . . . . . . . $enable_swap
4089     syslog  . . . . . . . $enable_syslog
4090     table . . . . . . . . $enable_table
4091     tail  . . . . . . . . $enable_tail
4092     tape  . . . . . . . . $enable_tape
4093     target_notification . $enable_target_notification
4094     target_replace  . . . $enable_target_replace
4095     target_set  . . . . . $enable_target_set
4096     tcpconns  . . . . . . $enable_tcpconns
4097     teamspeak2  . . . . . $enable_teamspeak2
4098     ted . . . . . . . . . $enable_ted
4099     thermal . . . . . . . $enable_thermal
4100     tokyotyrant . . . . . $enable_tokyotyrant
4101     unixsock  . . . . . . $enable_unixsock
4102     uptime  . . . . . . . $enable_uptime
4103     users . . . . . . . . $enable_users
4104     uuid  . . . . . . . . $enable_uuid
4105     vmem  . . . . . . . . $enable_vmem
4106     vserver . . . . . . . $enable_vserver
4107     wireless  . . . . . . $enable_wireless
4108     write_http  . . . . . $enable_write_http
4109     xmms  . . . . . . . . $enable_xmms
4110     zfs_arc . . . . . . . $enable_zfs_arc
4111
4112 EOF
4113
4114 if test "x$dependency_error" = "xyes"; then
4115         AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
4116 fi
4117
4118 if test "x$dependency_warning" = "xyes"; then
4119         AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
4120 fi
4121
4122 # vim: set fdm=marker :