docs: Add info about mode7 requirement for ntpd
[collectd.git] / configure.ac
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 AC_CONFIG_AUX_DIR([libltdl/config])
6
7 dnl older automake's default of ARFLAGS=cru is noisy on newer binutils;
8 dnl we don't really need the 'u' even in older toolchains.  Then there is
9 dnl older libtool, which spelled it AR_FLAGS
10 m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"])
11
12 m4_ifdef([LT_PACKAGE_VERSION],
13         # libtool >= 2.2
14         [
15          LT_CONFIG_LTDL_DIR([libltdl])
16          LT_INIT([dlopen])
17          LTDL_INIT([convenience])
18          AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
19         ]
20 ,
21         # libtool <= 1.5
22         [
23          AC_LIBLTDL_CONVENIENCE
24          AC_SUBST(LTDLINCL)
25          AC_SUBST(LIBLTDL)
26          AC_LIBTOOL_DLOPEN
27          AC_CONFIG_SUBDIRS(libltdl)
28          AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
29         ]
30 )
31
32 AM_CONDITIONAL([BUILD_INCLUDED_LTDL], [test "x$LTDLDEPS" != "x"])
33
34 AM_INIT_AUTOMAKE([tar-pax dist-bzip2 foreign])
35 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
36 AC_LANG(C)
37
38 AC_PREFIX_DEFAULT("/opt/collectd")
39
40 AC_SYS_LARGEFILE
41
42 #
43 # Checks for programs.
44 #
45 AC_PROG_CC
46 AC_PROG_CPP
47 AC_PROG_INSTALL
48 AC_PROG_LN_S
49 AC_PROG_MAKE_SET
50 AM_PROG_CC_C_O
51 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
52
53 AC_DISABLE_STATIC
54 AC_PROG_LIBTOOL
55 AC_PROG_LEX
56 AC_PROG_YACC
57
58 # Warn when pkg.m4 is missing
59 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
60
61 PKG_PROG_PKG_CONFIG
62
63 AC_CHECK_PROG([have_protoc_c], [protoc-c], [yes], [no])
64 if test "x$have_protoc_c" = "xno"
65 then
66         have_protoc_c="no (protoc-c compiler not found)"
67 fi
68
69 if test "x$have_protoc_c" = "xyes"
70 then
71         AC_CHECK_HEADERS([protobuf-c/protobuf-c.h google/protobuf-c/protobuf-c.h],
72                          [have_protoc_c="yes"; break],
73                          [have_protoc_c="no (<google/protobuf-c/protobuf-c.h> not found)"])
74 fi
75 if test "x$have_protoc_c" = "xyes"
76 then
77         AC_CHECK_LIB([protobuf-c], [protobuf_c_message_pack],
78                      [have_protoc_c="yes"],
79                      [have_protoc_c="no (libprotobuf-c not found)"])
80
81 fi
82 AM_CONDITIONAL(HAVE_PROTOC_C, test "x$have_protoc_c" = "xyes")
83
84 AC_MSG_CHECKING([for kernel type ($host_os)])
85 case $host_os in
86         *linux*)
87         AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
88         ac_system="Linux"
89         ;;
90         *solaris*)
91         AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
92         ac_system="Solaris"
93         ;;
94         *darwin*)
95         ac_system="Darwin"
96         ;;
97         *openbsd*)
98         ac_system="OpenBSD"
99         ;;
100         *aix*)
101         AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
102         ac_system="AIX"
103         ;;
104         *freebsd*)
105         AC_DEFINE([KERNEL_FREEBSD], 1, [True if program is to be compiled for a FreeBSD kernel])
106         ac_system="FreeBSD"
107         ;;
108         *)
109         ac_system="unknown"
110 esac
111 AC_MSG_RESULT([$ac_system])
112
113 if test "x$ac_system" = "xLinux"
114 then
115         AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
116         if test -z "$KERNEL_DIR"
117         then
118                 KERNEL_DIR="/lib/modules/`uname -r`/source"
119         fi
120
121         KERNEL_CFLAGS="-I$KERNEL_DIR/include"
122         AC_SUBST(KERNEL_CFLAGS)
123 fi
124
125 if test "x$ac_system" = "xSolaris"
126 then
127         AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
128         AC_DEFINE(_REENTRANT,               1, [Define to enable reentrancy interfaces.])
129 fi
130 if test "x$ac_system" = "xAIX"
131 then
132         AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
133 fi
134
135 # Where to install .pc files.
136 pkgconfigdir="${libdir}/pkgconfig"
137 AC_SUBST(pkgconfigdir)
138
139 # Check for standards compliance mode
140 AC_ARG_ENABLE(standards,
141               AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
142               [enable_standards="$enableval"],
143               [enable_standards="no"])
144 if test "x$enable_standards" = "xyes"
145 then
146         AC_DEFINE(_ISOC99_SOURCE,        1, [Define to enforce ISO C99 compliance.])
147         AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
148         AC_DEFINE(_XOPEN_SOURCE,       700, [Define to enforce X/Open 7 (XSI) compliance.])
149         AC_DEFINE(_REENTRANT,            1, [Define to enable reentrancy interfaces.])
150         if test "x$GCC" = "xyes"
151         then
152                 CFLAGS="$CFLAGS -std=c99"
153         fi
154 fi
155 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
156
157 #
158 # Checks for header files.
159 #
160 AC_HEADER_STDC
161 AC_HEADER_SYS_WAIT
162 AC_HEADER_DIRENT
163 AC_HEADER_STDBOOL
164
165 AC_CHECK_HEADERS(stdio.h errno.h math.h stdarg.h syslog.h fcntl.h signal.h assert.h sys/types.h sys/socket.h sys/select.h poll.h netdb.h arpa/inet.h sys/resource.h sys/param.h kstat.h regex.h sys/ioctl.h endian.h sys/isa_defs.h fnmatch.h libgen.h)
166
167 # For ping library
168 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
169 [#if HAVE_STDINT_H
170 # include <stdint.h>
171 #endif
172 #if HAVE_SYS_TYPES_H
173 # include <sys/types.h>
174 #endif
175 ])
176 AC_CHECK_HEADERS(netinet/in.h, [], [],
177 [#if HAVE_STDINT_H
178 # include <stdint.h>
179 #endif
180 #if HAVE_SYS_TYPES_H
181 # include <sys/types.h>
182 #endif
183 #if HAVE_NETINET_IN_SYSTM_H
184 # include <netinet/in_systm.h>
185 #endif
186 ])
187 AC_CHECK_HEADERS(netinet/ip.h, [], [],
188 [#if HAVE_STDINT_H
189 # include <stdint.h>
190 #endif
191 #if HAVE_SYS_TYPES_H
192 # include <sys/types.h>
193 #endif
194 #if HAVE_NETINET_IN_SYSTM_H
195 # include <netinet/in_systm.h>
196 #endif
197 #if HAVE_NETINET_IN_H
198 # include <netinet/in.h>
199 #endif
200 ])
201 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
202 [#if HAVE_STDINT_H
203 # include <stdint.h>
204 #endif
205 #if HAVE_SYS_TYPES_H
206 # include <sys/types.h>
207 #endif
208 #if HAVE_NETINET_IN_SYSTM_H
209 # include <netinet/in_systm.h>
210 #endif
211 #if HAVE_NETINET_IN_H
212 # include <netinet/in.h>
213 #endif
214 #if HAVE_NETINET_IP_H
215 # include <netinet/ip.h>
216 #endif
217 ])
218 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
219 [#if HAVE_STDINT_H
220 # include <stdint.h>
221 #endif
222 #if HAVE_SYS_TYPES_H
223 # include <sys/types.h>
224 #endif
225 #if HAVE_NETINET_IN_SYSTM_H
226 # include <netinet/in_systm.h>
227 #endif
228 #if HAVE_NETINET_IN_H
229 # include <netinet/in.h>
230 #endif
231 #if HAVE_NETINET_IP_H
232 # include <netinet/ip.h>
233 #endif
234 ])
235 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
236 [#if HAVE_STDINT_H
237 # include <stdint.h>
238 #endif
239 #if HAVE_SYS_TYPES_H
240 # include <sys/types.h>
241 #endif
242 #if HAVE_NETINET_IN_SYSTM_H
243 # include <netinet/in_systm.h>
244 #endif
245 #if HAVE_NETINET_IN_H
246 # include <netinet/in.h>
247 #endif
248 ])
249 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
250 [#if HAVE_STDINT_H
251 # include <stdint.h>
252 #endif
253 #if HAVE_SYS_TYPES_H
254 # include <sys/types.h>
255 #endif
256 #if HAVE_NETINET_IN_SYSTM_H
257 # include <netinet/in_systm.h>
258 #endif
259 #if HAVE_NETINET_IN_H
260 # include <netinet/in.h>
261 #endif
262 #if HAVE_NETINET_IP6_H
263 # include <netinet/ip6.h>
264 #endif
265 ])
266 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
267 [#if HAVE_STDINT_H
268 # include <stdint.h>
269 #endif
270 #if HAVE_SYS_TYPES_H
271 # include <sys/types.h>
272 #endif
273 #if HAVE_NETINET_IN_SYSTM_H
274 # include <netinet/in_systm.h>
275 #endif
276 #if HAVE_NETINET_IN_H
277 # include <netinet/in.h>
278 #endif
279 #if HAVE_NETINET_IP_H
280 # include <netinet/ip.h>
281 #endif
282 ])
283 AC_CHECK_HEADERS(netinet/udp.h, [], [],
284 [#if HAVE_STDINT_H
285 # include <stdint.h>
286 #endif
287 #if HAVE_SYS_TYPES_H
288 # include <sys/types.h>
289 #endif
290 #if HAVE_NETINET_IN_SYSTM_H
291 # include <netinet/in_systm.h>
292 #endif
293 #if HAVE_NETINET_IN_H
294 # include <netinet/in.h>
295 #endif
296 #if HAVE_NETINET_IP_H
297 # include <netinet/ip.h>
298 #endif
299 ])
300
301 have_ip6_ext="no"
302 AC_CHECK_TYPES([struct ip6_ext], [have_ip6_ext="yes"], [have_ip6_ext="no"],
303 [#if HAVE_STDINT_H
304 # include <stdint.h>
305 #endif
306 #if HAVE_SYS_TYPES_H
307 # include <sys/types.h>
308 #endif
309 #if HAVE_NETINET_IN_SYSTM_H
310 # include <netinet/in_systm.h>
311 #endif
312 #if HAVE_NETINET_IN_H
313 # include <netinet/in.h>
314 #endif
315 #if HAVE_NETINET_IP6_H
316 # include <netinet/ip6.h>
317 #endif
318 ])
319
320 if test "x$have_ip6_ext" = "xno"; then
321         SAVE_CFLAGS="$CFLAGS"
322         CFLAGS="$CFLAGS -DSOLARIS2=8"
323
324         AC_CHECK_TYPES([struct ip6_ext],
325                        [have_ip6_ext="yes, with -DSOLARIS2=8"],
326                        [have_ip6_ext="no"],
327 [#if HAVE_STDINT_H
328 # include <stdint.h>
329 #endif
330 #if HAVE_SYS_TYPES_H
331 # include <sys/types.h>
332 #endif
333 #if HAVE_NETINET_IN_SYSTM_H
334 # include <netinet/in_systm.h>
335 #endif
336 #if HAVE_NETINET_IN_H
337 # include <netinet/in.h>
338 #endif
339 #if HAVE_NETINET_IP6_H
340 # include <netinet/ip6.h>
341 #endif
342 ])
343
344         if test "x$have_ip6_ext" = "xno"; then
345                 CFLAGS="$SAVE_CFLAGS"
346         fi
347 fi
348
349 # For cpu modules
350 AC_CHECK_HEADERS(sys/dkstat.h)
351 if test "x$ac_system" = "xDarwin"
352 then
353         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)
354         AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
355         # For the battery plugin
356         AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
357 [
358 #if HAVE_IOKIT_IOKITLIB_H
359 #  include <IOKit/IOKitLib.h>
360 #endif
361 #if HAVE_IOKIT_IOTYPES_H
362 #  include <IOKit/IOTypes.h>
363 #endif
364 ])
365
366 fi
367
368 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
369 [
370 #if HAVE_SYS_TYPES_H
371 #  include <sys/types.h>
372 #endif
373 #if HAVE_SYS_PARAM_H
374 # include <sys/param.h>
375 #endif
376 ])
377
378 AC_MSG_CHECKING([for sysctl kern.cp_times])
379 if test -x /sbin/sysctl
380 then
381         /sbin/sysctl kern.cp_times 2>/dev/null
382         if test $? -eq 0
383         then
384                 AC_MSG_RESULT([yes])
385                 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
386                 [Define if sysctl supports kern.cp_times])
387         else
388                 AC_MSG_RESULT([no])
389         fi
390 else
391         AC_MSG_RESULT([no])
392 fi
393
394 # For hddtemp module
395 AC_CHECK_HEADERS(linux/major.h)
396
397 # For md module (Linux only)
398 if test "x$ac_system" = "xLinux"
399 then
400         AC_CHECK_HEADERS(linux/raid/md_u.h,
401                          [have_linux_raid_md_u_h="yes"],
402                          [have_linux_raid_md_u_h="no"],
403 [
404 #include <sys/ioctl.h>
405 #include <linux/major.h>
406 #include <linux/types.h>
407 ])
408 else
409         have_linux_raid_md_u_h="no"
410 fi
411
412 # For the swap module
413 have_linux_wireless_h="no"
414 if test "x$ac_system" = "xLinux"
415 then
416   AC_CHECK_HEADERS(linux/wireless.h,
417                    [have_linux_wireless_h="yes"],
418                    [have_linux_wireless_h="no"],
419 [
420 #include <dirent.h>
421 #include <sys/ioctl.h>
422 #include <sys/socket.h>
423 ])
424 fi
425
426 # For the swap module
427 have_sys_swap_h="yes"
428 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
429 [
430 #undef _FILE_OFFSET_BITS
431 #undef _LARGEFILE64_SOURCE
432 #if HAVE_SYS_TYPES_H
433 #  include <sys/types.h>
434 #endif
435 #if HAVE_SYS_PARAM_H
436 # include <sys/param.h>
437 #endif
438 ])
439
440 if test "x$have_sys_swap_h$ac_system" = "xnoSolaris"
441 then
442         hint_64=""
443         if test "x$GCC" = "xyes"
444         then
445                 hint_64="CFLAGS='-m64'"
446         else
447                 hint_64="CFLAGS='-xarch=v9'"
448         fi
449         AC_MSG_NOTICE([Solaris detected and sys/swap.h not usable. Try building a 64-bit binary ($hint_64 ./configure).])
450 fi
451
452 # For load module
453 # For the processes plugin
454 # For users module
455 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
456
457 # For interface plugin
458 AC_CHECK_HEADERS(ifaddrs.h)
459 AC_CHECK_HEADERS(net/if.h, [], [],
460 [
461 #if HAVE_SYS_TYPES_H
462 #  include <sys/types.h>
463 #endif
464 #if HAVE_SYS_SOCKET_H
465 #  include <sys/socket.h>
466 #endif
467 ])
468 AC_CHECK_HEADERS(linux/if.h, [], [],
469 [
470 #if HAVE_SYS_TYPES_H
471 #  include <sys/types.h>
472 #endif
473 #if HAVE_SYS_SOCKET_H
474 #  include <sys/socket.h>
475 #endif
476 ])
477 AC_CHECK_HEADERS(linux/inet_diag.h, [], [],
478 [
479 #if HAVE_SYS_TYPES_H
480 #  include <sys/types.h>
481 #endif
482 #if HAVE_SYS_SOCKET_H
483 #  include <sys/socket.h>
484 #endif
485 #if HAVE_LINUX_INET_DIAG_H
486 # include <linux/inet_diag.h>
487 #endif
488 ])
489 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
490 [
491 #if HAVE_SYS_TYPES_H
492 #  include <sys/types.h>
493 #endif
494 #if HAVE_SYS_SOCKET_H
495 #  include <sys/socket.h>
496 #endif
497 #if HAVE_LINUX_IF_H
498 # include <linux/if.h>
499 #endif
500 ])
501
502 # For ethstat module
503 AC_CHECK_HEADERS(linux/sockios.h,
504     [have_linux_sockios_h="yes"],
505     [have_linux_sockios_h="no"],
506     [
507 #if HAVE_SYS_IOCTL_H
508 # include <sys/ioctl.h>
509 #endif
510 #if HAVE_NET_IF_H
511 # include <net/if.h>
512 #endif
513     ])
514 AC_CHECK_HEADERS(linux/ethtool.h,
515     [have_linux_ethtool_h="yes"],
516     [have_linux_ethtool_h="no"],
517     [
518 #if HAVE_SYS_IOCTL_H
519 # include <sys/ioctl.h>
520 #endif
521 #if HAVE_NET_IF_H
522 # include <net/if.h>
523 #endif
524 #if HAVE_LINUX_SOCKIOS_H
525 # include <linux/sockios.h>
526 #endif
527     ])
528
529 # For ipvs module
530 have_linux_ip_vs_h="no"
531 have_net_ip_vs_h="no"
532 have_ip_vs_h="no"
533 ip_vs_h_needs_kernel_cflags="no"
534 if test "x$ac_system" = "xLinux"
535 then
536         AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
537         AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
538         AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
539
540         if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
541         then
542                 SAVE_CFLAGS="$CFLAGS"
543                 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
544
545                 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
546
547                 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
548                 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
549                 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
550
551                 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
552                 then
553                         ip_vs_h_needs_kernel_cflags="yes"
554                 fi
555
556                 CFLAGS="$SAVE_CFLAGS"
557         fi
558 fi
559 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
560
561 # For quota module
562 AC_CHECK_HEADERS(sys/ucred.h, [], [],
563 [
564 #if HAVE_SYS_TYPES_H
565 #  include <sys/types.h>
566 #endif
567 #if HAVE_SYS_PARAM_H
568 # include <sys/param.h>
569 #endif
570 ])
571
572 # For mount interface
573 AC_CHECK_HEADERS(sys/mount.h, [], [],
574 [
575 #if HAVE_SYS_TYPES_H
576 #  include <sys/types.h>
577 #endif
578 #if HAVE_SYS_PARAM_H
579 # include <sys/param.h>
580 #endif
581 ])
582
583 # For the email plugin
584 AC_CHECK_HEADERS(linux/un.h, [], [],
585 [
586 #if HAVE_SYS_SOCKET_H
587 #       include <sys/socket.h>
588 #endif
589 ])
590
591 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)
592
593 # For the dns plugin
594 AC_CHECK_HEADERS(arpa/nameser.h)
595 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
596 [
597 #if HAVE_ARPA_NAMESER_H
598 # include <arpa/nameser.h>
599 #endif
600 ])
601
602 AC_CHECK_HEADERS(net/if_arp.h, [], [],
603 [#if HAVE_SYS_SOCKET_H
604 # include <sys/socket.h>
605 #endif
606 ])
607 AC_CHECK_HEADERS(net/ppp_defs.h)
608 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
609 [#if HAVE_NET_PPP_DEFS_H
610 # include <net/ppp_defs.h>
611 #endif
612 ])
613 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
614 [#if HAVE_STDINT_H
615 # include <stdint.h>
616 #endif
617 #if HAVE_SYS_TYPES_H
618 # include <sys/types.h>
619 #endif
620 #if HAVE_SYS_SOCKET_H
621 # include <sys/socket.h>
622 #endif
623 #if HAVE_NET_IF_H
624 # include <net/if.h>
625 #endif
626 #if HAVE_NETINET_IN_H
627 # include <netinet/in.h>
628 #endif
629 ])
630
631 AC_CHECK_HEADERS(netinet/ip_compat.h)
632
633 have_net_pfvar_h="no"
634 AC_CHECK_HEADERS(net/pfvar.h,
635                [have_net_pfvar_h="yes"],
636                [have_net_pfvar_h="no"],
637 [
638 #if HAVE_SYS_IOCTL_H
639 # include <sys/ioctl.h>
640 #endif
641 #if HAVE_SYS_SOCKET_H
642 # include <sys/socket.h>
643 #endif
644 #if HAVE_NET_IF_H
645 # include <net/if.h>
646 #endif
647 #if HAVE_NETINET_IN_H
648 # include <netinet/in.h>
649 #endif
650 ])
651
652 # For the multimeter plugin
653 have_termios_h="no"
654 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
655
656 #
657 # Checks for typedefs, structures, and compiler characteristics.
658 #
659 AC_C_CONST
660 AC_TYPE_PID_T
661 AC_TYPE_SIZE_T
662 AC_TYPE_UID_T
663 AC_HEADER_TIME
664
665 #
666 # Checks for library functions.
667 #
668 AC_PROG_GCC_TRADITIONAL
669 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname)
670
671 AC_FUNC_STRERROR_R
672
673 SAVE_CFLAGS="$CFLAGS"
674 # Emulate behavior of src/Makefile.am
675 if test "x$GCC" = "xyes"
676 then
677         CFLAGS="$CFLAGS -Wall -Werror"
678 fi
679
680 AC_CACHE_CHECK([for strtok_r],
681   [c_cv_have_strtok_r_default],
682   AC_LINK_IFELSE(
683     [AC_LANG_PROGRAM(
684 [[[
685 #include <stdlib.h>
686 #include <stdio.h>
687 #include <string.h>
688 ]]],
689 [[[
690       char buffer[] = "foo,bar,baz";
691       char *token;
692       char *dummy;
693       char *saveptr;
694
695       dummy = buffer;
696       saveptr = NULL;
697       while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
698       {
699         dummy = NULL;
700         printf ("token = %s;\n", token);
701       }
702 ]]]
703     )],
704     [c_cv_have_strtok_r_default="yes"],
705     [c_cv_have_strtok_r_default="no"]
706   )
707 )
708
709 if test "x$c_cv_have_strtok_r_default" = "xno"
710 then
711   CFLAGS="$CFLAGS -D_REENTRANT=1"
712
713   AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
714     [c_cv_have_strtok_r_reentrant],
715     AC_LINK_IFELSE(
716       [AC_LANG_PROGRAM(
717 [[[
718 #include <stdlib.h>
719 #include <stdio.h>
720 #include <string.h>
721 ]]],
722 [[[
723         char buffer[] = "foo,bar,baz";
724         char *token;
725         char *dummy;
726         char *saveptr;
727
728         dummy = buffer;
729         saveptr = NULL;
730         while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
731         {
732           dummy = NULL;
733           printf ("token = %s;\n", token);
734         }
735 ]]]
736       )],
737       [c_cv_have_strtok_r_reentrant="yes"],
738       [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
739     )
740   )
741 fi
742
743 CFLAGS="$SAVE_CFLAGS"
744 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
745 then
746         CFLAGS="$CFLAGS -D_REENTRANT=1"
747 fi
748
749 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
750
751 socket_needs_socket="no"
752 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
753 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
754
755 clock_gettime_needs_rt="no"
756 clock_gettime_needs_posix4="no"
757 have_clock_gettime="no"
758 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
759 if test "x$have_clock_gettime" = "xno"
760 then
761         AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
762                                          have_clock_gettime="yes"])
763 fi
764 if test "x$have_clock_gettime" = "xno"
765 then
766         AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
767                                              have_clock_gettime="yes"])
768 fi
769 if test "x$have_clock_gettime" = "xyes"
770 then
771         AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
772 else
773         AC_MSG_WARN(cannot find clock_gettime)
774 fi
775
776 nanosleep_needs_rt="no"
777 nanosleep_needs_posix4="no"
778 AC_CHECK_FUNCS(nanosleep,
779     [],
780     AC_CHECK_LIB(rt, nanosleep,
781         [nanosleep_needs_rt="yes"],
782         AC_CHECK_LIB(posix4, nanosleep,
783             [nanosleep_needs_posix4="yes"],
784             AC_MSG_ERROR(cannot find nanosleep))))
785
786 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
787 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
788
789 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
790 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
791 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
792 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
793 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
794 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
795 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
796 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
797 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
798 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
799 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
800 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
801
802 # Check for strptime {{{
803 if test "x$GCC" = "xyes"
804 then
805         SAVE_CFLAGS="$CFLAGS"
806         CFLAGS="$CFLAGS -Wall -Wextra -Werror"
807 fi
808
809 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
810 if test "x$have_strptime" = "xyes"
811 then
812         AC_CACHE_CHECK([whether strptime is exported by default],
813                        [c_cv_have_strptime_default],
814                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
815 [[[
816 #include <time.h>
817 ]]],
818 [[[
819  struct tm stm;
820  (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
821 ]]]
822                        )],
823                        [c_cv_have_strptime_default="yes"],
824                        [c_cv_have_strptime_default="no"]))
825 fi
826 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
827 then
828         AC_CACHE_CHECK([whether strptime needs standards mode],
829                        [c_cv_have_strptime_standards],
830                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
831 [[[
832 #ifndef _ISOC99_SOURCE
833 # define _ISOC99_SOURCE 1
834 #endif
835 #ifndef _POSIX_C_SOURCE
836 # define _POSIX_C_SOURCE 200112L
837 #endif
838 #ifndef _XOPEN_SOURCE
839 # define _XOPEN_SOURCE 500
840 #endif
841 #include <time.h>
842 ]]],
843 [[[
844  struct tm stm;
845  (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
846 ]]]
847                        )],
848                        [c_cv_have_strptime_standards="yes"],
849                        [c_cv_have_strptime_standards="no"]))
850
851         if test "x$c_cv_have_strptime_standards" = "xyes"
852         then
853                 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
854         else
855                 have_strptime="no"
856         fi
857 fi
858
859 if test "x$GCC" = "xyes"
860 then
861         CFLAGS="$SAVE_CFLAGS"
862 fi
863 # }}} Check for strptime
864
865 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
866 if test "x$have_swapctl" = "xyes"; then
867         AC_CACHE_CHECK([whether swapctl takes two arguments],
868                 [c_cv_have_swapctl_two_args],
869                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
870 [[[
871 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
872 #  undef _FILE_OFFSET_BITS
873 #  undef _LARGEFILE64_SOURCE
874 #endif
875 #include <sys/stat.h>
876 #include <sys/swap.h>
877 ]]],
878 [[[
879 int num = swapctl(0, NULL);
880 ]]]
881                         )],
882                         [c_cv_have_swapctl_two_args="yes"],
883                         [c_cv_have_swapctl_two_args="no"]
884                 )
885         )
886         AC_CACHE_CHECK([whether swapctl takes three arguments],
887                 [c_cv_have_swapctl_three_args],
888                 AC_COMPILE_IFELSE(
889                         [AC_LANG_PROGRAM(
890 [[[
891 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
892 #  undef _FILE_OFFSET_BITS
893 #  undef _LARGEFILE64_SOURCE
894 #endif
895 #include <sys/stat.h>
896 #include <sys/swap.h>
897 ]]],
898 [[[
899 int num = swapctl(0, NULL, 0);
900 ]]]
901                         )],
902                         [c_cv_have_swapctl_three_args="yes"],
903                         [c_cv_have_swapctl_three_args="no"]
904                 )
905         )
906 fi
907 # Check for different versions of `swapctl' here..
908 if test "x$have_swapctl" = "xyes"; then
909         if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
910                 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
911                           [Define if the function swapctl exists and takes two arguments.])
912         fi
913         if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
914                 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
915                           [Define if the function swapctl exists and takes three arguments.])
916         fi
917 fi
918
919 # Check for NAN
920 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
921 [
922  if test "x$withval" = "xno"; then
923          nan_type="none"
924  else if test "x$withval" = "xyes"; then
925          nan_type="zero"
926  else
927          nan_type="$withval"
928  fi; fi
929 ],
930 [nan_type="none"])
931 if test "x$nan_type" = "xnone"; then
932   AC_CACHE_CHECK([whether NAN is defined by default],
933     [c_cv_have_nan_default],
934     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
935 [[[
936 #include <stdlib.h>
937 #include <math.h>
938 static double foo = NAN;
939 ]]],
940 [[[
941        if (isnan (foo))
942         return 0;
943        else
944         return 1;
945 ]]]
946       )],
947       [c_cv_have_nan_default="yes"],
948       [c_cv_have_nan_default="no"]
949     )
950   )
951   if test "x$c_cv_have_nan_default" = "xyes"
952   then
953     nan_type="default"
954   fi
955 fi
956 if test "x$nan_type" = "xnone"; then
957   AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
958     [c_cv_have_nan_isoc],
959     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
960 [[[
961 #include <stdlib.h>
962 #define __USE_ISOC99 1
963 #include <math.h>
964 static double foo = NAN;
965 ]]],
966 [[[
967        if (isnan (foo))
968         return 0;
969        else
970         return 1;
971 ]]]
972       )],
973       [c_cv_have_nan_isoc="yes"],
974       [c_cv_have_nan_isoc="no"]
975     )
976   )
977   if test "x$c_cv_have_nan_isoc" = "xyes"
978   then
979     nan_type="isoc99"
980   fi
981 fi
982 if test "x$nan_type" = "xnone"; then
983   SAVE_LDFLAGS=$LDFLAGS
984   LDFLAGS="$LDFLAGS -lm"
985   AC_CACHE_CHECK([whether NAN can be defined by 0/0],
986     [c_cv_have_nan_zero],
987     AC_RUN_IFELSE([AC_LANG_PROGRAM(
988 [[[
989 #include <stdlib.h>
990 #include <math.h>
991 #ifdef NAN
992 # undef NAN
993 #endif
994 #define NAN (0.0 / 0.0)
995 #ifndef isnan
996 # define isnan(f) ((f) != (f))
997 #endif
998 static double foo = NAN;
999 ]]],
1000 [[[
1001        if (isnan (foo))
1002         return 0;
1003        else
1004         return 1;
1005 ]]]
1006       )],
1007       [c_cv_have_nan_zero="yes"],
1008       [c_cv_have_nan_zero="no"]
1009     )
1010   )
1011   LDFLAGS=$SAVE_LDFLAGS
1012   if test "x$c_cv_have_nan_zero" = "xyes"
1013   then
1014     nan_type="zero"
1015   fi
1016 fi
1017
1018 if test "x$nan_type" = "xdefault"; then
1019   AC_DEFINE(NAN_STATIC_DEFAULT, 1,
1020     [Define if NAN is defined by default and can initialize static variables.])
1021 else if test "x$nan_type" = "xisoc99"; then
1022   AC_DEFINE(NAN_STATIC_ISOC, 1,
1023     [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
1024 else if test "x$nan_type" = "xzero"; then
1025   AC_DEFINE(NAN_ZERO_ZERO, 1,
1026     [Define if NAN can be defined as (0.0 / 0.0)])
1027 else
1028   AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
1029 fi; fi; fi
1030
1031 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
1032 [
1033  if test "x$withval" = "xnothing"; then
1034         fp_layout_type="nothing"
1035  else if test "x$withval" = "xendianflip"; then
1036         fp_layout_type="endianflip"
1037  else if test "x$withval" = "xintswap"; then
1038         fp_layout_type="intswap"
1039  else
1040         AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
1041 fi; fi; fi
1042 ],
1043 [fp_layout_type="unknown"])
1044
1045 if test "x$fp_layout_type" = "xunknown"; then
1046   AC_CACHE_CHECK([if doubles are stored in x86 representation],
1047     [c_cv_fp_layout_need_nothing],
1048     AC_RUN_IFELSE([AC_LANG_PROGRAM(
1049 [[[
1050 #include <stdlib.h>
1051 #include <stdio.h>
1052 #include <string.h>
1053 #if HAVE_STDINT_H
1054 # include <stdint.h>
1055 #endif
1056 #if HAVE_INTTYPES_H
1057 # include <inttypes.h>
1058 #endif
1059 #if HAVE_STDBOOL_H
1060 # include <stdbool.h>
1061 #endif
1062 ]]],
1063 [[[
1064         uint64_t i0;
1065         uint64_t i1;
1066         uint8_t c[8];
1067         double d;
1068
1069         d = 8.642135e130; 
1070         memcpy ((void *) &i0, (void *) &d, 8);
1071
1072         i1 = i0;
1073         memcpy ((void *) c, (void *) &i1, 8);
1074
1075         if ((c[0] == 0x2f) && (c[1] == 0x25)
1076                         && (c[2] == 0xc0) && (c[3] == 0xc7)
1077                         && (c[4] == 0x43) && (c[5] == 0x2b)
1078                         && (c[6] == 0x1f) && (c[7] == 0x5b))
1079                 return (0);
1080         else
1081                 return (1);
1082 ]]]
1083       )],
1084       [c_cv_fp_layout_need_nothing="yes"],
1085       [c_cv_fp_layout_need_nothing="no"]
1086     )
1087   )
1088   if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
1089     fp_layout_type="nothing"
1090   fi
1091 fi
1092 if test "x$fp_layout_type" = "xunknown"; then
1093   AC_CACHE_CHECK([if endianflip converts to x86 representation],
1094     [c_cv_fp_layout_need_endianflip],
1095     AC_RUN_IFELSE([AC_LANG_PROGRAM(
1096 [[[
1097 #include <stdlib.h>
1098 #include <stdio.h>
1099 #include <string.h>
1100 #if HAVE_STDINT_H
1101 # include <stdint.h>
1102 #endif
1103 #if HAVE_INTTYPES_H
1104 # include <inttypes.h>
1105 #endif
1106 #if HAVE_STDBOOL_H
1107 # include <stdbool.h>
1108 #endif
1109 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
1110                        (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
1111                        (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1112                        (((uint64_t)(A) & 0x000000ff00000000LL) >> 8)  | \
1113                        (((uint64_t)(A) & 0x00000000ff000000LL) << 8)  | \
1114                        (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1115                        (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1116                        (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1117 ]]],
1118 [[[
1119         uint64_t i0;
1120         uint64_t i1;
1121         uint8_t c[8];
1122         double d;
1123
1124         d = 8.642135e130; 
1125         memcpy ((void *) &i0, (void *) &d, 8);
1126
1127         i1 = endianflip (i0);
1128         memcpy ((void *) c, (void *) &i1, 8);
1129
1130         if ((c[0] == 0x2f) && (c[1] == 0x25)
1131                         && (c[2] == 0xc0) && (c[3] == 0xc7)
1132                         && (c[4] == 0x43) && (c[5] == 0x2b)
1133                         && (c[6] == 0x1f) && (c[7] == 0x5b))
1134                 return (0);
1135         else
1136                 return (1);
1137 ]]]
1138       )],
1139       [c_cv_fp_layout_need_endianflip="yes"],
1140       [c_cv_fp_layout_need_endianflip="no"]
1141     )
1142   )
1143   if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1144     fp_layout_type="endianflip"
1145   fi
1146 fi
1147 if test "x$fp_layout_type" = "xunknown"; then
1148   AC_CACHE_CHECK([if intswap converts to x86 representation],
1149     [c_cv_fp_layout_need_intswap],
1150     AC_RUN_IFELSE([AC_LANG_PROGRAM(
1151 [[[
1152 #include <stdlib.h>
1153 #include <stdio.h>
1154 #include <string.h>
1155 #if HAVE_STDINT_H
1156 # include <stdint.h>
1157 #endif
1158 #if HAVE_INTTYPES_H
1159 # include <inttypes.h>
1160 #endif
1161 #if HAVE_STDBOOL_H
1162 # include <stdbool.h>
1163 #endif
1164 #define intswap(A)    ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1165                        (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1166 ]]],
1167 [[[
1168         uint64_t i0;
1169         uint64_t i1;
1170         uint8_t c[8];
1171         double d;
1172
1173         d = 8.642135e130; 
1174         memcpy ((void *) &i0, (void *) &d, 8);
1175
1176         i1 = intswap (i0);
1177         memcpy ((void *) c, (void *) &i1, 8);
1178
1179         if ((c[0] == 0x2f) && (c[1] == 0x25)
1180                         && (c[2] == 0xc0) && (c[3] == 0xc7)
1181                         && (c[4] == 0x43) && (c[5] == 0x2b)
1182                         && (c[6] == 0x1f) && (c[7] == 0x5b))
1183                 return (0);
1184         else
1185                 return (1);
1186 ]]]
1187       )],
1188       [c_cv_fp_layout_need_intswap="yes"],
1189       [c_cv_fp_layout_need_intswap="no"]
1190     )
1191   )
1192   if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1193     fp_layout_type="intswap"
1194   fi
1195 fi
1196
1197 if test "x$fp_layout_type" = "xnothing"; then
1198   AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1199   [Define if doubles are stored in x86 representation.])
1200 else if test "x$fp_layout_type" = "xendianflip"; then
1201   AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1202   [Define if endianflip is needed to convert to x86 representation.])
1203 else if test "x$fp_layout_type" = "xintswap"; then
1204   AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1205   [Define if intswap is needed to convert to x86 representation.])
1206 else
1207   AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1208 fi; fi; fi
1209
1210 have_getfsstat="no"
1211 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1212 have_getvfsstat="no"
1213 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1214 have_listmntent="no"
1215 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1216 have_getmntent_r="no"
1217 AC_CHECK_FUNCS(getmntent_r, [have_getmntent_r="yes"])
1218
1219 have_getmntent="no"
1220 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1221 if test "x$have_getmntent" = "xno"; then
1222         AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1223 fi
1224 if test "x$have_getmntent" = "xno"; then
1225         AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1226 fi
1227 if test "x$have_getmntent" = "xno"; then
1228         AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1229 fi
1230
1231 if test "x$have_getmntent" = "xc"; then
1232         AC_CACHE_CHECK([whether getmntent takes one argument],
1233                 [c_cv_have_one_getmntent],
1234                 AC_COMPILE_IFELSE(
1235                         [AC_LANG_PROGRAM(
1236 [[[
1237 #include "$srcdir/src/utils_mount.h"
1238 ]]],
1239 [[[
1240 FILE *fh;
1241 struct mntent *me;
1242 fh = setmntent ("/etc/mtab", "r");
1243 me = getmntent (fh);
1244 return(me->mnt_passno);
1245 ]]]
1246                         )],
1247                         [c_cv_have_one_getmntent="yes"],
1248                         [c_cv_have_one_getmntent="no"]
1249                 )
1250         )
1251         AC_CACHE_CHECK([whether getmntent takes two arguments],
1252                 [c_cv_have_two_getmntent],
1253                 AC_COMPILE_IFELSE(
1254                         [AC_LANG_PROGRAM(
1255 [[[
1256 #include "$srcdir/src/utils_mount.h"
1257 ]]],
1258 [[[
1259                                  FILE *fh;
1260                                  struct mnttab mt;
1261                                  int status;
1262                                  fh = fopen ("/etc/mnttab", "r");
1263                                  status = getmntent (fh, &mt);
1264                                  return(status);
1265 ]]]
1266                         )],
1267                         [c_cv_have_two_getmntent="yes"],
1268                         [c_cv_have_two_getmntent="no"]
1269                 )
1270         )
1271 fi
1272
1273 # Check for different versions of `getmntent' here..
1274
1275 if test "x$have_getmntent" = "xc"; then
1276         if test "x$c_cv_have_one_getmntent" = "xyes"; then
1277                 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1278                           [Define if the function getmntent exists and takes one argument.])
1279         fi
1280         if test "x$c_cv_have_two_getmntent" = "xyes"; then
1281                 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1282                           [Define if the function getmntent exists and takes two arguments.])
1283         fi
1284 fi
1285 if test "x$have_getmntent" = "xsun"; then
1286         AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1287                   [Define if the function getmntent exists. It's the version from libsun.])
1288 fi
1289 if test "x$have_getmntent" = "xseq"; then
1290         AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1291                   [Define if the function getmntent exists. It's the version from libseq.])
1292 fi
1293 if test "x$have_getmntent" = "xgen"; then
1294         AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1295                   [Define if the function getmntent exists. It's the version from libgen.])
1296 fi
1297
1298 # Check for htonll
1299 AC_CACHE_CHECK([if have htonll defined],
1300                   [c_cv_have_htonll],
1301                   AC_LINK_IFELSE([AC_LANG_PROGRAM(
1302 [[[
1303 #include <sys/types.h>
1304 #include <netinet/in.h>
1305 #if HAVE_INTTYPES_H
1306 # include <inttypes.h>
1307 #endif
1308 ]]],
1309 [[[
1310           return htonll(0);
1311 ]]]
1312     )],
1313     [c_cv_have_htonll="yes"],
1314     [c_cv_have_htonll="no"]
1315        )
1316 )
1317 if test "x$c_cv_have_htonll" = "xyes"
1318 then
1319     AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1320 fi
1321
1322 # Check for structures
1323 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1324         [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1325         [],
1326         [
1327         #include <sys/types.h>
1328         #include <sys/socket.h>
1329         #include <net/if.h>
1330         ])
1331 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1332         [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1333         [],
1334         [
1335         #include <sys/types.h>
1336         #include <sys/socket.h>
1337         #include <linux/if.h>
1338         #include <linux/netdevice.h>
1339         ])
1340 AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states],
1341         [AC_DEFINE(HAVE_STRUCT_LINUX_INET_DIAG_REQ, 1, [Define if struct inet_diag_req exists and is usable.])],
1342         [],
1343         [
1344         #include <linux/inet_diag.h>
1345         ])
1346
1347
1348 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1349         [],
1350         [
1351         #include <netinet/in.h>
1352         #include <net/if.h>
1353         ])
1354
1355 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1356         [
1357                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1358                         [Define if struct kinfo_proc exists in the FreeBSD variant.])
1359                 have_struct_kinfo_proc_freebsd="yes"
1360         ],
1361         [
1362                 have_struct_kinfo_proc_freebsd="no"
1363         ],
1364         [
1365 #include <kvm.h>
1366 #include <sys/param.h>
1367 #include <sys/sysctl.h>
1368 #include <sys/user.h>
1369         ])
1370
1371 AC_CHECK_MEMBERS([struct kinfo_proc.kp_proc, struct kinfo_proc.kp_eproc],
1372         [
1373                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1374                         [Define if struct kinfo_proc exists in the OpenBSD variant.])
1375                 have_struct_kinfo_proc_openbsd="yes"
1376         ],
1377         [
1378                 have_struct_kinfo_proc_openbsd="no"
1379         ],
1380         [
1381 #include <sys/param.h>
1382 #include <sys/sysctl.h>
1383 #include <kvm.h>
1384         ])
1385
1386 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1387 [#define _BSD_SOURCE
1388 #if HAVE_STDINT_H
1389 # include <stdint.h>
1390 #endif
1391 #if HAVE_SYS_TYPES_H
1392 # include <sys/types.h>
1393 #endif
1394 #if HAVE_NETINET_IN_SYSTM_H
1395 # include <netinet/in_systm.h>
1396 #endif
1397 #if HAVE_NETINET_IN_H
1398 # include <netinet/in.h>
1399 #endif
1400 #if HAVE_NETINET_IP_H
1401 # include <netinet/ip.h>
1402 #endif
1403 #if HAVE_NETINET_UDP_H
1404 # include <netinet/udp.h>
1405 #endif
1406 ])
1407 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1408 [#define _BSD_SOURCE
1409 #if HAVE_STDINT_H
1410 # include <stdint.h>
1411 #endif
1412 #if HAVE_SYS_TYPES_H
1413 # include <sys/types.h>
1414 #endif
1415 #if HAVE_NETINET_IN_SYSTM_H
1416 # include <netinet/in_systm.h>
1417 #endif
1418 #if HAVE_NETINET_IN_H
1419 # include <netinet/in.h>
1420 #endif
1421 #if HAVE_NETINET_IP_H
1422 # include <netinet/ip.h>
1423 #endif
1424 #if HAVE_NETINET_UDP_H
1425 # include <netinet/udp.h>
1426 #endif
1427 ])
1428
1429 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1430         [],
1431         [],
1432         [
1433 #if HAVE_KSTAT_H
1434 # include <kstat.h>
1435 #endif
1436         ])
1437
1438 #
1439 # Checks for libraries begin here
1440 #
1441
1442 with_libresolv="yes"
1443 AC_CHECK_LIB(resolv, res_search,
1444 [
1445         AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1446 ],
1447 [with_libresolv="no"])
1448 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1449
1450 dnl Check for HAL (hardware abstraction library)
1451 with_libhal="yes"
1452 AC_CHECK_LIB(hal,libhal_device_property_exists,
1453              [AC_DEFINE(HAVE_LIBHAL, 1, [Define to 1 if you have 'hal' library])],
1454              [with_libhal="no"])
1455 if test "x$with_libhal" = "xyes"; then
1456         if test "x$PKG_CONFIG" != "x"; then
1457                 BUILD_WITH_LIBHAL_CFLAGS="`$PKG_CONFIG --cflags hal`"
1458                 BUILD_WITH_LIBHAL_LIBS="`$PKG_CONFIG --libs hal`"
1459                 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1460                 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1461         fi
1462 fi
1463
1464 m4_divert_once([HELP_WITH], [
1465 collectd additional packages:])
1466
1467 AM_CONDITIONAL([BUILD_FREEBSD],[test "x$x$ac_system" = "xFreeBSD"])
1468
1469 AM_CONDITIONAL([BUILD_AIX],[test "x$x$ac_system" = "xAIX"]) 
1470
1471 if test "x$ac_system" = "xAIX"
1472 then
1473         with_perfstat="yes"
1474         with_procinfo="yes"
1475 else
1476         with_perfstat="no (AIX only)"
1477         with_procinfo="no (AIX only)"
1478 fi
1479
1480 if test "x$with_perfstat" = "xyes"
1481 then
1482         AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1483 #       AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1484 fi
1485 if test "x$with_perfstat" = "xyes"
1486 then
1487          AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1488          # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1489          AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1490          if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1491          then
1492                 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1493          fi
1494 fi
1495 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1496
1497 # Processes plugin under AIX.
1498 if test "x$with_procinfo" = "xyes"
1499 then
1500         AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1501 fi
1502 if test "x$with_procinfo" = "xyes"
1503 then
1504          AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1505 fi
1506
1507 if test "x$ac_system" = "xSolaris"
1508 then
1509         with_kstat="yes"
1510         with_devinfo="yes"
1511 else
1512         with_kstat="no (Solaris only)"
1513         with_devinfo="no (Solaris only)"
1514 fi
1515
1516 if test "x$with_kstat" = "xyes"
1517 then
1518         AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1519 fi
1520 if test "x$with_kstat" = "xyes"
1521 then
1522         AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1523         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1524 fi
1525 if test "x$with_kstat" = "xyes"
1526 then
1527         AC_DEFINE(HAVE_LIBKSTAT, 1,
1528                   [Define to 1 if you have the 'kstat' library (-lkstat)])
1529 fi
1530 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1531 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1532
1533 with_libiokit="no"
1534 if test "x$ac_system" = "xDarwin"
1535 then
1536         with_libiokit="yes"
1537 else
1538         with_libiokit="no"
1539 fi
1540 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1541
1542 with_libkvm="no"
1543 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1544 if test "x$with_kvm_getprocs" = "xyes"
1545 then
1546         AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1547                   [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1548         with_libkvm="yes"
1549 fi
1550 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1551
1552 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1553 if test "x$with_kvm_getswapinfo" = "xyes"
1554 then
1555         AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1556                   [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1557         with_libkvm="yes"
1558 fi
1559 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1560
1561 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1562 if test "x$with_kvm_nlist" = "xyes"
1563 then
1564         AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1565         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1566                   [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1567         with_libkvm="yes"
1568 fi
1569 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1570
1571 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1572 if test "x$with_kvm_openfiles" = "xyes"
1573 then
1574         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1575                   [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1576         with_libkvm="yes"
1577 fi
1578 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1579
1580 # --with-libaquaero5 {{{
1581 AC_ARG_WITH(libaquaero5, [AS_HELP_STRING([--with-libaquaero5@<:@=PREFIX@:>@], [Path to aquatools-ng source code.])],
1582 [
1583  if test "x$withval" = "xyes"
1584  then
1585          with_libaquaero5="yes"
1586  else if test "x$withval" = "xno"
1587  then
1588          with_libaquaero5="no"
1589  else
1590          with_libaquaero5="yes"
1591          LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS -I$withval/src"
1592          LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS -L$withval/obj"
1593  fi; fi
1594 ],
1595 [with_libaquaero5="yes"])
1596
1597 SAVE_CPPFLAGS="$CPPFLAGS"
1598 SAVE_LDFLAGS="$LDFLAGS"
1599
1600 CPPFLAGS="$CPPFLAGS $LIBAQUAERO5_CFLAGS"
1601 LDFLAGS="$LDFLAGS $LIBAQUAERO5_LDFLAGS"
1602
1603 if test "x$with_libaquaero5" = "xyes"
1604 then
1605         if test "x$LIBAQUAERO5_CFLAGS" != "x"
1606         then
1607                 AC_MSG_NOTICE([libaquaero5 CPPFLAGS: $LIBAQUAERO5_CFLAGS])
1608         fi
1609         AC_CHECK_HEADERS(libaquaero5.h,
1610         [with_libaquaero5="yes"],
1611         [with_libaquaero5="no (libaquaero5.h not found)"])
1612 fi
1613 if test "x$with_libaquaero5" = "xyes"
1614 then
1615         if test "x$LIBAQUAERO5_LDFLAGS" != "x"
1616         then
1617                 AC_MSG_NOTICE([libaquaero5 LDFLAGS: $LIBAQUAERO5_LDFLAGS])
1618         fi
1619         AC_CHECK_LIB(aquaero5, libaquaero5_poll,
1620         [with_libaquaero5="yes"],
1621         [with_libaquaero5="no (symbol 'libaquaero5_poll' not found)"])
1622 fi
1623
1624 CPPFLAGS="$SAVE_CPPFLAGS"
1625 LDFLAGS="$SAVE_LDFLAGS"
1626
1627 if test "x$with_libaquaero5" = "xyes"
1628 then
1629         BUILD_WITH_LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS"
1630         BUILD_WITH_LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS"
1631         AC_SUBST(BUILD_WITH_LIBAQUAERO5_CFLAGS)
1632         AC_SUBST(BUILD_WITH_LIBAQUAERO5_LDFLAGS)
1633 fi
1634 AM_CONDITIONAL(BUILD_WITH_LIBAQUAERO5, test "x$with_libaquaero5" = "xyes")
1635 # }}}
1636
1637 # --with-libcredis {{{
1638 AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])],
1639 [
1640  if test "x$withval" = "xyes"
1641  then
1642          with_libcredis="yes"
1643  else if test "x$withval" = "xno"
1644  then
1645          with_libcredis="no"
1646  else
1647          with_libcredis="yes"
1648          LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS -I$withval/include"
1649          LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS -L$withval/lib"
1650  fi; fi
1651 ],
1652 [with_libcredis="yes"])
1653
1654 SAVE_CPPFLAGS="$CPPFLAGS"
1655 SAVE_LDFLAGS="$LDFLAGS"
1656
1657 CPPFLAGS="$CPPFLAGS $LIBCREDIS_CPPFLAGS"
1658 LDFLAGS="$LDFLAGS $LIBCREDIS_LDFLAGS"
1659
1660 if test "x$with_libcredis" = "xyes"
1661 then
1662         if test "x$LIBCREDIS_CPPFLAGS" != "x"
1663         then
1664                 AC_MSG_NOTICE([libcredis CPPFLAGS: $LIBCREDIS_CPPFLAGS])
1665         fi
1666         AC_CHECK_HEADERS(credis.h,
1667         [with_libcredis="yes"],
1668         [with_libcredis="no (credis.h not found)"])
1669 fi
1670 if test "x$with_libcredis" = "xyes"
1671 then
1672         if test "x$LIBCREDIS_LDFLAGS" != "x"
1673         then
1674                 AC_MSG_NOTICE([libcredis LDFLAGS: $LIBCREDIS_LDFLAGS])
1675         fi
1676         AC_CHECK_LIB(credis, credis_info,
1677         [with_libcredis="yes"],
1678         [with_libcredis="no (symbol 'credis_info' not found)"])
1679
1680 fi
1681
1682 CPPFLAGS="$SAVE_CPPFLAGS"
1683 LDFLAGS="$SAVE_LDFLAGS"
1684
1685 if test "x$with_libcredis" = "xyes"
1686 then
1687         BUILD_WITH_LIBCREDIS_CPPFLAGS="$LIBCREDIS_CPPFLAGS"
1688         BUILD_WITH_LIBCREDIS_LDFLAGS="$LIBCREDIS_LDFLAGS"
1689         AC_SUBST(BUILD_WITH_LIBCREDIS_CPPFLAGS)
1690         AC_SUBST(BUILD_WITH_LIBCREDIS_LDFLAGS)
1691 fi
1692 AM_CONDITIONAL(BUILD_WITH_LIBCREDIS, test "x$with_libcredis" = "xyes")
1693 # }}}
1694
1695 # --with-libcurl {{{
1696 with_curl_config="curl-config"
1697 with_curl_cflags=""
1698 with_curl_libs=""
1699 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
1700 [
1701         if test "x$withval" = "xno"
1702         then
1703                 with_libcurl="no"
1704         else if test "x$withval" = "xyes"
1705         then
1706                 with_libcurl="yes"
1707         else
1708                 if test -f "$withval" && test -x "$withval"
1709                 then
1710                         with_curl_config="$withval"
1711                         with_libcurl="yes"
1712                 else if test -x "$withval/bin/curl-config"
1713                 then
1714                         with_curl_config="$withval/bin/curl-config"
1715                         with_libcurl="yes"
1716                 fi; fi
1717                 with_libcurl="yes"
1718         fi; fi
1719 ],
1720 [
1721         with_libcurl="yes"
1722 ])
1723 if test "x$with_libcurl" = "xyes"
1724 then
1725         with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
1726         curl_config_status=$?
1727
1728         if test $curl_config_status -ne 0
1729         then
1730                 with_libcurl="no ($with_curl_config failed)"
1731         else
1732                 SAVE_CPPFLAGS="$CPPFLAGS"
1733                 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
1734
1735                 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
1736
1737                 CPPFLAGS="$SAVE_CPPFLAGS"
1738         fi
1739 fi
1740 if test "x$with_libcurl" = "xyes"
1741 then
1742         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
1743         curl_config_status=$?
1744
1745         if test $curl_config_status -ne 0
1746         then
1747                 with_libcurl="no ($with_curl_config failed)"
1748         else
1749                 AC_CHECK_LIB(curl, curl_easy_init,
1750                  [with_libcurl="yes"],
1751                  [with_libcurl="no (symbol 'curl_easy_init' not found)"],
1752                  [$with_curl_libs])
1753         fi
1754 fi
1755 if test "x$with_libcurl" = "xyes"
1756 then
1757         BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
1758         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
1759         AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
1760         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
1761 fi
1762 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
1763 # }}}
1764
1765 # --with-libdbi {{{
1766 with_libdbi_cppflags=""
1767 with_libdbi_ldflags=""
1768 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
1769 [
1770         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1771         then
1772                 with_libdbi_cppflags="-I$withval/include"
1773                 with_libdbi_ldflags="-L$withval/lib"
1774                 with_libdbi="yes"
1775         else
1776                 with_libdbi="$withval"
1777         fi
1778 ],
1779 [
1780         with_libdbi="yes"
1781 ])
1782 if test "x$with_libdbi" = "xyes"
1783 then
1784         SAVE_CPPFLAGS="$CPPFLAGS"
1785         CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1786
1787         AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
1788
1789         CPPFLAGS="$SAVE_CPPFLAGS"
1790 fi
1791 if test "x$with_libdbi" = "xyes"
1792 then
1793         SAVE_CPPFLAGS="$CPPFLAGS"
1794         SAVE_LDFLAGS="$LDFLAGS"
1795         CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
1796         LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
1797
1798         AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
1799
1800         CPPFLAGS="$SAVE_CPPFLAGS"
1801         LDFLAGS="$SAVE_LDFLAGS"
1802 fi
1803 if test "x$with_libdbi" = "xyes"
1804 then
1805         BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
1806         BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
1807         BUILD_WITH_LIBDBI_LIBS="-ldbi"
1808         AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
1809         AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
1810         AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
1811 fi
1812 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
1813 # }}}
1814
1815 # --with-libesmtp {{{
1816 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
1817 [
1818         if test "x$withval" != "xno" && test "x$withval" != "xyes"
1819         then
1820                 LDFLAGS="$LDFLAGS -L$withval/lib"
1821                 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
1822                 with_libesmtp="yes"
1823         else
1824                 with_libesmtp="$withval"
1825         fi
1826 ],
1827 [
1828         with_libesmtp="yes"
1829 ])
1830 if test "x$with_libesmtp" = "xyes"
1831 then
1832         AC_CHECK_LIB(esmtp, smtp_create_session,
1833         [
1834                 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
1835         ], [with_libesmtp="no (libesmtp not found)"])
1836 fi
1837 if test "x$with_libesmtp" = "xyes"
1838 then
1839         AC_CHECK_HEADERS(libesmtp.h,
1840         [
1841                 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
1842         ], [with_libesmtp="no (libesmtp.h not found)"])
1843 fi
1844 if test "x$with_libesmtp" = "xyes"
1845 then
1846         collect_libesmtp=1
1847 else
1848         collect_libesmtp=0
1849 fi
1850 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
1851         [Wether or not to use the esmtp library])
1852 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
1853 # }}}
1854
1855 # --with-libganglia {{{
1856 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
1857 [
1858  if test -f "$withval" && test -x "$withval"
1859  then
1860          with_libganglia_config="$withval"
1861          with_libganglia="yes"
1862  else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
1863  then
1864          with_libganglia_config="$withval/bin/ganglia-config"
1865          with_libganglia="yes"
1866  else if test -d "$withval"
1867  then
1868          GANGLIA_CPPFLAGS="-I$withval/include"
1869          GANGLIA_LDFLAGS="-L$withval/lib"
1870          with_libganglia="yes"
1871  else
1872          with_libganglia="$withval"
1873  fi; fi; fi
1874 ],
1875 [
1876  with_libganglia="yes"
1877 ])
1878
1879 if test "x$with_libganglia" = "xyes"
1880 then
1881         if test "x$with_libganglia_config" != "x"
1882         then
1883                 if test "x$GANGLIA_CPPFLAGS" = "x"
1884                 then
1885                         GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
1886                 fi
1887
1888                 if test "x$GANGLIA_LDFLAGS" = "x"
1889                 then
1890                         GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
1891                 fi
1892
1893                 if test "x$GANGLIA_LIBS" = "x"
1894                 then
1895                         GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
1896                 fi
1897         else
1898                 GANGLIA_LIBS="-lganglia"
1899         fi
1900 fi
1901
1902 SAVE_CPPFLAGS="$CPPFLAGS"
1903 SAVE_LDFLAGS="$LDFLAGS"
1904 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
1905 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
1906
1907 if test "x$with_libganglia" = "xyes"
1908 then
1909         AC_CHECK_HEADERS(gm_protocol.h,
1910         [
1911                 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
1912                           [Define to 1 if you have the <gm_protocol.h> header file.])
1913         ], [with_libganglia="no (gm_protocol.h not found)"])
1914 fi
1915
1916 if test "x$with_libganglia" = "xyes"
1917 then
1918         AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
1919         [
1920                 AC_DEFINE(HAVE_LIBGANGLIA, 1,
1921                           [Define to 1 if you have the ganglia library (-lganglia).])
1922         ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
1923 fi
1924
1925 CPPFLAGS="$SAVE_CPPFLAGS"
1926 LDFLAGS="$SAVE_LDFLAGS"
1927
1928 AC_SUBST(GANGLIA_CPPFLAGS)
1929 AC_SUBST(GANGLIA_LDFLAGS)
1930 AC_SUBST(GANGLIA_LIBS)
1931 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
1932 # }}}
1933
1934 # --with-libgcrypt {{{
1935 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
1936 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
1937 GCRYPT_LIBS="$GCRYPT_LIBS"
1938 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
1939 [
1940  if test -f "$withval" && test -x "$withval"
1941  then
1942          with_libgcrypt_config="$withval"
1943          with_libgcrypt="yes"
1944  else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
1945  then
1946          with_libgcrypt_config="$withval/bin/gcrypt-config"
1947          with_libgcrypt="yes"
1948  else if test -d "$withval"
1949  then
1950          GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
1951          GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
1952          with_libgcrypt="yes"
1953  else
1954          with_libgcrypt_config="gcrypt-config"
1955          with_libgcrypt="$withval"
1956  fi; fi; fi
1957 ],
1958 [
1959  with_libgcrypt_config="libgcrypt-config"
1960  with_libgcrypt="yes"
1961 ])
1962
1963 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
1964 then
1965         if test "x$GCRYPT_CPPFLAGS" = "x"
1966         then
1967                 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
1968         fi
1969
1970         if test "x$GCRYPT_LIBS" = "x"
1971         then
1972                 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
1973         fi
1974 fi
1975
1976 SAVE_CPPFLAGS="$CPPFLAGS"
1977 SAVE_LDFLAGS="$LDFLAGS"
1978 SAVE_LIBS="$LIBS"
1979 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
1980 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
1981 LIBS="$LIBS $GCRYPT_LIBS"
1982
1983 if test "x$with_libgcrypt" = "xyes"
1984 then
1985         if test "x$GCRYPT_CPPFLAGS" != "x"
1986         then
1987                 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
1988         fi
1989         AC_CHECK_HEADERS(gcrypt.h,
1990                 [with_libgcrypt="yes"],
1991                 [with_libgcrypt="no (gcrypt.h not found)"])
1992 fi
1993
1994 if test "x$with_libgcrypt" = "xyes"
1995 then
1996         AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
1997                 [with_libgcrypt="yes"],
1998                 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
1999
2000         if test "$with_libgcrypt" != "no"; then
2001                 m4_ifdef([AM_PATH_LIBGCRYPT],[AM_PATH_LIBGCRYPT(1:1.2.0,,with_libgcrypt="no (version 1.2.0+ required)")])
2002                 GCRYPT_CPPFLAGS="$LIBGCRYPT_CPPFLAGS $LIBGCRYPT_CFLAGS"
2003                 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
2004         fi
2005 fi
2006
2007 CPPFLAGS="$SAVE_CPPFLAGS"
2008 LDFLAGS="$SAVE_LDFLAGS"
2009 LIBS="$SAVE_LIBS"
2010
2011 if test "x$with_libgcrypt" = "xyes"
2012 then
2013         AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
2014 fi
2015
2016 AC_SUBST(GCRYPT_CPPFLAGS)
2017 AC_SUBST(GCRYPT_LDFLAGS)
2018 AC_SUBST(GCRYPT_LIBS)
2019 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
2020 # }}}
2021
2022 # --with-libiptc {{{
2023 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
2024 [
2025         if test "x$withval" = "xshipped"
2026         then
2027                 with_libiptc="own"
2028         else if test "x$withval" = "xyes"
2029         then
2030                 with_libiptc="pkgconfig"
2031         else if test "x$withval" = "xno"
2032         then
2033                 with_libiptc="no"
2034         else
2035                 with_libiptc="yes"
2036                 with_libiptc_cflags="-I$withval/include"
2037                 with_libiptc_libs="-L$withval/lib"
2038         fi; fi; fi
2039 ],
2040 [
2041         if test "x$ac_system" = "xLinux"
2042         then
2043                 with_libiptc="pkgconfig"
2044         else
2045                 with_libiptc="no (Linux only)"
2046         fi
2047 ])
2048
2049 if test "x$with_libiptc" = "xpkgconfig" && test "x$PKG_CONFIG" = "x"
2050 then
2051         with_libiptc="no (Don't have pkg-config)"
2052 fi
2053
2054 if test "x$with_libiptc" = "xpkgconfig"
2055 then
2056         $PKG_CONFIG --exists 'libiptc' 2>/dev/null
2057         if test $? -ne 0
2058         then
2059                 with_libiptc="no (pkg-config doesn't know libiptc)"
2060         fi
2061 fi
2062 if test "x$with_libiptc" = "xpkgconfig"
2063 then
2064         with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
2065         if test $? -ne 0
2066         then
2067                 with_libiptc="no ($PKG_CONFIG failed)"
2068         fi
2069         with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
2070         if test $? -ne 0
2071         then
2072                 with_libiptc="no ($PKG_CONFIG failed)"
2073         fi
2074 fi
2075
2076 SAVE_CPPFLAGS="$CPPFLAGS"
2077 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
2078
2079 # check whether the header file for libiptc is available.
2080 if test "x$with_libiptc" = "xpkgconfig"
2081 then
2082         AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
2083                         [with_libiptc="no (header file missing)"])
2084 fi
2085 # If the header file is available, check for the required type declaractions.
2086 # They may be missing in old versions of libiptc. In that case, they will be
2087 # declared in the iptables plugin.
2088 if test "x$with_libiptc" = "xpkgconfig"
2089 then
2090         AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
2091 fi
2092 # Check for the iptc_init symbol in the library.
2093 # This could be in iptc or ip4tc
2094 if test "x$with_libiptc" = "xpkgconfig"
2095 then
2096         SAVE_LIBS="$LIBS"
2097         AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
2098                         [with_libiptc="pkgconfig"],
2099                         [with_libiptc="no"],
2100                         [$with_libiptc_libs])
2101         LIBS="$SAVE_LIBS"
2102 fi
2103 if test "x$with_libiptc" = "xpkgconfig"
2104 then
2105         with_libiptc="yes"
2106 fi
2107
2108 CPPFLAGS="$SAVE_CPPFLAGS"
2109
2110 if test "x$with_libiptc" = "xown"
2111 then
2112         with_libiptc_cflags=""
2113         with_libiptc_libs=""
2114 fi
2115 if test "x$with_libiptc" = "xown"
2116 then
2117         AC_CHECK_HEADERS(linux/netfilter_ipv4/ip_tables.h linux/netfilter_ipv6/ip6_tables.h linux/netfilter/x_tables.h, [],
2118         [
2119                 with_libiptc="no (Linux iptables headers not found)"
2120         ],
2121         [
2122 #include "$srcdir/src/owniptc/ipt_kernel_headers.h"
2123         ])
2124 fi
2125 AM_CONDITIONAL(BUILD_WITH_OWN_LIBIPTC, test "x$with_libiptc" = "xown")
2126 if test "x$with_libiptc" = "xown"
2127 then
2128         AC_DEFINE(OWN_LIBIPTC, 1, [Define to 1 if we use the shipped iptc library.])
2129         with_libiptc="yes"
2130 fi
2131
2132 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
2133 if test "x$with_libiptc" = "xyes"
2134 then
2135         BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
2136         BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
2137         AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
2138         AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
2139 fi
2140 # }}}
2141
2142 # --with-java {{{
2143 with_java_home="$JAVA_HOME"
2144 if test "x$with_java_home" = "x"
2145 then
2146         with_java_home="/usr/lib/jvm"
2147 fi
2148 with_java_vmtype="client"
2149 with_java_cflags=""
2150 with_java_libs=""
2151 JAVAC="$JAVAC"
2152 JAR="$JAR"
2153 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
2154 [
2155         if test "x$withval" = "xno"
2156         then
2157                 with_java="no"
2158         else if test "x$withval" = "xyes"
2159         then
2160                 with_java="yes"
2161         else
2162                 with_java_home="$withval"
2163                 with_java="yes"
2164         fi; fi
2165 ],
2166 [with_java="yes"])
2167 if test "x$with_java" = "xyes"
2168 then
2169         if test -d "$with_java_home"
2170         then
2171                 AC_MSG_CHECKING([for jni.h])
2172                 TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2173                 if test "x$TMPVAR" != "x"
2174                 then
2175                         AC_MSG_RESULT([found in $TMPVAR])
2176                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2177                 else
2178                         AC_MSG_RESULT([not found])
2179                 fi
2180
2181                 AC_MSG_CHECKING([for jni_md.h])
2182                 TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2183                 if test "x$TMPVAR" != "x"
2184                 then
2185                         AC_MSG_RESULT([found in $TMPVAR])
2186                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2187                 else
2188                         AC_MSG_RESULT([not found])
2189                 fi
2190
2191                 AC_MSG_CHECKING([for libjvm.so])
2192                 TMPVAR=`find -L "$with_java_home" -type f \( -name libjvm.so -o -name libjvm.dylib \) -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1`
2193                 if test "x$TMPVAR" != "x"
2194                 then
2195                         AC_MSG_RESULT([found in $TMPVAR])
2196                         JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
2197                 else
2198                         AC_MSG_RESULT([not found])
2199                 fi
2200
2201                 if test "x$JAVAC" = "x"
2202                 then
2203                         AC_MSG_CHECKING([for javac])
2204                         TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | head -n 1`
2205                         if test "x$TMPVAR" != "x"
2206                         then
2207                                 JAVAC="$TMPVAR"
2208                                 AC_MSG_RESULT([$JAVAC])
2209                         else
2210                                 AC_MSG_RESULT([not found])
2211                         fi
2212                 fi
2213                 if test "x$JAR" = "x"
2214                 then
2215                         AC_MSG_CHECKING([for jar])
2216                         TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | head -n 1`
2217                         if test "x$TMPVAR" != "x"
2218                         then
2219                                 JAR="$TMPVAR"
2220                                 AC_MSG_RESULT([$JAR])
2221                         else
2222                                 AC_MSG_RESULT([not found])
2223                         fi
2224                 fi
2225         else if test "x$with_java_home" != "x"
2226         then
2227                 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2228         fi; fi
2229 fi
2230
2231 if test "x$JAVA_CPPFLAGS" != "x"
2232 then
2233         AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2234 fi
2235 if test "x$JAVA_CFLAGS" != "x"
2236 then
2237         AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2238 fi
2239 if test "x$JAVA_LDFLAGS" != "x"
2240 then
2241         AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2242 fi
2243 if test "x$JAVAC" = "x"
2244 then
2245         with_javac_path="$PATH"
2246         if test "x$with_java_home" != "x"
2247         then
2248                 with_javac_path="$with_java_home:with_javac_path"
2249                 if test -d "$with_java_home/bin"
2250                 then
2251                         with_javac_path="$with_java_home/bin:with_javac_path"
2252                 fi
2253         fi
2254
2255         AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2256 fi
2257 if test "x$JAVAC" = "x"
2258 then
2259         with_java="no (javac not found)"
2260 fi
2261 if test "x$JAR" = "x"
2262 then
2263         with_jar_path="$PATH"
2264         if test "x$with_java_home" != "x"
2265         then
2266                 with_jar_path="$with_java_home:$with_jar_path"
2267                 if test -d "$with_java_home/bin"
2268                 then
2269                         with_jar_path="$with_java_home/bin:$with_jar_path"
2270                 fi
2271         fi
2272
2273         AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2274 fi
2275 if test "x$JAR" = "x"
2276 then
2277         with_java="no (jar not found)"
2278 fi
2279
2280 SAVE_CPPFLAGS="$CPPFLAGS"
2281 SAVE_CFLAGS="$CFLAGS"
2282 SAVE_LDFLAGS="$LDFLAGS"
2283 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2284 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2285 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2286
2287 if test "x$with_java" = "xyes"
2288 then
2289         AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2290 fi
2291 if test "x$with_java" = "xyes"
2292 then
2293         AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2294         [with_java="yes"],
2295         [with_java="no (libjvm not found)"],
2296         [$JAVA_LIBS])
2297 fi
2298 if test "x$with_java" = "xyes"
2299 then
2300         JAVA_LIBS="$JAVA_LIBS -ljvm"
2301         AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2302 fi
2303
2304 CPPFLAGS="$SAVE_CPPFLAGS"
2305 CFLAGS="$SAVE_CFLAGS"
2306 LDFLAGS="$SAVE_LDFLAGS"
2307
2308 AC_SUBST(JAVA_CPPFLAGS)
2309 AC_SUBST(JAVA_CFLAGS)
2310 AC_SUBST(JAVA_LDFLAGS)
2311 AC_SUBST(JAVA_LIBS)
2312 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2313 # }}}
2314
2315 # --with-liblvm2app {{{
2316 with_liblvm2app_cppflags=""
2317 with_liblvm2app_ldflags=""
2318 AC_ARG_WITH(liblvm2app, [AS_HELP_STRING([--with-liblvm2app@<:@=PREFIX@:>@], [Path to liblvm2app.])],
2319 [
2320         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2321         then
2322                 with_liblvm2app_cppflags="-I$withval/include"
2323                 with_liblvm2app_ldflags="-L$withval/lib"
2324                 with_liblvm2app="yes"
2325         else
2326                 with_liblvm2app="$withval"
2327         fi
2328 ],
2329 [
2330         with_liblvm2app="yes"
2331 ])
2332 if test "x$with_liblvm2app" = "xyes"
2333 then
2334         SAVE_CPPFLAGS="$CPPFLAGS"
2335         CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags"
2336
2337         AC_CHECK_HEADERS(lvm2app.h, [with_liblvm2app="yes"], [with_liblvm2app="no (lvm2app.h not found)"])
2338
2339         CPPFLAGS="$SAVE_CPPFLAGS"
2340 fi
2341
2342 if test "x$with_liblvm2app" = "xyes"
2343 then
2344         SAVE_CPPFLAGS="$CPPFLAGS"
2345         SAVE_LDFLAGS="$LDFLAGS"
2346         CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags"
2347         LDFLAGS="$LDFLAGS $with_liblvm2app_ldflags"
2348
2349         AC_CHECK_LIB(lvm2app, lvm_init, [with_liblvm2app="yes"], [with_liblvm2app="no (Symbol 'lvm_init' not found)"])
2350
2351         CPPFLAGS="$SAVE_CPPFLAGS"
2352         LDFLAGS="$SAVE_LDFLAGS"
2353 fi
2354 if test "x$with_liblvm2app" = "xyes"
2355 then
2356         BUILD_WITH_LIBLVM2APP_CPPFLAGS="$with_liblvm2app_cppflags"
2357         BUILD_WITH_LIBLVM2APP_LDFLAGS="$with_liblvm2app_ldflags"
2358         BUILD_WITH_LIBLVM2APP_LIBS="-llvm2app"
2359         AC_SUBST(BUILD_WITH_LIBLVM2APP_CPPFLAGS)
2360         AC_SUBST(BUILD_WITH_LIBLVM2APP_LDFLAGS)
2361         AC_SUBST(BUILD_WITH_LIBLVM2APP_LIBS)
2362         AC_DEFINE(HAVE_LIBLVM2APP, 1, [Define if liblvm2app is present and usable.])
2363 fi
2364 AM_CONDITIONAL(BUILD_WITH_LIBLVM2APP, test "x$with_liblvm2app" = "xyes")
2365 # }}}
2366
2367 # --with-libmemcached {{{
2368 with_libmemcached_cppflags=""
2369 with_libmemcached_ldflags=""
2370 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
2371 [
2372         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2373         then
2374                 with_libmemcached_cppflags="-I$withval/include"
2375                 with_libmemcached_ldflags="-L$withval/lib"
2376                 with_libmemcached="yes"
2377         else
2378                 with_libmemcached="$withval"
2379         fi
2380 ],
2381 [
2382         with_libmemcached="yes"
2383 ])
2384 if test "x$with_libmemcached" = "xyes"
2385 then
2386         SAVE_CPPFLAGS="$CPPFLAGS"
2387         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2388
2389         AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
2390
2391         CPPFLAGS="$SAVE_CPPFLAGS"
2392 fi
2393 if test "x$with_libmemcached" = "xyes"
2394 then
2395         SAVE_CPPFLAGS="$CPPFLAGS"
2396         SAVE_LDFLAGS="$LDFLAGS"
2397         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
2398         LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
2399
2400         AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
2401
2402         CPPFLAGS="$SAVE_CPPFLAGS"
2403         LDFLAGS="$SAVE_LDFLAGS"
2404 fi
2405 if test "x$with_libmemcached" = "xyes"
2406 then
2407         BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
2408         BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
2409         BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
2410         AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
2411         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
2412         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
2413         AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
2414 fi
2415 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
2416 # }}}
2417
2418 # --with-libmodbus {{{
2419 with_libmodbus_config=""
2420 with_libmodbus_cflags=""
2421 with_libmodbus_libs=""
2422 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
2423 [
2424         if test "x$withval" = "xno"
2425         then
2426                 with_libmodbus="no"
2427         else if test "x$withval" = "xyes"
2428         then
2429                 with_libmodbus="use_pkgconfig"
2430         else if test -d "$with_libmodbus/lib"
2431         then
2432                 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
2433                 with_libmodbus_cflags="-I$withval/include"
2434                 with_libmodbus_libs="-L$withval/lib -lmodbus"
2435                 with_libmodbus="yes"
2436         fi; fi; fi
2437 ],
2438 [with_libmodbus="use_pkgconfig"])
2439
2440 # configure using pkg-config
2441 if test "x$with_libmodbus" = "xuse_pkgconfig"
2442 then
2443         if test "x$PKG_CONFIG" = "x"
2444         then
2445                 with_libmodbus="no (Don't have pkg-config)"
2446         fi
2447 fi
2448 if test "x$with_libmodbus" = "xuse_pkgconfig"
2449 then
2450         AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
2451         $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
2452         if test $? -ne 0
2453         then
2454                 with_libmodbus="no (pkg-config doesn't know libmodbus)"
2455         fi
2456 fi
2457 if test "x$with_libmodbus" = "xuse_pkgconfig"
2458 then
2459         with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
2460         if test $? -ne 0
2461         then
2462                 with_libmodbus="no ($PKG_CONFIG failed)"
2463         fi
2464         with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
2465         if test $? -ne 0
2466         then
2467                 with_libmodbus="no ($PKG_CONFIG failed)"
2468         fi
2469 fi
2470 if test "x$with_libmodbus" = "xuse_pkgconfig"
2471 then
2472         with_libmodbus="yes"
2473 fi
2474
2475 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
2476 # the actual checks.
2477 if test "x$with_libmodbus" = "xyes"
2478 then
2479         SAVE_CPPFLAGS="$CPPFLAGS"
2480         CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2481
2482         AC_CHECK_HEADERS(modbus.h, [], [with_libmodbus="no (modbus.h not found)"])
2483
2484         CPPFLAGS="$SAVE_CPPFLAGS"
2485 fi
2486 if test "x$with_libmodbus" = "xyes"
2487 then
2488         SAVE_CPPFLAGS="$CPPFLAGS"
2489         SAVE_LDFLAGS="$LDFLAGS"
2490
2491         CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
2492         LDFLAGS="$LDFLAGS $with_libmodbus_libs"
2493
2494         AC_CHECK_LIB(modbus, modbus_connect,
2495                      [with_libmodbus="yes"],
2496                      [with_libmodbus="no (symbol modbus_connect not found)"])
2497
2498         CPPFLAGS="$SAVE_CPPFLAGS"
2499         LDFLAGS="$SAVE_LDFLAGS"
2500 fi
2501 if test "x$with_libmodbus" = "xyes"
2502 then
2503         BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
2504         BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
2505         AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
2506         AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
2507 fi
2508 # }}}
2509
2510 # --with-libmongoc {{{
2511 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
2512 [
2513  if test "x$withval" = "xyes"
2514  then
2515          with_libmongoc="yes"
2516  else if test "x$withval" = "xno"
2517  then
2518          with_libmongoc="no"
2519  else
2520          with_libmongoc="yes"
2521          LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
2522          LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
2523  fi; fi
2524 ],
2525 [with_libmongoc="yes"])
2526
2527 SAVE_CPPFLAGS="$CPPFLAGS"
2528 SAVE_LDFLAGS="$LDFLAGS"
2529
2530 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
2531 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
2532
2533 if test "x$with_libmongoc" = "xyes"
2534 then
2535         if test "x$LIBMONGOC_CPPFLAGS" != "x"
2536         then
2537                 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
2538         fi
2539         AC_CHECK_HEADERS(mongo.h,
2540         [with_libmongoc="yes"],
2541         [with_libmongoc="no ('mongo.h' not found)"],
2542 [#if HAVE_STDINT_H
2543 # define MONGO_HAVE_STDINT 1
2544 #else
2545 # define MONGO_USE_LONG_LONG_INT 1
2546 #endif
2547 ])
2548 fi
2549 if test "x$with_libmongoc" = "xyes"
2550 then
2551         if test "x$LIBMONGOC_LDFLAGS" != "x"
2552         then
2553                 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
2554         fi
2555         AC_CHECK_LIB(mongoc, mongo_run_command,
2556         [with_libmongoc="yes"],
2557         [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
2558 fi
2559
2560 CPPFLAGS="$SAVE_CPPFLAGS"
2561 LDFLAGS="$SAVE_LDFLAGS"
2562
2563 if test "x$with_libmongoc" = "xyes"
2564 then
2565         BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
2566         BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
2567         AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
2568         AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
2569 fi
2570 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
2571 # }}}
2572
2573 # --with-libmysql {{{
2574 with_mysql_config="mysql_config"
2575 with_mysql_cflags=""
2576 with_mysql_libs=""
2577 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
2578 [
2579         if test "x$withval" = "xno"
2580         then
2581                 with_libmysql="no"
2582         else if test "x$withval" = "xyes"
2583         then
2584                 with_libmysql="yes"
2585         else
2586                 if test -f "$withval" && test -x "$withval";
2587                 then
2588                         with_mysql_config="$withval"
2589                 else if test -x "$withval/bin/mysql_config"
2590                 then
2591                         with_mysql_config="$withval/bin/mysql_config"
2592                 fi; fi
2593                 with_libmysql="yes"
2594         fi; fi
2595 ],
2596 [
2597         with_libmysql="yes"
2598 ])
2599 if test "x$with_libmysql" = "xyes"
2600 then
2601         with_mysql_cflags=`$with_mysql_config --include 2>/dev/null`
2602         mysql_config_status=$?
2603
2604         if test $mysql_config_status -ne 0
2605         then
2606                 with_libmysql="no ($with_mysql_config failed)"
2607         else
2608                 SAVE_CPPFLAGS="$CPPFLAGS"
2609                 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2610
2611                 have_mysql_h="no"
2612                 have_mysql_mysql_h="no"
2613                 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
2614
2615                 if test "x$have_mysql_h" = "xno"
2616                 then
2617                         AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
2618                 fi
2619
2620                 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
2621                 then
2622                         with_libmysql="no (mysql.h not found)"
2623                 fi
2624
2625                 CPPFLAGS="$SAVE_CPPFLAGS"
2626         fi
2627 fi
2628 if test "x$with_libmysql" = "xyes"
2629 then
2630         with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
2631         mysql_config_status=$?
2632
2633         if test $mysql_config_status -ne 0
2634         then
2635                 with_libmysql="no ($with_mysql_config failed)"
2636         else
2637                 SAVE_CPPFLAGS="$CPPFLAGS"
2638                 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
2639                 SAVE_LIBS="$LIBS"
2640                 LIBS="$with_mysql_libs"
2641                 AC_SEARCH_LIBS([mysql_get_server_version],
2642                  [],
2643                  [with_libmysql="yes"],
2644                  [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
2645                  [])
2646                 CPPFLAGS="$SAVE_CPPFLAGS"
2647                 LIBS="$SAVE_LIBS"
2648         fi
2649 fi
2650 if test "x$with_libmysql" = "xyes"
2651 then
2652         BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
2653         BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
2654         AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
2655         AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
2656 fi
2657 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
2658 # }}}
2659
2660 # --with-libmnl {{{
2661 with_libmnl_cflags=""
2662 with_libmnl_libs=""
2663 AC_ARG_WITH(libmnl, [AS_HELP_STRING([--with-libmnl@<:@=PREFIX@:>@], [Path to libmnl.])],
2664 [
2665  echo "libmnl: withval = $withval"
2666  if test "x$withval" = "xyes"
2667  then
2668          with_libmnl="yes"
2669  else if test "x$withval" = "xno"
2670  then
2671          with_libmnl="no"
2672  else
2673          if test -d "$withval/include"
2674          then
2675                  with_libmnl_cflags="-I$withval/include"
2676                  with_libmnl_libs="-L$withval/lib -lmnl"
2677                  with_libmnl="yes"
2678          else
2679                  AC_MSG_ERROR("no such directory: $withval/include")
2680          fi
2681  fi; fi
2682 ],
2683 [
2684  if test "x$ac_system" = "xLinux"
2685  then
2686          with_libmnl="yes"
2687  else
2688          with_libmnl="no (Linux only library)"
2689  fi
2690 ])
2691 if test "x$PKG_CONFIG" = "x"
2692 then
2693         with_libmnl="no (Don't have pkg-config)"
2694 fi
2695 if test "x$with_libmnl" = "xyes"
2696 then
2697         if $PKG_CONFIG --exists libmnl 2>/dev/null; then
2698           with_libmnl_cflags="$with_libmnl_ldflags `$PKG_CONFIG --cflags libmnl`"
2699           with_libmnl_libs="$with_libmnl_libs `$PKG_CONFIG --libs libmnl`"
2700         fi
2701
2702         AC_CHECK_HEADERS(libmnl.h libmnl/libmnl.h,
2703         [
2704          with_libmnl="yes"
2705          break
2706         ], [],
2707 [#include <stdio.h>
2708 #include <sys/types.h>
2709 #include <asm/types.h>
2710 #include <sys/socket.h>
2711 #include <linux/netlink.h>
2712 #include <linux/rtnetlink.h>])
2713         AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
2714 [#include <stdio.h>
2715 #include <sys/types.h>
2716 #include <asm/types.h>
2717 #include <sys/socket.h>])
2718
2719         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2720 [[
2721 #include <stdio.h>
2722 #include <sys/types.h>
2723 #include <asm/types.h>
2724 #include <sys/socket.h>
2725 #include <linux/netlink.h>
2726 #include <linux/rtnetlink.h>
2727 ]],
2728 [[
2729 int retval = TCA_STATS2;
2730 return (retval);
2731 ]]
2732         )],
2733         [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
2734
2735         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2736 [[
2737 #include <stdio.h>
2738 #include <sys/types.h>
2739 #include <asm/types.h>
2740 #include <sys/socket.h>
2741 #include <linux/netlink.h>
2742 #include <linux/rtnetlink.h>
2743 ]],
2744 [[
2745 int retval = TCA_STATS;
2746 return (retval);
2747 ]]
2748         )],
2749         [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
2750 fi
2751 if test "x$with_libmnl" = "xyes"
2752 then
2753         AC_CHECK_LIB(mnl, mnl_nlmsg_get_payload,
2754                      [with_libmnl="yes"],
2755                      [with_libmnl="no (symbol 'mnl_nlmsg_get_payload' not found)"],
2756                      [$with_libmnl_libs])
2757 fi
2758 if test "x$with_libmnl" = "xyes"
2759 then
2760         AC_DEFINE(HAVE_LIBMNL, 1, [Define if libmnl is present and usable.])
2761         BUILD_WITH_LIBMNL_CFLAGS="$with_libmnl_cflags"
2762         BUILD_WITH_LIBMNL_LIBS="$with_libmnl_libs"
2763         AC_SUBST(BUILD_WITH_LIBMNL_CFLAGS)
2764         AC_SUBST(BUILD_WITH_LIBMNL_LIBS)
2765 fi
2766 AM_CONDITIONAL(BUILD_WITH_LIBMNL, test "x$with_libmnl" = "xyes")
2767 # }}}
2768
2769 # --with-libnetapp {{{
2770 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
2771 AC_ARG_VAR([LIBNETAPP_LDFLAGS],  [Linker flags required to build with libnetapp])
2772 AC_ARG_VAR([LIBNETAPP_LIBS],     [Other libraries required to link against libnetapp])
2773 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
2774 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
2775 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
2776 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
2777 [
2778  if test -d "$withval"
2779  then
2780          LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
2781          LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
2782          with_libnetapp="yes"
2783  else
2784          with_libnetapp="$withval"
2785  fi
2786 ],
2787 [
2788  with_libnetapp="yes"
2789 ])
2790
2791 SAVE_CPPFLAGS="$CPPFLAGS"
2792 SAVE_LDFLAGS="$LDFLAGS"
2793 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
2794 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
2795
2796 if test "x$with_libnetapp" = "xyes"
2797 then
2798         if test "x$LIBNETAPP_CPPFLAGS" != "x"
2799         then
2800                 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
2801         fi
2802         AC_CHECK_HEADERS(netapp_api.h,
2803                 [with_libnetapp="yes"],
2804                 [with_libnetapp="no (netapp_api.h not found)"])
2805 fi
2806
2807 if test "x$with_libnetapp" = "xyes"
2808 then
2809         if test "x$LIBNETAPP_LDFLAGS" != "x"
2810         then
2811                 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
2812         fi
2813
2814         if test "x$LIBNETAPP_LIBS" = "x"
2815         then
2816                 LIBNETAPP_LIBS="-lpthread -lxml -ladt -lssl -lm -lcrypto -lz"
2817         fi
2818         AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
2819
2820         AC_CHECK_LIB(netapp, na_server_invoke_elem,
2821                 [with_libnetapp="yes"],
2822                 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
2823                 [$LIBNETAPP_LIBS])
2824         LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
2825 fi
2826
2827 CPPFLAGS="$SAVE_CPPFLAGS"
2828 LDFLAGS="$SAVE_LDFLAGS"
2829
2830 if test "x$with_libnetapp" = "xyes"
2831 then
2832         AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
2833 fi
2834
2835 AC_SUBST(LIBNETAPP_CPPFLAGS)
2836 AC_SUBST(LIBNETAPP_LDFLAGS)
2837 AC_SUBST(LIBNETAPP_LIBS)
2838 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
2839 # }}}
2840
2841 # --with-libnetsnmp {{{
2842 with_snmp_config="net-snmp-config"
2843 with_snmp_cflags=""
2844 with_snmp_libs=""
2845 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
2846 [
2847         if test "x$withval" = "xno"
2848         then
2849                 with_libnetsnmp="no"
2850         else if test "x$withval" = "xyes"
2851         then
2852                 with_libnetsnmp="yes"
2853         else
2854                 if test -x "$withval"
2855                 then
2856                         with_snmp_config="$withval"
2857                         with_libnetsnmp="yes"
2858                 else
2859                         with_snmp_config="$withval/bin/net-snmp-config"
2860                         with_libnetsnmp="yes"
2861                 fi
2862         fi; fi
2863 ],
2864 [with_libnetsnmp="yes"])
2865 if test "x$with_libnetsnmp" = "xyes"
2866 then
2867         with_snmp_cflags=`$with_snmp_config --cflags 2>/dev/null`
2868         snmp_config_status=$?
2869
2870         if test $snmp_config_status -ne 0
2871         then
2872                 with_libnetsnmp="no ($with_snmp_config failed)"
2873         else
2874                 SAVE_CPPFLAGS="$CPPFLAGS"
2875                 CPPFLAGS="$CPPFLAGS $with_snmp_cflags"
2876                 
2877                 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
2878
2879                 CPPFLAGS="$SAVE_CPPFLAGS"
2880         fi
2881 fi
2882 if test "x$with_libnetsnmp" = "xyes"
2883 then
2884         with_snmp_libs=`$with_snmp_config --libs 2>/dev/null`
2885         snmp_config_status=$?
2886
2887         if test $snmp_config_status -ne 0
2888         then
2889                 with_libnetsnmp="no ($with_snmp_config failed)"
2890         else
2891                 AC_CHECK_LIB(netsnmp, init_snmp,
2892                 [with_libnetsnmp="yes"],
2893                 [with_libnetsnmp="no (libnetsnmp not found)"],
2894                 [$with_snmp_libs])
2895         fi
2896 fi
2897 if test "x$with_libnetsnmp" = "xyes"
2898 then
2899         BUILD_WITH_LIBSNMP_CFLAGS="$with_snmp_cflags"
2900         BUILD_WITH_LIBSNMP_LIBS="$with_snmp_libs"
2901         AC_SUBST(BUILD_WITH_LIBSNMP_CFLAGS)
2902         AC_SUBST(BUILD_WITH_LIBSNMP_LIBS)
2903 fi
2904 AM_CONDITIONAL(BUILD_WITH_LIBNETSNMP, test "x$with_libnetsnmp" = "xyes")
2905 # }}}
2906
2907 # --with-liboconfig {{{
2908 with_own_liboconfig="no"
2909 liboconfig_LDFLAGS="$LDFLAGS"
2910 liboconfig_CPPFLAGS="$CPPFLAGS"
2911 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
2912 [
2913         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2914         then
2915                 if test -d "$withval/lib"
2916                 then
2917                         liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
2918                 fi
2919                 if test -d "$withval/include"
2920                 then
2921                         liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
2922                 fi
2923         fi
2924         if test "x$withval" = "xno"
2925         then
2926                 AC_MSG_ERROR("liboconfig is required")
2927         fi
2928 ],
2929 [
2930         with_liboconfig="yes"
2931 ])
2932
2933 save_LDFLAGS="$LDFLAGS"
2934 save_CPPFLAGS="$CPPFLAGS"
2935 LDFLAGS="$liboconfig_LDFLAGS"
2936 CPPFLAGS="$liboconfig_CPPFLAGS"
2937 AC_CHECK_LIB(oconfig, oconfig_parse_fh,
2938 [
2939         with_liboconfig="yes"
2940         with_own_liboconfig="no"
2941 ],
2942 [
2943         with_liboconfig="yes"
2944         with_own_liboconfig="yes"
2945         LDFLAGS="$save_LDFLAGS"
2946         CPPFLAGS="$save_CPPFLAGS"
2947 ])
2948
2949 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
2950 if test "x$with_own_liboconfig" = "xyes"
2951 then
2952         with_liboconfig="yes (shipped version)"
2953 fi
2954 # }}}
2955
2956 # --with-liboping {{{
2957 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
2958 [
2959  if test "x$withval" = "xyes"
2960  then
2961          with_liboping="yes"
2962  else if test "x$withval" = "xno"
2963  then
2964          with_liboping="no"
2965  else
2966          with_liboping="yes"
2967          LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
2968          LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
2969  fi; fi
2970 ],
2971 [with_liboping="yes"])
2972
2973 SAVE_CPPFLAGS="$CPPFLAGS"
2974 SAVE_LDFLAGS="$LDFLAGS"
2975
2976 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
2977 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
2978
2979 if test "x$with_liboping" = "xyes"
2980 then
2981         if test "x$LIBOPING_CPPFLAGS" != "x"
2982         then
2983                 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
2984         fi
2985         AC_CHECK_HEADERS(oping.h,
2986         [with_liboping="yes"],
2987         [with_liboping="no (oping.h not found)"])
2988 fi
2989 if test "x$with_liboping" = "xyes"
2990 then
2991         if test "x$LIBOPING_LDFLAGS" != "x"
2992         then
2993                 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
2994         fi
2995         AC_CHECK_LIB(oping, ping_construct,
2996         [with_liboping="yes"],
2997         [with_liboping="no (symbol 'ping_construct' not found)"])
2998 fi
2999
3000 CPPFLAGS="$SAVE_CPPFLAGS"
3001 LDFLAGS="$SAVE_LDFLAGS"
3002
3003 if test "x$with_liboping" = "xyes"
3004 then
3005         BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
3006         BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
3007         AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
3008         AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
3009 fi
3010 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
3011 # }}}
3012
3013 # --with-oracle {{{
3014 with_oracle_cppflags=""
3015 with_oracle_libs=""
3016 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
3017 [
3018         if test "x$withval" = "xyes"
3019         then
3020                 if test "x$ORACLE_HOME" = "x"
3021                 then
3022                         AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
3023                 fi
3024                 with_oracle="yes"
3025         else if test "x$withval" = "xno"
3026         then
3027                 with_oracle="no"
3028         else
3029                 with_oracle="yes"
3030                 ORACLE_HOME="$withval"
3031         fi; fi
3032 ],
3033 [
3034         if test "x$ORACLE_HOME" = "x"
3035         then
3036                 with_oracle="no (ORACLE_HOME is not set)"
3037         else
3038                 with_oracle="yes"
3039         fi
3040 ])
3041 if test "x$ORACLE_HOME" != "x"
3042 then
3043         with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
3044
3045         if test -e "$ORACLE_HOME/lib/ldflags"
3046         then
3047                 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
3048         fi
3049         #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
3050         with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
3051 fi
3052 if test "x$with_oracle" = "xyes"
3053 then
3054         SAVE_CPPFLAGS="$CPPFLAGS"
3055         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
3056
3057         AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
3058
3059         CPPFLAGS="$SAVE_CPPFLAGS"
3060 fi
3061 if test "x$with_oracle" = "xyes"
3062 then
3063         SAVE_CPPFLAGS="$CPPFLAGS"
3064         SAVE_LIBS="$LIBS"
3065         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
3066         LIBS="$LIBS $with_oracle_libs"
3067
3068         AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
3069
3070         CPPFLAGS="$SAVE_CPPFLAGS"
3071         LIBS="$SAVE_LIBS"
3072 fi
3073 if test "x$with_oracle" = "xyes"
3074 then
3075         BUILD_WITH_ORACLE_CFLAGS="$with_oracle_cppflags"
3076         BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
3077         AC_SUBST(BUILD_WITH_ORACLE_CFLAGS)
3078         AC_SUBST(BUILD_WITH_ORACLE_LIBS)
3079 fi
3080 # }}}
3081
3082 # --with-libowcapi {{{
3083 with_libowcapi_cppflags=""
3084 with_libowcapi_libs="-lowcapi"
3085 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
3086 [
3087         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3088         then
3089                 with_libowcapi_cppflags="-I$withval/include"
3090                 with_libowcapi_libs="-L$withval/lib -lowcapi"
3091                 with_libowcapi="yes"
3092         else
3093                 with_libowcapi="$withval"
3094         fi
3095 ],
3096 [
3097         with_libowcapi="yes"
3098 ])
3099 if test "x$with_libowcapi" = "xyes"
3100 then
3101         SAVE_CPPFLAGS="$CPPFLAGS"
3102         CPPFLAGS="$with_libowcapi_cppflags"
3103         
3104         AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
3105
3106         CPPFLAGS="$SAVE_CPPFLAGS"
3107 fi
3108 if test "x$with_libowcapi" = "xyes"
3109 then
3110         SAVE_LDFLAGS="$LDFLAGS"
3111         SAVE_CPPFLAGS="$CPPFLAGS"
3112         LDFLAGS="$with_libowcapi_libs"
3113         CPPFLAGS="$with_libowcapi_cppflags"
3114         
3115         AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
3116
3117         LDFLAGS="$SAVE_LDFLAGS"
3118         CPPFLAGS="$SAVE_CPPFLAGS"
3119 fi
3120 if test "x$with_libowcapi" = "xyes"
3121 then
3122         BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
3123         BUILD_WITH_LIBOWCAPI_LIBS="$with_libowcapi_libs"
3124         AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
3125         AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
3126 fi
3127 # }}}
3128
3129 # --with-libpcap {{{
3130 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
3131 [
3132         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3133         then
3134                 LDFLAGS="$LDFLAGS -L$withval/lib"
3135                 CPPFLAGS="$CPPFLAGS -I$withval/include"
3136                 with_libpcap="yes"
3137         else
3138                 with_libpcap="$withval"
3139         fi
3140 ],
3141 [
3142         with_libpcap="yes"
3143 ])
3144 if test "x$with_libpcap" = "xyes"
3145 then
3146         AC_CHECK_LIB(pcap, pcap_open_live,
3147         [
3148                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
3149         ], [with_libpcap="no (libpcap not found)"])
3150 fi
3151 if test "x$with_libpcap" = "xyes"
3152 then
3153         AC_CHECK_HEADERS(pcap.h,,
3154                          [with_libpcap="no (pcap.h not found)"])
3155 fi
3156 if test "x$with_libpcap" = "xyes"
3157 then
3158         AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP],
3159                        [c_cv_libpcap_have_pcap_error_iface_not_up],
3160                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
3161 [[[
3162 #include <pcap.h>
3163 ]]],
3164 [[[
3165   int val = PCAP_ERROR_IFACE_NOT_UP;
3166   return(val);
3167 ]]]
3168                        )],
3169                        [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
3170                        [c_cv_libpcap_have_pcap_error_iface_not_up="no"]))
3171 fi
3172 if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes"
3173 then
3174                 with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)"
3175 fi
3176 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
3177 # }}}
3178
3179 # --with-libperl {{{
3180 perl_interpreter="perl"
3181 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
3182 [
3183         if test -f "$withval" && test -x "$withval"
3184         then
3185                 perl_interpreter="$withval"
3186                 with_libperl="yes"
3187         else if test "x$withval" != "xno" && test "x$withval" != "xyes"
3188         then
3189                 LDFLAGS="$LDFLAGS -L$withval/lib"
3190                 CPPFLAGS="$CPPFLAGS -I$withval/include"
3191                 perl_interpreter="$withval/bin/perl"
3192                 with_libperl="yes"
3193         else
3194                 with_libperl="$withval"
3195         fi; fi
3196 ],
3197 [
3198         with_libperl="yes"
3199 ])
3200
3201 AC_MSG_CHECKING([for perl])
3202 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
3203 if test -x "$perl_interpreter"
3204 then
3205         AC_MSG_RESULT([yes ($perl_interpreter)])
3206 else
3207         perl_interpreter=""
3208         AC_MSG_RESULT([no])
3209 fi
3210
3211 AC_SUBST(PERL, "$perl_interpreter")
3212
3213 if test "x$with_libperl" = "xyes" \
3214         && test -n "$perl_interpreter"
3215 then
3216   SAVE_CFLAGS="$CFLAGS"
3217   SAVE_LIBS="$LIBS"
3218 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
3219   PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ccopts`
3220   PERL_LIBS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
3221   CFLAGS="$CFLAGS $PERL_CFLAGS"
3222   LIBS="$LIBS $PERL_LIBS"
3223
3224   AC_CACHE_CHECK([for libperl],
3225     [c_cv_have_libperl],
3226     AC_LINK_IFELSE([AC_LANG_PROGRAM(
3227 [[[
3228 #define PERL_NO_GET_CONTEXT
3229 #include <EXTERN.h>
3230 #include <perl.h>
3231 #include <XSUB.h>
3232 ]]],
3233 [[[
3234        dTHX;
3235        load_module (PERL_LOADMOD_NOIMPORT,
3236                          newSVpv ("Collectd::Plugin::FooBar", 24),
3237                          Nullsv);
3238 ]]]
3239       )],
3240       [c_cv_have_libperl="yes"],
3241       [c_cv_have_libperl="no"]
3242     )
3243   )
3244
3245   if test "x$c_cv_have_libperl" = "xyes"
3246   then
3247           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
3248           AC_SUBST(PERL_CFLAGS)
3249           AC_SUBST(PERL_LIBS)
3250   else
3251           with_libperl="no"
3252   fi
3253
3254   CFLAGS="$SAVE_CFLAGS"
3255   LIBS="$SAVE_LIBS"
3256 else if test -z "$perl_interpreter"; then
3257   with_libperl="no (no perl interpreter found)"
3258   c_cv_have_libperl="no"
3259 fi; fi
3260 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
3261
3262 if test "x$with_libperl" = "xyes"
3263 then
3264         SAVE_CFLAGS="$CFLAGS"
3265         SAVE_LIBS="$LIBS"
3266         CFLAGS="$CFLAGS $PERL_CFLAGS"
3267         LIBS="$LIBS $PERL_LIBS"
3268
3269         AC_CACHE_CHECK([if perl supports ithreads],
3270                 [c_cv_have_perl_ithreads],
3271                 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3272 [[[
3273 #include <EXTERN.h>
3274 #include <perl.h>
3275 #include <XSUB.h>
3276
3277 #if !defined(USE_ITHREADS)
3278 # error "Perl does not support ithreads!"
3279 #endif /* !defined(USE_ITHREADS) */
3280 ]]],
3281 [[[ ]]]
3282                         )],
3283                         [c_cv_have_perl_ithreads="yes"],
3284                         [c_cv_have_perl_ithreads="no"]
3285                 )
3286         )
3287
3288         if test "x$c_cv_have_perl_ithreads" = "xyes"
3289         then
3290                 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
3291         fi
3292
3293         CFLAGS="$SAVE_CFLAGS"
3294         LIBS="$SAVE_LIBS"
3295 fi
3296
3297 if test "x$with_libperl" = "xyes"
3298 then
3299         SAVE_CFLAGS="$CFLAGS"
3300         SAVE_LIBS="$LIBS"
3301         # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
3302         # (see issues #41 and #42)
3303         CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
3304         LIBS="$LIBS $PERL_LIBS"
3305
3306         AC_CACHE_CHECK([for broken Perl_load_module()],
3307                 [c_cv_have_broken_perl_load_module],
3308                 AC_LINK_IFELSE([AC_LANG_PROGRAM(
3309 [[[
3310 #define PERL_NO_GET_CONTEXT
3311 #include <EXTERN.h>
3312 #include <perl.h>
3313 #include <XSUB.h>
3314 ]]],
3315 [[[
3316                          dTHX;
3317                          load_module (PERL_LOADMOD_NOIMPORT,
3318                              newSVpv ("Collectd::Plugin::FooBar", 24),
3319                              Nullsv);
3320 ]]]
3321                         )],
3322                         [c_cv_have_broken_perl_load_module="no"],
3323                         [c_cv_have_broken_perl_load_module="yes"]
3324                 )
3325         )
3326
3327         CFLAGS="$SAVE_CFLAGS"
3328         LIBS="$SAVE_LIBS"
3329 fi
3330 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
3331                 test "x$c_cv_have_broken_perl_load_module" = "xyes")
3332
3333 if test "x$with_libperl" = "xyes"
3334 then
3335         SAVE_CFLAGS="$CFLAGS"
3336         SAVE_LIBS="$LIBS"
3337         CFLAGS="$CFLAGS $PERL_CFLAGS"
3338         LIBS="$LIBS $PERL_LIBS"
3339
3340         AC_CHECK_MEMBER(
3341                 [struct mgvtbl.svt_local],
3342                 [have_struct_mgvtbl_svt_local="yes"],
3343                 [have_struct_mgvtbl_svt_local="no"],
3344                 [
3345 #include <EXTERN.h>
3346 #include <perl.h>
3347 #include <XSUB.h>
3348                 ])
3349
3350         if test "x$have_struct_mgvtbl_svt_local" = "xyes"
3351         then
3352                 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
3353                                   [Define if Perl's struct mgvtbl has member svt_local.])
3354         fi
3355
3356         CFLAGS="$SAVE_CFLAGS"
3357         LIBS="$SAVE_LIBS"
3358 fi
3359 # }}}
3360
3361 # --with-libpq {{{
3362 with_pg_config="pg_config"
3363 with_libpq_includedir=""
3364 with_libpq_libdir=""
3365 with_libpq_cppflags=""
3366 with_libpq_ldflags=""
3367 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
3368         [Path to libpq.])],
3369 [
3370         if test "x$withval" = "xno"
3371         then
3372                 with_libpq="no"
3373         else if test "x$withval" = "xyes"
3374         then
3375                 with_libpq="yes"
3376         else
3377                 if test -f "$withval" && test -x "$withval";
3378                 then
3379                         with_pg_config="$withval"
3380                 else if test -x "$withval/bin/pg_config"
3381                 then
3382                         with_pg_config="$withval/bin/pg_config"
3383                 fi; fi
3384                 with_libpq="yes"
3385         fi; fi
3386 ],
3387 [
3388         with_libpq="yes"
3389 ])
3390 if test "x$with_libpq" = "xyes"
3391 then
3392         with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
3393         pg_config_status=$?
3394
3395         if test $pg_config_status -eq 0
3396         then
3397                 if test -n "$with_libpq_includedir"; then
3398                         for dir in $with_libpq_includedir; do
3399                                 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
3400                         done
3401                 fi
3402         else
3403                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3404         fi
3405
3406         SAVE_CPPFLAGS="$CPPFLAGS"
3407         CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
3408
3409         AC_CHECK_HEADERS(libpq-fe.h, [],
3410                 [with_libpq="no (libpq-fe.h not found)"], [])
3411
3412         CPPFLAGS="$SAVE_CPPFLAGS"
3413 fi
3414 if test "x$with_libpq" = "xyes"
3415 then
3416         with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
3417         pg_config_status=$?
3418
3419         if test $pg_config_status -eq 0
3420         then
3421                 if test -n "$with_libpq_libdir"; then
3422                         for dir in $with_libpq_libdir; do
3423                                 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
3424                         done
3425                 fi
3426         else
3427                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
3428         fi
3429
3430         SAVE_LDFLAGS="$LDFLAGS"
3431         LDFLAGS="$LDFLAGS $with_libpq_ldflags"
3432
3433         AC_CHECK_LIB(pq, PQconnectdb,
3434                 [with_libpq="yes"],
3435                 [with_libpq="no (symbol 'PQconnectdb' not found)"])
3436
3437         AC_CHECK_LIB(pq, PQserverVersion,
3438                 [with_libpq="yes"],
3439                 [with_libpq="no (symbol 'PQserverVersion' not found)"])
3440
3441         LDFLAGS="$SAVE_LDFLAGS"
3442 fi
3443 if test "x$with_libpq" = "xyes"
3444 then
3445         BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
3446         BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
3447         AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
3448         AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
3449 fi
3450 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
3451 # }}}
3452
3453 # --with-libpthread {{{
3454 AC_ARG_WITH(libpthread, [AS_HELP_STRING([--with-libpthread=@<:@=PREFIX@:>@], [Path to libpthread.])],
3455 [       if test "x$withval" != "xno" \
3456                 && test "x$withval" != "xyes"
3457         then
3458                 LDFLAGS="$LDFLAGS -L$withval/lib"
3459                 CPPFLAGS="$CPPFLAGS -I$withval/include"
3460                 with_libpthread="yes"
3461         else
3462                 if test "x$withval" = "xno"
3463                 then
3464                         with_libpthread="no (disabled)"
3465                 fi
3466         fi
3467 ], [with_libpthread="yes"])
3468 if test "x$with_libpthread" = "xyes"
3469 then
3470         AC_CHECK_LIB(pthread, pthread_create, [with_libpthread="yes"], [with_libpthread="no (libpthread not found)"], [])
3471 fi
3472
3473 if test "x$with_libpthread" = "xyes"
3474 then
3475         AC_CHECK_HEADERS(pthread.h,, [with_libpthread="no (pthread.h not found)"])
3476 fi
3477 if test "x$with_libpthread" = "xyes"
3478 then
3479         collect_pthread=1
3480 else
3481         collect_pthread=0
3482 fi
3483 AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$collect_pthread],
3484         [Wether or not to use pthread (POSIX threads) library])
3485 AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes")
3486 # }}}
3487
3488 # --with-python {{{
3489 with_python_prog=""
3490 with_python_path="$PATH"
3491 AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])],
3492 [
3493  if test "x$withval" = "xyes" || test "x$withval" = "xno"
3494  then
3495          with_python="$withval"
3496  else if test -x "$withval"
3497  then
3498          with_python_prog="$withval"
3499          with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path"
3500          with_python="yes"
3501  else if test -d "$withval"
3502  then
3503          with_python_path="$withval$PATH_SEPARATOR$with_python_path"
3504          with_python="yes"
3505  else
3506          AC_MSG_WARN([Argument not recognized: $withval])
3507  fi; fi; fi
3508 ], [with_python="yes"])
3509
3510 SAVE_PATH="$PATH"
3511 SAVE_CPPFLAGS="$CPPFLAGS"
3512 SAVE_LDFLAGS="$LDFLAGS"
3513 SAVE_LIBS="$LIBS"
3514
3515 PATH="$with_python_path"
3516
3517 if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x"
3518 then
3519         AC_MSG_CHECKING([for python])
3520         with_python_prog="`which python 2>/dev/null`"
3521         if test "x$with_python_prog" = "x"
3522         then
3523                 AC_MSG_RESULT([not found])
3524                 with_python="no (interpreter not found)"
3525         else
3526                 AC_MSG_RESULT([$with_python_prog])
3527         fi
3528 fi
3529
3530 if test "x$with_python" = "xyes"
3531 then
3532         AC_MSG_CHECKING([for Python CPPFLAGS])
3533         python_include_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_python_inc())" | "$with_python_prog" 2>&1`
3534         python_config_status=$?
3535
3536         if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x"
3537         then
3538                 AC_MSG_RESULT([failed with status $python_config_status (output: $python_include_path)])
3539                 with_python="no"
3540         else
3541                 AC_MSG_RESULT([$python_include_path])
3542         fi
3543 fi
3544
3545 if test "x$with_python" = "xyes"
3546 then
3547         CPPFLAGS="-I$python_include_path $CPPFLAGS"
3548         AC_CHECK_HEADERS(Python.h,
3549                          [with_python="yes"],
3550                          [with_python="no ('Python.h' not found)"])
3551 fi
3552
3553 if test "x$with_python" = "xyes"
3554 then
3555         AC_MSG_CHECKING([for Python LDFLAGS])
3556         python_library_path=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0))" | "$with_python_prog" 2>&1`
3557         python_config_status=$?
3558
3559         if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x"
3560         then
3561                 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_path)])
3562                 with_python="no"
3563         else
3564                 AC_MSG_RESULT([$python_library_path])
3565         fi
3566 fi
3567
3568 if test "x$with_python" = "xyes"
3569 then
3570         AC_MSG_CHECKING([for Python LIBS])
3571         python_library_flags=`echo "import distutils.sysconfig;import sys;sys.stdout.write(distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0))" | "$with_python_prog" 2>&1`
3572         python_config_status=$?
3573
3574         if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x"
3575         then
3576                 AC_MSG_RESULT([failed with status $python_config_status (output: $python_library_flags)])
3577                 with_python="no"
3578         else
3579                 AC_MSG_RESULT([$python_library_flags])
3580         fi
3581 fi
3582
3583 if test "x$with_python" = "xyes"
3584 then
3585         LDFLAGS="-L$python_library_path $LDFLAGS"
3586         LIBS="$python_library_flags $LIBS"
3587
3588         AC_CHECK_FUNC(PyObject_CallFunction,
3589                       [with_python="yes"],
3590                       [with_python="no (Symbol 'PyObject_CallFunction' not found)"])
3591 fi
3592
3593 PATH="$SAVE_PATH"
3594 CPPFLAGS="$SAVE_CPPFLAGS"
3595 LDFLAGS="$SAVE_LDFLAGS"
3596 LIBS="$SAVE_LIBS"
3597
3598 if test "x$with_python" = "xyes"
3599 then
3600         BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"
3601         BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path"
3602         BUILD_WITH_PYTHON_LIBS="$python_library_flags"
3603         AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS)
3604         AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS)
3605         AC_SUBST(BUILD_WITH_PYTHON_LIBS)
3606 fi
3607 # }}} --with-python
3608
3609 # --with-librabbitmq {{{
3610 with_librabbitmq_cppflags=""
3611 with_librabbitmq_ldflags=""
3612 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
3613 [
3614         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3615         then
3616                 with_librabbitmq_cppflags="-I$withval/include"
3617                 with_librabbitmq_ldflags="-L$withval/lib"
3618                 with_librabbitmq="yes"
3619         else
3620                 with_librabbitmq="$withval"
3621         fi
3622 ],
3623 [
3624         with_librabbitmq="yes"
3625 ])
3626 SAVE_CPPFLAGS="$CPPFLAGS"
3627 SAVE_LDFLAGS="$LDFLAGS"
3628 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3629 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3630 if test "x$with_librabbitmq" = "xyes"
3631 then
3632         AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
3633 fi
3634 if test "x$with_librabbitmq" = "xyes"
3635 then
3636         # librabbitmq up to version 0.9.1 provides "library_errno", later
3637         # versions use "library_error". The library does not provide a version
3638         # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
3639         AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
3640                          [
3641 #if HAVE_STDLIB_H
3642 # include <stdlib.h>
3643 #endif
3644 #if HAVE_STDIO_H
3645 # include <stdio.h>
3646 #endif
3647 #if HAVE_STDINT_H
3648 # include <stdint.h>
3649 #endif
3650 #if HAVE_INTTYPES_H
3651 # include <inttypes.h>
3652 #endif
3653 #include <amqp.h>
3654                          ])
3655 fi
3656 if test "x$with_librabbitmq" = "xyes"
3657 then
3658         AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
3659 fi
3660 if test "x$with_librabbitmq" = "xyes"
3661 then
3662         BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
3663         BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
3664         BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
3665         AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
3666         AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
3667         AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
3668         AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
3669 fi
3670 CPPFLAGS="$SAVE_CPPFLAGS"
3671 LDFLAGS="$SAVE_LDFLAGS"
3672 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
3673
3674 with_amqp_tcp_socket="no"
3675 if test "x$with_librabbitmq" = "xyes"
3676 then
3677         SAVE_CPPFLAGS="$CPPFLAGS"
3678         SAVE_LDFLAGS="$LDFLAGS"
3679         SAVE_LIBS="$LIBS"
3680         CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
3681         LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
3682         LIBS="-lrabbitmq"
3683
3684         AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h)
3685         AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"])
3686         if test "x$with_amqp_tcp_socket" = "xyes"
3687         then
3688                 AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1,
3689                                 [Define if librabbitmq provides the new TCP socket interface.])
3690         fi
3691
3692         AC_CHECK_DECLS(amqp_socket_close,
3693                                 [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"],
3694                                 [[
3695 #include <amqp.h>
3696 #ifdef HAVE_AMQP_TCP_SOCKET_H
3697 # include <amqp_tcp_socket.h>
3698 #endif
3699 #ifdef HAVE_AMQP_SOCKET_H
3700 # include <amqp_socket.h>
3701 #endif
3702                                 ]])
3703
3704         CPPFLAGS="$SAVE_CPPFLAGS"
3705         LDFLAGS="$SAVE_LDFLAGS"
3706         LIBS="$SAVE_LIBS"
3707 fi
3708 # }}}
3709
3710 # --with-librouteros {{{
3711 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
3712 [
3713  if test "x$withval" = "xyes"
3714  then
3715          with_librouteros="yes"
3716  else if test "x$withval" = "xno"
3717  then
3718          with_librouteros="no"
3719  else
3720          with_librouteros="yes"
3721          LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
3722          LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
3723  fi; fi
3724 ],
3725 [with_librouteros="yes"])
3726
3727 SAVE_CPPFLAGS="$CPPFLAGS"
3728 SAVE_LDFLAGS="$LDFLAGS"
3729
3730 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
3731 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
3732
3733 if test "x$with_librouteros" = "xyes"
3734 then
3735         if test "x$LIBROUTEROS_CPPFLAGS" != "x"
3736         then
3737                 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
3738         fi
3739         AC_CHECK_HEADERS(routeros_api.h,
3740         [with_librouteros="yes"],
3741         [with_librouteros="no (routeros_api.h not found)"])
3742 fi
3743 if test "x$with_librouteros" = "xyes"
3744 then
3745         if test "x$LIBROUTEROS_LDFLAGS" != "x"
3746         then
3747                 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
3748         fi
3749         AC_CHECK_LIB(routeros, ros_interface,
3750         [with_librouteros="yes"],
3751         [with_librouteros="no (symbol 'ros_interface' not found)"])
3752 fi
3753
3754 CPPFLAGS="$SAVE_CPPFLAGS"
3755 LDFLAGS="$SAVE_LDFLAGS"
3756
3757 if test "x$with_librouteros" = "xyes"
3758 then
3759         BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
3760         BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
3761         AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
3762         AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
3763 fi
3764 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
3765 # }}}
3766
3767 # --with-librrd {{{
3768 # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given])
3769 librrd_cflags=""
3770 librrd_ldflags=""
3771 librrd_threadsafe="yes"
3772 librrd_rrdc_update="no"
3773 AC_ARG_WITH(librrd, [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
3774 [       if test "x$withval" != "xno" && test "x$withval" != "xyes"
3775         then
3776                 librrd_cflags="-I$withval/include"
3777                 librrd_ldflags="-L$withval/lib"
3778                 with_librrd="yes"
3779         else
3780                 with_librrd="$withval"
3781         fi
3782 ], [with_librrd="yes"])
3783 if test "x$with_librrd" = "xyes"
3784 then
3785         SAVE_CPPFLAGS="$CPPFLAGS"
3786         SAVE_LDFLAGS="$LDFLAGS"
3787
3788         CPPFLAGS="$CPPFLAGS $librrd_cflags"
3789         LDFLAGS="$LDFLAGS $librrd_ldflags"
3790
3791         AC_CHECK_HEADERS(rrd.h,, [with_librrd="no (rrd.h not found)"])
3792
3793         CPPFLAGS="$SAVE_CPPFLAGS"
3794         LDFLAGS="$SAVE_LDFLAGS"
3795 fi
3796 if test "x$with_librrd" = "xyes"
3797 then
3798         SAVE_CPPFLAGS="$CPPFLAGS"
3799         SAVE_LDFLAGS="$LDFLAGS"
3800
3801         CPPFLAGS="$CPPFLAGS $librrd_cflags"
3802         LDFLAGS="$LDFLAGS $librrd_ldflags"
3803
3804         AC_CHECK_LIB(rrd_th, rrd_update_r,
3805         [with_librrd="yes"
3806          librrd_ldflags="$librrd_ldflags -lrrd_th -lm"
3807         ],
3808         [librrd_threadsafe="no"
3809          AC_CHECK_LIB(rrd, rrd_update,
3810          [with_librrd="yes"
3811           librrd_ldflags="$librrd_ldflags -lrrd -lm"
3812          ],
3813          [with_librrd="no (symbol 'rrd_update' not found)"],
3814          [-lm])
3815         ],
3816         [-lm])
3817
3818         if test "x$librrd_threadsafe" = "xyes"
3819         then
3820                 AC_CHECK_LIB(rrd_th, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3821         else
3822                 AC_CHECK_LIB(rrd, rrdc_update, [librrd_rrdc_update="yes"], [librrd_rrdc_update="no"])
3823         fi
3824
3825         CPPFLAGS="$SAVE_CPPFLAGS"
3826         LDFLAGS="$SAVE_LDFLAGS"
3827 fi
3828 if test "x$with_librrd" = "xyes"
3829 then
3830         BUILD_WITH_LIBRRD_CFLAGS="$librrd_cflags"
3831         BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
3832         AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
3833         AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
3834 fi
3835 if test "x$librrd_threadsafe" = "xyes"
3836 then
3837         AC_DEFINE(HAVE_THREADSAFE_LIBRRD, 1, [Define to 1 if you have the threadsafe rrd library (-lrrd_th).])
3838 fi
3839 # }}}
3840
3841 # --with-libsensors {{{
3842 with_sensors_cflags=""
3843 with_sensors_ldflags=""
3844 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
3845 [
3846         if test "x$withval" = "xno"
3847         then
3848                 with_libsensors="no"
3849         else
3850                 with_libsensors="yes"
3851                 if test "x$withval" != "xyes"
3852                 then
3853                         with_sensors_cflags="-I$withval/include"
3854                         with_sensors_ldflags="-L$withval/lib"
3855                         with_libsensors="yes"
3856                 fi
3857         fi
3858 ],
3859 [
3860         if test "x$ac_system" = "xLinux"
3861         then
3862                 with_libsensors="yes"
3863         else
3864                 with_libsensors="no (Linux only library)"
3865         fi
3866 ])
3867 if test "x$with_libsensors" = "xyes"
3868 then
3869         SAVE_CPPFLAGS="$CPPFLAGS"
3870         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3871
3872 #       AC_CHECK_HEADERS(sensors/sensors.h,
3873 #       [
3874 #               AC_DEFINE(HAVE_SENSORS_SENSORS_H, 1, [Define to 1 if you have the <sensors/sensors.h> header file.])
3875 #       ],
3876 #       [with_libsensors="no (sensors/sensors.h not found)"])
3877         AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
3878
3879         CPPFLAGS="$SAVE_CPPFLAGS"
3880 fi
3881 if test "x$with_libsensors" = "xyes"
3882 then
3883         SAVE_CPPFLAGS="$CPPFLAGS"
3884         SAVE_LDFLAGS="$LDFLAGS"
3885         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
3886         LDFLAGS="$LDFLAGS $with_sensors_ldflags"
3887
3888         AC_CHECK_LIB(sensors, sensors_init,
3889         [
3890                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
3891         ],
3892         [with_libsensors="no (libsensors not found)"])
3893
3894         CPPFLAGS="$SAVE_CPPFLAGS"
3895         LDFLAGS="$SAVE_LDFLAGS"
3896 fi
3897 if test "x$with_libsensors" = "xyes"
3898 then
3899         BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
3900         BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
3901         AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
3902         AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
3903 fi
3904 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
3905 # }}}
3906
3907 # --with-libsigrok {{{
3908 with_libsigrok_cflags=""
3909 with_libsigrok_ldflags=""
3910 AC_ARG_WITH(libsigrok, [AS_HELP_STRING([--with-libsigrok@<:@=PREFIX@:>@], [Path to libsigrok.])],
3911 [
3912         if test "x$withval" = "xno"
3913         then
3914                 with_libsigrok="no"
3915         else
3916                 with_libsigrok="yes"
3917                 if test "x$withval" != "xyes"
3918                 then
3919                         with_libsigrok_cflags="-I$withval/include"
3920                         with_libsigrok_ldflags="-L$withval/lib"
3921                 fi
3922         fi
3923 ],[with_libsigrok="yes"])
3924
3925 # libsigrok has a glib dependency
3926 if test "x$with_libsigrok" = "xyes"
3927 then
3928 m4_ifdef([AM_PATH_GLIB_2_0],
3929         [
3930          AM_PATH_GLIB_2_0([2.28.0],
3931                 [with_libsigrok_cflags="$with_libsigrok_cflags $GLIB_CFLAGS"; with_libsigrok_ldflags="$with_libsigrok_ldflags $GLIB_LIBS"])
3932         ],
3933         [
3934          with_libsigrok="no (glib not available)"
3935         ]
3936 )
3937 fi
3938
3939 # libsigrok headers
3940 if test "x$with_libsigrok" = "xyes"
3941 then
3942         SAVE_CPPFLAGS="$CPPFLAGS"
3943         CPPFLAGS="$CPPFLAGS $with_libsigrok_cflags"
3944
3945         AC_CHECK_HEADERS(libsigrok/libsigrok.h, [], [with_libsigrok="no (libsigrok/libsigrok.h not found)"])
3946
3947         CPPFLAGS="$SAVE_CPPFLAGS"
3948 fi
3949
3950 # libsigrok library
3951 if test "x$with_libsigrok" = "xyes"
3952 then
3953         SAVE_CPPFLAGS="$CPPFLAGS"
3954         SAVE_LDFLAGS="$LDFLAGS"
3955         CPPFLAGS="$CPPFLAGS $with_libsigrok_cflags"
3956         LDFLAGS="$LDFLAGS $with_libsigrok_ldflags"
3957
3958         AC_CHECK_LIB(sigrok, sr_init,
3959         [
3960                 AC_DEFINE(HAVE_LIBSIGROK, 1, [Define to 1 if you have the sigrok library (-lsigrok).])
3961         ],
3962         [with_libsigrok="no (libsigrok not found)"])
3963
3964         CPPFLAGS="$SAVE_CPPFLAGS"
3965         LDFLAGS="$SAVE_LDFLAGS"
3966 fi
3967 if test "x$with_libsigrok" = "xyes"
3968 then
3969         BUILD_WITH_LIBSIGROK_CFLAGS="$with_libsigrok_cflags"
3970         BUILD_WITH_LIBSIGROK_LDFLAGS="$with_libsigrok_ldflags"
3971         AC_SUBST(BUILD_WITH_LIBSIGROK_CFLAGS)
3972         AC_SUBST(BUILD_WITH_LIBSIGROK_LDFLAGS)
3973 fi
3974 AM_CONDITIONAL(BUILD_WITH_LIBSIGROK, test "x$with_libsigrok" = "xyes")
3975 # }}}
3976
3977 # --with-libstatgrab {{{
3978 with_libstatgrab_cflags=""
3979 with_libstatgrab_ldflags=""
3980 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
3981 [
3982  if test "x$withval" != "xno" \
3983    && test "x$withval" != "xyes"
3984  then
3985    with_libstatgrab_cflags="-I$withval/include"
3986    with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
3987    with_libstatgrab="yes"
3988    with_libstatgrab_pkg_config="no"
3989  else
3990    with_libstatgrab="$withval"
3991    with_libstatgrab_pkg_config="yes"
3992  fi
3993  ],
3994 [
3995  with_libstatgrab="yes"
3996  with_libstatgrab_pkg_config="yes"
3997 ])
3998
3999 if test "x$with_libstatgrab" = "xyes" \
4000   && test "x$with_libstatgrab_pkg_config" = "xyes"
4001 then
4002   if test "x$PKG_CONFIG" != "x"
4003   then
4004     AC_MSG_CHECKING([pkg-config for libstatgrab])
4005     temp_result="found"
4006     $PKG_CONFIG --exists libstatgrab 2>/dev/null
4007     if test "$?" != "0"
4008     then
4009       with_libstatgrab_pkg_config="no"
4010       with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
4011       temp_result="not found"
4012     fi
4013     AC_MSG_RESULT([$temp_result])
4014   else
4015     AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
4016     with_libstatgrab_pkg_config="no"
4017     with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
4018   fi
4019 fi
4020
4021 if test "x$with_libstatgrab" = "xyes" \
4022   && test "x$with_libstatgrab_pkg_config" = "xyes" \
4023   && test "x$with_libstatgrab_cflags" = "x"
4024 then
4025   AC_MSG_CHECKING([for libstatgrab CFLAGS])
4026   temp_result="`$PKG_CONFIG --cflags libstatgrab`"
4027   if test "$?" = "0"
4028   then
4029     with_libstatgrab_cflags="$temp_result"
4030   else
4031     with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
4032     temp_result="$PKG_CONFIG --cflags libstatgrab failed"
4033   fi
4034   AC_MSG_RESULT([$temp_result])
4035 fi
4036
4037 if test "x$with_libstatgrab" = "xyes" \
4038   && test "x$with_libstatgrab_pkg_config" = "xyes" \
4039   && test "x$with_libstatgrab_ldflags" = "x"
4040 then
4041   AC_MSG_CHECKING([for libstatgrab LDFLAGS])
4042   temp_result="`$PKG_CONFIG --libs libstatgrab`"
4043   if test "$?" = "0"
4044   then
4045     with_libstatgrab_ldflags="$temp_result"
4046   else
4047     with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
4048     temp_result="$PKG_CONFIG --libs libstatgrab failed"
4049   fi
4050   AC_MSG_RESULT([$temp_result])
4051 fi
4052
4053 if test "x$with_libstatgrab" = "xyes"
4054 then
4055   SAVE_CPPFLAGS="$CPPFLAGS"
4056   CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
4057
4058   AC_CHECK_HEADERS(statgrab.h,
4059                    [with_libstatgrab="yes"],
4060                    [with_libstatgrab="no (statgrab.h not found)"])
4061
4062   CPPFLAGS="$SAVE_CPPFLAGS"
4063 fi
4064
4065 if test "x$with_libstatgrab" = "xyes"
4066 then
4067   SAVE_CFLAGS="$CFLAGS"
4068   SAVE_LDFLAGS="$LDFLAGS"
4069
4070   CFLAGS="$CFLAGS $with_libstatgrab_cflags"
4071   LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
4072
4073   AC_CHECK_LIB(statgrab, sg_init,
4074                [with_libstatgrab="yes"],
4075                [with_libstatgrab="no (symbol sg_init not found)"])
4076
4077   CFLAGS="$SAVE_CFLAGS"
4078   LDFLAGS="$SAVE_LDFLAGS"
4079 fi
4080
4081 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
4082 if test "x$with_libstatgrab" = "xyes"
4083 then
4084   AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
4085   BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
4086   BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
4087   AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
4088   AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
4089 fi
4090 # }}}
4091
4092 # --with-libtokyotyrant {{{
4093 with_libtokyotyrant_cppflags=""
4094 with_libtokyotyrant_ldflags=""
4095 with_libtokyotyrant_libs=""
4096 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
4097 [
4098   if test "x$withval" = "xno"
4099   then
4100     with_libtokyotyrant="no"
4101   else if test "x$withval" = "xyes"
4102   then
4103     with_libtokyotyrant="yes"
4104   else
4105     with_libtokyotyrant_cppflags="-I$withval/include"
4106     with_libtokyotyrant_ldflags="-L$withval/include"
4107     with_libtokyotyrant_libs="-ltokyotyrant"
4108     with_libtokyotyrant="yes"
4109   fi; fi
4110 ],
4111 [
4112   with_libtokyotyrant="yes"
4113 ])
4114
4115 if test "x$with_libtokyotyrant" = "xyes"
4116 then
4117   if $PKG_CONFIG --exists tokyotyrant
4118   then
4119     with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
4120     with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`"
4121     with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`"
4122   fi
4123 fi
4124
4125 SAVE_CPPFLAGS="$CPPFLAGS"
4126 SAVE_LDFLAGS="$LDFLAGS"
4127 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
4128 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
4129
4130 if test "x$with_libtokyotyrant" = "xyes"
4131 then
4132   AC_CHECK_HEADERS(tcrdb.h,
4133   [
4134           AC_DEFINE(HAVE_TCRDB_H, 1,
4135                     [Define to 1 if you have the <tcrdb.h> header file.])
4136   ], [with_libtokyotyrant="no (tcrdb.h not found)"])
4137 fi
4138
4139 if test "x$with_libtokyotyrant" = "xyes"
4140 then
4141   AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
4142   [
4143           AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
4144                     [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
4145   ],
4146   [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
4147   [$with_libtokyotyrant_libs])
4148 fi
4149
4150 CPPFLAGS="$SAVE_CPPFLAGS"
4151 LDFLAGS="$SAVE_LDFLAGS"
4152
4153 if test "x$with_libtokyotyrant" = "xyes"
4154 then 
4155   BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
4156   BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
4157   BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
4158   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
4159   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
4160   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
4161 fi
4162 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
4163 # }}}
4164
4165 # --with-libupsclient {{{
4166 with_libupsclient_config=""
4167 with_libupsclient_cflags=""
4168 with_libupsclient_libs=""
4169 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
4170 [
4171         if test "x$withval" = "xno"
4172         then
4173                 with_libupsclient="no"
4174         else if test "x$withval" = "xyes"
4175         then
4176                 with_libupsclient="use_pkgconfig"
4177         else
4178                 if test -x "$withval"
4179                 then
4180                         with_libupsclient_config="$withval"
4181                         with_libupsclient="use_libupsclient_config"
4182                 else if test -x "$withval/bin/libupsclient-config"
4183                 then
4184                         with_libupsclient_config="$withval/bin/libupsclient-config"
4185                         with_libupsclient="use_libupsclient_config"
4186                 else
4187                         AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
4188                         with_libupsclient_cflags="-I$withval/include"
4189                         with_libupsclient_libs="-L$withval/lib -lupsclient"
4190                         with_libupsclient="yes"
4191                 fi; fi
4192         fi; fi
4193 ],
4194 [with_libupsclient="use_pkgconfig"])
4195
4196 # configure using libupsclient-config
4197 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4198 then
4199         AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
4200         with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
4201         if test $? -ne 0
4202         then
4203                 with_libupsclient="no ($with_libupsclient_config failed)"
4204         fi
4205         with_libupsclient_libs="`$with_libupsclient_config --libs`"
4206         if test $? -ne 0
4207         then
4208                 with_libupsclient="no ($with_libupsclient_config failed)"
4209         fi
4210 fi
4211 if test "x$with_libupsclient" = "xuse_libupsclient_config"
4212 then
4213         with_libupsclient="yes"
4214 fi
4215
4216 # configure using pkg-config
4217 if test "x$with_libupsclient" = "xuse_pkgconfig"
4218 then
4219         if test "x$PKG_CONFIG" = "x"
4220         then
4221                 with_libupsclient="no (Don't have pkg-config)"
4222         fi
4223 fi
4224 if test "x$with_libupsclient" = "xuse_pkgconfig"
4225 then
4226         AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
4227         $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
4228         if test $? -ne 0
4229         then
4230                 with_libupsclient="no (pkg-config doesn't know libupsclient)"
4231         fi
4232 fi
4233 if test "x$with_libupsclient" = "xuse_pkgconfig"
4234 then
4235         with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
4236         if test $? -ne 0
4237         then
4238                 with_libupsclient="no ($PKG_CONFIG failed)"
4239         fi
4240         with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
4241         if test $? -ne 0
4242         then
4243                 with_libupsclient="no ($PKG_CONFIG failed)"
4244         fi
4245 fi
4246 if test "x$with_libupsclient" = "xuse_pkgconfig"
4247 then
4248         with_libupsclient="yes"
4249 fi
4250
4251 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
4252 # the actual checks.
4253 if test "x$with_libupsclient" = "xyes"
4254 then
4255         SAVE_CPPFLAGS="$CPPFLAGS"
4256         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4257
4258         AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
4259
4260         CPPFLAGS="$SAVE_CPPFLAGS"
4261 fi
4262 if test "x$with_libupsclient" = "xyes"
4263 then
4264         SAVE_CPPFLAGS="$CPPFLAGS"
4265         SAVE_LDFLAGS="$LDFLAGS"
4266
4267         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4268         LDFLAGS="$LDFLAGS $with_libupsclient_libs"
4269
4270         AC_CHECK_LIB(upsclient, upscli_connect,
4271                      [with_libupsclient="yes"],
4272                      [with_libupsclient="no (symbol upscli_connect not found)"])
4273
4274         CPPFLAGS="$SAVE_CPPFLAGS"
4275         LDFLAGS="$SAVE_LDFLAGS"
4276 fi
4277 if test "x$with_libupsclient" = "xyes"
4278 then
4279         SAVE_CPPFLAGS="$CPPFLAGS"
4280         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
4281
4282         AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
4283 [#include <stdlib.h>
4284 #include <stdio.h>
4285 #include <upsclient.h>])
4286
4287         CPPFLAGS="$SAVE_CPPFLAGS"
4288 fi
4289 if test "x$with_libupsclient" = "xyes"
4290 then
4291         BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
4292         BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
4293         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
4294         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
4295 fi
4296 # }}}
4297
4298 # --with-libxmms {{{
4299 with_xmms_config="xmms-config"
4300 with_xmms_cflags=""
4301 with_xmms_libs=""
4302 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
4303 [
4304         if test "x$withval" != "xno" \
4305                 && test "x$withval" != "xyes"
4306         then
4307                 if test -f "$withval" && test -x "$withval";
4308                 then
4309                         with_xmms_config="$withval"
4310                 else if test -x "$withval/bin/xmms-config"
4311                 then
4312                         with_xmms_config="$withval/bin/xmms-config"
4313                 fi; fi
4314                 with_libxmms="yes"
4315         else if test "x$withval" = "xno"
4316         then
4317                 with_libxmms="no"
4318         else
4319                 with_libxmms="yes"
4320         fi; fi
4321 ],
4322 [
4323         with_libxmms="yes"
4324 ])
4325 if test "x$with_libxmms" = "xyes"
4326 then
4327         with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
4328         xmms_config_status=$?
4329
4330         if test $xmms_config_status -ne 0
4331         then
4332                 with_libxmms="no"
4333         fi
4334 fi
4335 if test "x$with_libxmms" = "xyes"
4336 then
4337         with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
4338         xmms_config_status=$?
4339
4340         if test $xmms_config_status -ne 0
4341         then
4342                 with_libxmms="no"
4343         fi
4344 fi
4345 if test "x$with_libxmms" = "xyes"
4346 then
4347         AC_CHECK_LIB(xmms, xmms_remote_get_info,
4348         [
4349                 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
4350                 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
4351                 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
4352                 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
4353         ],
4354         [
4355                 with_libxmms="no"
4356         ],
4357         [$with_xmms_libs])
4358 fi
4359 with_libxmms_numeric=0
4360 if test "x$with_libxmms" = "xyes"
4361 then
4362         with_libxmms_numeric=1
4363 fi
4364 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
4365 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
4366 # }}}
4367
4368 # --with-libyajl {{{
4369 with_libyajl_cppflags=""
4370 with_libyajl_ldflags=""
4371 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
4372 [
4373         if test "x$withval" != "xno" && test "x$withval" != "xyes"
4374         then
4375                 with_libyajl_cppflags="-I$withval/include"
4376                 with_libyajl_ldflags="-L$withval/lib"
4377                 with_libyajl="yes"
4378         else
4379                 with_libyajl="$withval"
4380         fi
4381 ],
4382 [
4383         with_libyajl="yes"
4384 ])
4385 if test "x$with_libyajl" = "xyes"
4386 then
4387         SAVE_CPPFLAGS="$CPPFLAGS"
4388         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4389
4390         AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
4391         AC_CHECK_HEADERS(yajl/yajl_version.h)
4392
4393         CPPFLAGS="$SAVE_CPPFLAGS"
4394 fi
4395 if test "x$with_libyajl" = "xyes"
4396 then
4397         SAVE_CPPFLAGS="$CPPFLAGS"
4398         SAVE_LDFLAGS="$LDFLAGS"
4399         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
4400         LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
4401
4402         AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
4403
4404         CPPFLAGS="$SAVE_CPPFLAGS"
4405         LDFLAGS="$SAVE_LDFLAGS"
4406 fi
4407 if test "x$with_libyajl" = "xyes"
4408 then
4409         BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
4410         BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
4411         BUILD_WITH_LIBYAJL_LIBS="-lyajl"
4412         AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
4413         AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
4414         AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
4415         AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
4416 fi
4417 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
4418 # }}}
4419
4420 # --with-mic {{{
4421 with_mic_cflags="-I/opt/intel/mic/sysmgmt/sdk/include"
4422 with_mic_ldpath="-L/opt/intel/mic/sysmgmt/sdk/lib/Linux"
4423 with_mic_libs=""
4424 AC_ARG_WITH(mic,[AS_HELP_STRING([--with-mic@<:@=PREFIX@:>@], [Path to Intel MIC Access API.])],
4425 [
4426         if test "x$withval" = "xno"
4427         then
4428                 with_mic="no"
4429         else if test "x$withval" = "xyes"
4430         then
4431                 with_mic="yes"
4432         else if test -d "$with_mic/lib"
4433         then
4434                 AC_MSG_NOTICE([Not checking for Intel Mic: Manually configured])
4435                 with_mic_cflags="-I$withval/include"
4436                 with_mic_ldpath="-L$withval/lib/Linux"
4437                 with_mic_libs="-lMicAccessSDK -lscif -lpthread"
4438                 with_mic="yes"
4439         fi; fi; fi
4440 ],
4441 [with_mic="yes"])
4442 if test "x$with_mic" = "xyes"
4443 then
4444         SAVE_CPPFLAGS="$CPPFLAGS"
4445         CPPFLAGS="$CPPFLAGS $with_mic_cflags"
4446         AC_CHECK_HEADERS(MicAccessApi.h,[],[with_mic="no (MicAccessApi not found)"])
4447         CPPFLAGS="$SAVE_CPPFLAGS"
4448 fi
4449 if test "x$with_mic" = "xyes"
4450 then
4451         SAVE_CPPFLAGS="$CPPFLAGS"
4452         SAVE_LDFLAGS="$LDFLAGS"
4453
4454         CPPFLAGS="$CPPFLAGS $with_mic_cflags"
4455         LDFLAGS="$LDFLAGS $with_mic_ldpath"
4456
4457         AC_CHECK_LIB(MicAccessSDK, MicInitAPI,
4458                         [with_mic_ldpath="$with_mic_ldpath"
4459                         with_mic_libs="-lMicAccessSDK -lscif -lpthread"],
4460                         [with_mic="no (symbol MicInitAPI not found)"],[-lscif -lpthread])
4461
4462         CPPFLAGS="$SAVE_CPPFLAGS"
4463         LDFLAGS="$SAVE_LDFLAGS"
4464 fi
4465
4466 if test "x$with_mic" = "xyes"
4467 then
4468         BUILD_WITH_MIC_CPPFLAGS="$with_mic_cflags"
4469         BUILD_WITH_MIC_LIBPATH="$with_mic_ldpath"
4470         BUILD_WITH_MIC_LDADD="$with_mic_libs"
4471         AC_SUBST(BUILD_WITH_MIC_CPPFLAGS)
4472         AC_SUBST(BUILD_WITH_MIC_LIBPATH)
4473         AC_SUBST(BUILD_WITH_MIC_LDADD)
4474 fi
4475 #}}}
4476
4477 # --with-libvarnish {{{
4478 with_libvarnish_cppflags=""
4479 with_libvarnish_cflags=""
4480 with_libvarnish_libs=""
4481 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
4482 [
4483         if test "x$withval" = "xno"
4484         then
4485                 with_libvarnish="no"
4486         else if test "x$withval" = "xyes"
4487         then
4488                 with_libvarnish="use_pkgconfig"
4489         else if test -d "$with_libvarnish/lib"
4490         then
4491                 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
4492                 with_libvarnish_cflags="-I$withval/include"
4493                 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
4494                 with_libvarnish="yes"
4495         fi; fi; fi
4496 ],
4497 [with_libvarnish="use_pkgconfig"])
4498
4499 # configure using pkg-config
4500 if test "x$with_libvarnish" = "xuse_pkgconfig"
4501 then
4502         if test "x$PKG_CONFIG" = "x"
4503         then
4504                 with_libvarnish="no (Don't have pkg-config)"
4505         fi
4506 fi
4507 if test "x$with_libvarnish" = "xuse_pkgconfig"
4508 then
4509         AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
4510         $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
4511         if test $? -ne 0
4512         then
4513                 with_libvarnish="no (pkg-config doesn't know varnishapi)"
4514         fi
4515 fi
4516 if test "x$with_libvarnish" = "xuse_pkgconfig"
4517 then
4518         with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
4519         if test $? -ne 0
4520         then
4521                 with_libvarnish="no ($PKG_CONFIG failed)"
4522         fi
4523         with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
4524         if test $? -ne 0
4525         then
4526                 with_libvarnish="no ($PKG_CONFIG failed)"
4527         fi
4528 fi
4529 if test "x$with_libvarnish" = "xuse_pkgconfig"
4530 then
4531         with_libvarnish="yes"
4532 fi
4533
4534 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
4535 # the actual checks.
4536 if test "x$with_libvarnish" = "xyes"
4537 then
4538         SAVE_CPPFLAGS="$CPPFLAGS"
4539         CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4540         AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
4541
4542         CPPFLAGS="$SAVE_CPPFLAGS"
4543 fi
4544 if test "x$with_libvarnish" = "xyes"
4545 then
4546         SAVE_CPPFLAGS="$CPPFLAGS"
4547         #SAVE_LDFLAGS="$LDFLAGS"
4548
4549         CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
4550         #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
4551
4552     AC_CHECK_HEADERS(varnish/vsc.h,
4553         [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
4554         [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])])
4555
4556         CPPFLAGS="$SAVE_CPPFLAGS"
4557         #LDFLAGS="$SAVE_LDFLAGS"
4558 fi
4559 if test "x$with_libvarnish" = "xyes"
4560 then
4561         BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
4562         BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
4563         AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
4564         AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
4565 fi
4566 # }}}
4567
4568 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
4569 with_libxml2="no (pkg-config isn't available)"
4570 with_libxml2_cflags=""
4571 with_libxml2_ldflags=""
4572 with_libvirt="no (pkg-config isn't available)"
4573 with_libvirt_cflags=""
4574 with_libvirt_ldflags=""
4575 if test "x$PKG_CONFIG" != "x"
4576 then
4577         $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
4578         if test "$?" = "0"
4579         then
4580                 with_libxml2="yes"
4581         else
4582                 with_libxml2="no (pkg-config doesn't know libxml-2.0)"
4583         fi
4584
4585         $PKG_CONFIG --exists libvirt 2>/dev/null
4586         if test "$?" = "0"
4587         then
4588                 with_libvirt="yes"
4589         else
4590                 with_libvirt="no (pkg-config doesn't know libvirt)"
4591         fi
4592 fi
4593 if test "x$with_libxml2" = "xyes"
4594 then
4595         with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
4596         if test $? -ne 0
4597         then
4598                 with_libxml2="no"
4599         fi
4600         with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
4601         if test $? -ne 0
4602         then
4603                 with_libxml2="no"
4604         fi
4605 fi
4606 if test "x$with_libxml2" = "xyes"
4607 then
4608         SAVE_CPPFLAGS="$CPPFLAGS"
4609         CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
4610
4611         AC_CHECK_HEADERS(libxml/parser.h, [],
4612                       [with_libxml2="no (libxml/parser.h not found)"])
4613
4614         CPPFLAGS="$SAVE_CPPFLAGS"
4615 fi
4616 if test "x$with_libxml2" = "xyes"
4617 then
4618         SAVE_CFLAGS="$CFLAGS"
4619         SAVE_LDFLAGS="$LDFLAGS"
4620
4621         CFLAGS="$CFLAGS $with_libxml2_cflags"
4622         LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
4623
4624         AC_CHECK_LIB(xml2, xmlXPathEval,
4625                      [with_libxml2="yes"],
4626                      [with_libxml2="no (symbol xmlXPathEval not found)"])
4627
4628         CFLAGS="$SAVE_CFLAGS"
4629         LDFLAGS="$SAVE_LDFLAGS"
4630 fi
4631 dnl Add the right compiler flags and libraries.
4632 if test "x$with_libxml2" = "xyes"; then
4633         BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
4634         BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
4635         AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
4636         AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
4637 fi
4638 if test "x$with_libvirt" = "xyes"
4639 then
4640         with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`"
4641         if test $? -ne 0
4642         then
4643                 with_libvirt="no"
4644         fi
4645         with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`"
4646         if test $? -ne 0
4647         then
4648                 with_libvirt="no"
4649         fi
4650 fi
4651 if test "x$with_libvirt" = "xyes"
4652 then
4653         SAVE_CPPFLAGS="$CPPFLAGS"
4654         CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
4655
4656         AC_CHECK_HEADERS(libvirt/libvirt.h, [],
4657                       [with_libvirt="no (libvirt/libvirt.h not found)"])
4658
4659         CPPFLAGS="$SAVE_CPPFLAGS"
4660 fi
4661 if test "x$with_libvirt" = "xyes"
4662 then
4663         SAVE_CFLAGS="$CFLAGS"
4664         SAVE_LDFLAGS="$LDFLAGS"
4665
4666         CFLAGS="$CFLAGS $with_libvirt_cflags"
4667         LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
4668
4669         AC_CHECK_LIB(virt, virDomainBlockStats,
4670                      [with_libvirt="yes"],
4671                      [with_libvirt="no (symbol virDomainBlockStats not found)"])
4672
4673         CFLAGS="$SAVE_CFLAGS"
4674         LDFLAGS="$SAVE_LDFLAGS"
4675 fi
4676 dnl Add the right compiler flags and libraries.
4677 if test "x$with_libvirt" = "xyes"; then
4678         BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
4679         BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
4680         AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
4681         AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
4682 fi
4683 # }}}
4684
4685 # $PKG_CONFIG --exists OpenIPMIpthread {{{
4686 with_libopenipmipthread="yes"
4687 with_libopenipmipthread_cflags=""
4688 with_libopenipmipthread_libs=""
4689
4690 AC_MSG_CHECKING([for pkg-config])
4691 temp_result="no"
4692 if test "x$PKG_CONFIG" = "x"
4693 then
4694         with_libopenipmipthread="no"
4695         temp_result="no"
4696 else
4697         temp_result="$PKG_CONFIG"
4698 fi
4699 AC_MSG_RESULT([$temp_result])
4700
4701 if test "x$with_libopenipmipthread" = "xyes"
4702 then
4703         AC_MSG_CHECKING([for libOpenIPMIpthread])
4704         $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
4705         if test "$?" != "0"
4706         then
4707                 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
4708         fi
4709         AC_MSG_RESULT([$with_libopenipmipthread])
4710 fi
4711
4712 if test "x$with_libopenipmipthread" = "xyes"
4713 then
4714         AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
4715         temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
4716         if test "$?" = "0"
4717         then
4718                 with_libopenipmipthread_cflags="$temp_result"
4719         else
4720                 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
4721                 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
4722         fi
4723         AC_MSG_RESULT([$temp_result])
4724 fi
4725
4726 if test "x$with_libopenipmipthread" = "xyes"
4727 then
4728         AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
4729         temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
4730         if test "$?" = "0"
4731         then
4732                 with_libopenipmipthread_ldflags="$temp_result"
4733         else
4734                 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
4735                 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
4736         fi
4737         AC_MSG_RESULT([$temp_result])
4738 fi
4739
4740 if test "x$with_libopenipmipthread" = "xyes"
4741 then
4742         SAVE_CPPFLAGS="$CPPFLAGS"
4743         CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
4744
4745         AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
4746                          [with_libopenipmipthread="yes"],
4747                          [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
4748 [#include <OpenIPMI/ipmiif.h>
4749 #include <OpenIPMI/ipmi_err.h>
4750 #include <OpenIPMI/ipmi_posix.h>
4751 #include <OpenIPMI/ipmi_conn.h>
4752 ])
4753
4754         CPPFLAGS="$SAVE_CPPFLAGS"
4755 fi
4756
4757 if test "x$with_libopenipmipthread" = "xyes"
4758 then
4759         BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
4760         BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
4761         AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
4762         AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
4763 fi
4764 # }}}
4765
4766 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
4767                 [with_libnotify="yes"],
4768                 [if test "x$LIBNOTIFY_PKG_ERRORS" = "x"; then
4769                          with_libnotify="no"
4770                  else
4771                          with_libnotify="no ($LIBNOTIFY_PKG_ERRORS)"
4772                  fi])
4773
4774 # Check for enabled/disabled features
4775 #
4776
4777 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
4778 # ------------------------------------------------------------
4779 dnl
4780 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
4781 dnl
4782 AC_DEFUN(
4783         [AC_COLLECTD],
4784         [
4785         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
4786         m4_if(
4787                 [$2],
4788                 [enable],
4789                 [dnl
4790                 m4_define([EnDis],[disabled])dnl
4791                 m4_define([YesNo],[no])dnl
4792                 ],dnl
4793                 [m4_if(
4794                         [$2],
4795                         [disable],
4796                         [dnl
4797                         m4_define([EnDis],[enabled])dnl
4798                         m4_define([YesNo],[yes])dnl
4799                         ],
4800                         [dnl
4801                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
4802                         ]dnl
4803                 )]dnl
4804         )dnl
4805         m4_if([$3], [feature], [],
4806                 [m4_if(
4807                         [$3], [module], [],
4808                         [dnl
4809                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
4810                         ]dnl
4811                 )]dnl
4812         )dnl
4813         AC_ARG_ENABLE(
4814                 [$1],
4815                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
4816                 [],
4817                 enable_$1='[YesNo]'dnl
4818         )# AC_ARG_ENABLE
4819 if test "x$enable_$1" = "xno"
4820 then
4821         collectd_$1=0
4822 else
4823         if test "x$enable_$1" = "xyes"
4824         then
4825                 collectd_$1=1
4826         else
4827                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
4828                 collectd_$1=1
4829                 enable_$1='yes'
4830         fi
4831 fi
4832         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
4833         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
4834         ]dnl
4835 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
4836
4837 # AC_PLUGIN(name, default, info)
4838 # ------------------------------------------------------------
4839 dnl
4840 AC_DEFUN(
4841   [AC_PLUGIN],
4842   [
4843     enable_plugin="no"
4844     force="no"
4845     AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1],[$3]),
4846     [
4847      if test "x$enableval" = "xyes"
4848      then
4849              enable_plugin="yes"
4850      else if test "x$enableval" = "xforce"
4851      then
4852              enable_plugin="yes"
4853              force="yes"
4854      else
4855              enable_plugin="no (disabled on command line)"
4856      fi; fi
4857     ],
4858     [
4859          if test "x$enable_all_plugins" = "xauto"
4860          then
4861              if test "x$2" = "xyes"
4862              then
4863                      enable_plugin="yes"
4864              else
4865                      enable_plugin="no"
4866              fi
4867          else
4868              enable_plugin="$enable_all_plugins"
4869          fi
4870     ])
4871     if test "x$enable_plugin" = "xyes"
4872     then
4873             if test "x$2" = "xyes" || test "x$force" = "xyes"
4874             then
4875                     AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
4876                     if test "x$2" != "xyes"
4877                     then
4878                             dependency_warning="yes"
4879                     fi
4880             else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
4881                     dependency_error="yes"
4882                     enable_plugin="no (dependency error)"
4883             fi
4884     fi
4885     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
4886     enable_$1="$enable_plugin"
4887   ]
4888 )# AC_PLUGIN(name, default, info)
4889
4890 m4_divert_once([HELP_ENABLE], [
4891 collectd features:])
4892 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
4893 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
4894 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
4895 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
4896
4897 dependency_warning="no"
4898 dependency_error="no"
4899
4900 plugin_ascent="no"
4901 plugin_battery="no"
4902 plugin_bind="no"
4903 plugin_cgroups="no"
4904 plugin_conntrack="no"
4905 plugin_contextswitch="no"
4906 plugin_cpu="no"
4907 plugin_cpufreq="no"
4908 plugin_curl_json="no"
4909 plugin_curl_xml="no"
4910 plugin_df="no"
4911 plugin_disk="no"
4912 plugin_entropy="no"
4913 plugin_ethstat="no"
4914 plugin_fscache="no"
4915 plugin_interface="no"
4916 plugin_ipmi="no"
4917 plugin_ipvs="no"
4918 plugin_irq="no"
4919 plugin_libvirt="no"
4920 plugin_load="no"
4921 plugin_memory="no"
4922 plugin_multimeter="no"
4923 plugin_nfs="no"
4924 plugin_numa="no"
4925 plugin_perl="no"
4926 plugin_processes="no"
4927 plugin_protocols="no"
4928 plugin_serial="no"
4929 plugin_swap="no"
4930 plugin_tape="no"
4931 plugin_tcpconns="no"
4932 plugin_ted="no"
4933 plugin_thermal="no"
4934 plugin_users="no"
4935 plugin_uptime="no"
4936 plugin_vmem="no"
4937 plugin_vserver="no"
4938 plugin_wireless="no"
4939 plugin_zfs_arc="no"
4940
4941 # Linux
4942 if test "x$ac_system" = "xLinux"
4943 then
4944         plugin_battery="yes"
4945         plugin_conntrack="yes"
4946         plugin_contextswitch="yes"
4947         plugin_cgroups="yes"
4948         plugin_cpu="yes"
4949         plugin_cpufreq="yes"
4950         plugin_disk="yes"
4951         plugin_entropy="yes"
4952         plugin_fscache="yes"
4953         plugin_interface="yes"
4954         plugin_irq="yes"
4955         plugin_load="yes"
4956         plugin_lvm="yes"
4957         plugin_memory="yes"
4958         plugin_nfs="yes"
4959         plugin_numa="yes"
4960         plugin_processes="yes"
4961         plugin_protocols="yes"
4962         plugin_serial="yes"
4963         plugin_swap="yes"
4964         plugin_tcpconns="yes"
4965         plugin_thermal="yes"
4966         plugin_uptime="yes"
4967         plugin_vmem="yes"
4968         plugin_vserver="yes"
4969         plugin_wireless="yes"
4970
4971         if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
4972         then
4973                 plugin_ipvs="yes"
4974         fi
4975 fi
4976
4977 if test "x$ac_system" = "xOpenBSD"
4978 then
4979         plugin_tcpconns="yes"
4980 fi
4981
4982 # Mac OS X devices
4983 if test "x$with_libiokit" = "xyes"
4984 then
4985         plugin_battery="yes"
4986         plugin_disk="yes"
4987 fi
4988
4989 # AIX
4990
4991 if test "x$ac_system" = "xAIX"
4992 then
4993         plugin_tcpconns="yes"
4994 fi
4995
4996 # FreeBSD
4997
4998 if test "x$ac_system" = "xFreeBSD"
4999 then
5000         plugin_zfs_arc="yes"
5001 fi
5002
5003
5004 if test "x$with_perfstat" = "xyes"
5005 then
5006         plugin_cpu="yes"
5007         plugin_contextswitch="yes"
5008         plugin_disk="yes"
5009         plugin_memory="yes"
5010         plugin_swap="yes"
5011         plugin_interface="yes"
5012         plugin_load="yes"
5013         plugin_uptime="yes"
5014 fi
5015
5016 if test "x$with_procinfo" = "xyes"
5017 then
5018         plugin_processes="yes"
5019 fi
5020
5021 # Solaris
5022 if test "x$with_kstat" = "xyes"
5023 then
5024         plugin_nfs="yes"
5025         plugin_processes="yes"
5026         plugin_uptime="yes"
5027         plugin_zfs_arc="yes"
5028 fi
5029
5030 if test "x$with_devinfo$with_kstat" = "xyesyes"
5031 then
5032         plugin_cpu="yes"
5033         plugin_disk="yes"
5034         plugin_interface="yes"
5035         plugin_memory="yes"
5036         plugin_tape="yes"
5037 fi
5038
5039 # libstatgrab
5040 if test "x$with_libstatgrab" = "xyes"
5041 then
5042         plugin_cpu="yes"
5043         plugin_disk="yes"
5044         plugin_interface="yes"
5045         plugin_load="yes"
5046         plugin_memory="yes"
5047         plugin_swap="yes"
5048         plugin_users="yes"
5049 fi
5050
5051 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
5052 then
5053         plugin_ascent="yes"
5054         if test "x$have_strptime" = "xyes"
5055         then
5056                 plugin_bind="yes"
5057         fi
5058 fi
5059
5060 if test "x$with_libopenipmipthread" = "xyes"
5061 then
5062         plugin_ipmi="yes"
5063 fi
5064
5065 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
5066 then
5067         plugin_curl_json="yes"
5068 fi
5069
5070 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
5071 then
5072         plugin_curl_xml="yes"
5073 fi
5074
5075 if test "x$have_processor_info" = "xyes"
5076 then
5077         plugin_cpu="yes"
5078 fi
5079 if test "x$have_sysctl" = "xyes"
5080 then
5081         plugin_cpu="yes"
5082         plugin_memory="yes"
5083         plugin_uptime="yes"
5084         if test "x$ac_system" = "xDarwin"
5085         then
5086                 plugin_swap="yes"
5087         fi
5088 fi
5089 if test "x$have_sysctlbyname" = "xyes"
5090 then
5091         plugin_contextswitch="yes"
5092         plugin_cpu="yes"
5093         plugin_memory="yes"
5094         plugin_tcpconns="yes"
5095 fi
5096
5097 # Df plugin: Check if we know how to determine mount points first.
5098 #if test "x$have_listmntent" = "xyes"; then
5099 #       plugin_df="yes"
5100 #fi
5101 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
5102 then
5103         plugin_df="yes"
5104 fi
5105 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
5106 then
5107         plugin_df="yes"
5108 fi
5109 #if test "x$have_getmntent" = "xseq"
5110 #then
5111 #       plugin_df="yes"
5112 #fi
5113 if test "x$c_cv_have_one_getmntent" = "xyes"
5114 then
5115         plugin_df="yes"
5116 fi
5117
5118 if test "x$c_cv_have_getmntent_r" = "xyes"
5119 then
5120         plugin_df="yes"
5121 fi
5122
5123 # Df plugin: Check if we have either `statfs' or `statvfs' second.
5124 if test "x$plugin_df" = "xyes"
5125 then
5126         plugin_df="no"
5127         if test "x$have_statfs" = "xyes"
5128         then
5129                 plugin_df="yes"
5130         fi
5131         if test "x$have_statvfs" = "xyes"
5132         then
5133                 plugin_df="yes"
5134         fi
5135 fi
5136
5137 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
5138 then
5139         plugin_ethstat="yes"
5140 fi
5141
5142 if test "x$have_getifaddrs" = "xyes"
5143 then
5144         plugin_interface="yes"
5145 fi
5146
5147 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
5148 then
5149         plugin_libvirt="yes"
5150 fi
5151
5152 if test "x$have_getloadavg" = "xyes"
5153 then
5154         plugin_load="yes"
5155 fi
5156
5157 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
5158 then
5159         plugin_perl="yes"
5160 fi
5161
5162 # Mac OS X memory interface
5163 if test "x$have_host_statistics" = "xyes"
5164 then
5165         plugin_memory="yes"
5166 fi
5167
5168 if test "x$have_termios_h" = "xyes"
5169 then
5170         plugin_multimeter="yes"
5171         plugin_ted="yes"
5172 fi
5173
5174 if test "x$have_thread_info" = "xyes"
5175 then
5176         plugin_processes="yes"
5177 fi
5178
5179 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
5180 then
5181         plugin_processes="yes"
5182 fi
5183
5184 if test "x$with_kvm_getswapinfo" = "xyes"
5185 then
5186         plugin_swap="yes"
5187 fi
5188
5189 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
5190 then
5191         plugin_swap="yes"
5192 fi
5193
5194 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
5195 then
5196         plugin_tcpconns="yes"
5197 fi
5198
5199 if test "x$have_getutent" = "xyes"
5200 then
5201         plugin_users="yes"
5202 fi
5203 if test "x$have_getutxent" = "xyes"
5204 then
5205         plugin_users="yes"
5206 fi
5207
5208 m4_divert_once([HELP_ENABLE], [
5209 collectd plugins:])
5210
5211 AC_ARG_ENABLE([all-plugins],
5212                 AS_HELP_STRING([--enable-all-plugins],[enable all plugins (auto by def)]),
5213                 [
5214                  if test "x$enableval" = "xyes"
5215                  then
5216                          enable_all_plugins="yes"
5217                  else if test "x$enableval" = "xauto"
5218                  then
5219                          enable_all_plugins="auto"
5220                  else
5221                          enable_all_plugins="no"
5222                  fi; fi
5223                 ],
5224                 [enable_all_plugins="auto"])
5225
5226 m4_divert_once([HELP_ENABLE], [])
5227
5228 AC_PLUGIN([aggregation], [yes],                [Aggregation plugin])
5229 AC_PLUGIN([amqp],        [$with_librabbitmq],  [AMQP output plugin])
5230 AC_PLUGIN([apache],      [$with_libcurl],      [Apache httpd statistics])
5231 AC_PLUGIN([apcups],      [yes],                [Statistics of UPSes by APC])
5232 AC_PLUGIN([apple_sensors], [$with_libiokit],   [Apple's hardware sensors])
5233 AC_PLUGIN([aquaero],     [$with_libaquaero5],  [Aquaero's hardware sensors])
5234 AC_PLUGIN([ascent],      [$plugin_ascent],     [AscentEmu player statistics])
5235 AC_PLUGIN([battery],     [$plugin_battery],    [Battery statistics])
5236 AC_PLUGIN([bind],        [$plugin_bind],       [ISC Bind nameserver statistics])
5237 AC_PLUGIN([conntrack],   [$plugin_conntrack],  [nf_conntrack statistics])
5238 AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics])
5239 AC_PLUGIN([cpufreq],     [$plugin_cpufreq],    [CPU frequency statistics])
5240 AC_PLUGIN([cpu],         [$plugin_cpu],        [CPU usage statistics])
5241 AC_PLUGIN([csv],         [yes],                [CSV output plugin])
5242 AC_PLUGIN([curl],        [$with_libcurl],      [CURL generic web statistics])
5243 AC_PLUGIN([curl_json],   [$plugin_curl_json],    [CouchDB statistics])
5244 AC_PLUGIN([curl_xml],   [$plugin_curl_xml],    [CURL generic xml statistics])
5245 AC_PLUGIN([cgroups],     [$plugin_cgroups],    [CGroups CPU usage accounting])
5246 AC_PLUGIN([dbi],         [$with_libdbi],       [General database statistics])
5247 AC_PLUGIN([df],          [$plugin_df],         [Filesystem usage statistics])
5248 AC_PLUGIN([disk],        [$plugin_disk],       [Disk usage statistics])
5249 AC_PLUGIN([dns],         [$with_libpcap],      [DNS traffic analysis])
5250 AC_PLUGIN([email],       [yes],                [EMail statistics])
5251 AC_PLUGIN([entropy],     [$plugin_entropy],    [Entropy statistics])
5252 AC_PLUGIN([ethstat],     [$plugin_ethstat],    [Stats from NIC driver])
5253 AC_PLUGIN([exec],        [yes],                [Execution of external programs])
5254 AC_PLUGIN([filecount],   [yes],                [Count files in directories])
5255 AC_PLUGIN([fscache],     [$plugin_fscache],    [fscache statistics])
5256 AC_PLUGIN([gmond],       [$with_libganglia],   [Ganglia plugin])
5257 AC_PLUGIN([hddtemp],     [yes],                [Query hddtempd])
5258 AC_PLUGIN([interface],   [$plugin_interface],  [Interface traffic statistics])
5259 AC_PLUGIN([ipmi],        [$plugin_ipmi],       [IPMI sensor statistics])
5260 AC_PLUGIN([iptables],    [$with_libiptc],      [IPTables rule counters])
5261 AC_PLUGIN([ipvs],        [$plugin_ipvs],       [IPVS connection statistics])
5262 AC_PLUGIN([irq],         [$plugin_irq],        [IRQ statistics])
5263 AC_PLUGIN([java],        [$with_java],         [Embed the Java Virtual Machine])
5264 AC_PLUGIN([libvirt],     [$plugin_libvirt],    [Virtual machine statistics])
5265 AC_PLUGIN([load],        [$plugin_load],       [System load])
5266 AC_PLUGIN([logfile],     [yes],                [File logging plugin])
5267 AC_PLUGIN([lpar],        [$with_perfstat],     [AIX logical partitions statistics])
5268 AC_PLUGIN([lvm],         [$with_liblvm2app],   [LVM statistics])
5269 AC_PLUGIN([madwifi],     [$have_linux_wireless_h], [Madwifi wireless statistics])
5270 AC_PLUGIN([match_empty_counter], [yes],        [The empty counter match])
5271 AC_PLUGIN([match_hashed], [yes],               [The hashed match])
5272 AC_PLUGIN([match_regex], [yes],                [The regex match])
5273 AC_PLUGIN([match_timediff], [yes],             [The timediff match])
5274 AC_PLUGIN([match_value], [yes],                [The value match])
5275 AC_PLUGIN([mbmon],       [yes],                [Query mbmond])
5276 AC_PLUGIN([md],          [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
5277 AC_PLUGIN([memcachec],   [$with_libmemcached], [memcachec statistics])
5278 AC_PLUGIN([memcached],   [yes],                [memcached statistics])
5279 AC_PLUGIN([memory],      [$plugin_memory],     [Memory usage])
5280 AC_PLUGIN([mic],         [$with_mic],          [Intel Many Integrated Core stats])
5281 AC_PLUGIN([modbus],      [$with_libmodbus],    [Modbus plugin])
5282 AC_PLUGIN([multimeter],  [$plugin_multimeter], [Read multimeter values])
5283 AC_PLUGIN([mysql],       [$with_libmysql],     [MySQL statistics])
5284 AC_PLUGIN([netapp],      [$with_libnetapp],    [NetApp plugin])
5285 AC_PLUGIN([netlink],     [$with_libmnl],       [Enhanced Linux network statistics])
5286 AC_PLUGIN([network],     [yes],                [Network communication plugin])
5287 AC_PLUGIN([nfs],         [$plugin_nfs],        [NFS statistics])
5288 AC_PLUGIN([nginx],       [$with_libcurl],      [nginx statistics])
5289 AC_PLUGIN([notify_desktop], [$with_libnotify], [Desktop notifications])
5290 AC_PLUGIN([notify_email], [$with_libesmtp],    [Email notifier])
5291 AC_PLUGIN([ntpd],        [yes],                [NTPd statistics])
5292 AC_PLUGIN([numa],        [$plugin_numa],       [NUMA virtual memory statistics])
5293 AC_PLUGIN([nut],         [$with_libupsclient], [Network UPS tools statistics])
5294 AC_PLUGIN([olsrd],       [yes],                [olsrd statistics])
5295 AC_PLUGIN([onewire],     [$with_libowcapi],    [OneWire sensor statistics])
5296 AC_PLUGIN([openvpn],     [yes],                [OpenVPN client statistics])
5297 AC_PLUGIN([oracle],      [$with_oracle],       [Oracle plugin])
5298 AC_PLUGIN([perl],        [$plugin_perl],       [Embed a Perl interpreter])
5299 AC_PLUGIN([pf],          [$have_net_pfvar_h],  [BSD packet filter (PF) statistics])
5300 # FIXME: Check for libevent, too.
5301 AC_PLUGIN([pinba],       [$have_protoc_c],     [Pinba statistics])
5302 AC_PLUGIN([ping],        [$with_liboping],     [Network latency statistics])
5303 AC_PLUGIN([postgresql],  [$with_libpq],        [PostgreSQL database statistics])
5304 AC_PLUGIN([powerdns],    [yes],                [PowerDNS statistics])
5305 AC_PLUGIN([processes],   [$plugin_processes],  [Process statistics])
5306 AC_PLUGIN([protocols],   [$plugin_protocols],  [Protocol (IP, TCP, ...) statistics])
5307 AC_PLUGIN([python],      [$with_python],       [Embed a Python interpreter])
5308 AC_PLUGIN([redis],       [$with_libcredis],    [Redis plugin])
5309 AC_PLUGIN([routeros],    [$with_librouteros],  [RouterOS plugin])
5310 AC_PLUGIN([rrdcached],   [$librrd_rrdc_update], [RRDTool output plugin])
5311 AC_PLUGIN([rrdtool],     [$with_librrd],       [RRDTool output plugin])
5312 AC_PLUGIN([sensors],     [$with_libsensors],   [lm_sensors statistics])
5313 AC_PLUGIN([serial],      [$plugin_serial],     [serial port traffic])
5314 AC_PLUGIN([sigrok],      [$with_libsigrok],    [sigrok acquisition sources])
5315 AC_PLUGIN([snmp],        [$with_libnetsnmp],   [SNMP querying plugin])
5316 AC_PLUGIN([statsd],      [yes],                [StatsD plugin])
5317 AC_PLUGIN([swap],        [$plugin_swap],       [Swap usage statistics])
5318 AC_PLUGIN([syslog],      [$have_syslog],       [Syslog logging plugin])
5319 AC_PLUGIN([table],       [yes],                [Parsing of tabular data])
5320 AC_PLUGIN([tail],        [yes],                [Parsing of logfiles])
5321 AC_PLUGIN([tail_csv],    [yes],                [Parsing of CSV files])
5322 AC_PLUGIN([tape],        [$plugin_tape],       [Tape drive statistics])
5323 AC_PLUGIN([target_notification], [yes],        [The notification target])
5324 AC_PLUGIN([target_replace], [yes],             [The replace target])
5325 AC_PLUGIN([target_scale],[yes],                [The scale target])
5326 AC_PLUGIN([target_set],  [yes],                [The set target])
5327 AC_PLUGIN([target_v5upgrade], [yes],           [The v5upgrade target])
5328 AC_PLUGIN([tcpconns],    [$plugin_tcpconns],   [TCP connection statistics])
5329 AC_PLUGIN([teamspeak2],  [yes],                [TeamSpeak2 server statistics])
5330 AC_PLUGIN([ted],         [$plugin_ted],        [Read The Energy Detective values])
5331 AC_PLUGIN([thermal],     [$plugin_thermal],    [Linux ACPI thermal zone statistics])
5332 AC_PLUGIN([threshold],   [yes],                [Threshold checking plugin])
5333 AC_PLUGIN([tokyotyrant], [$with_libtokyotyrant],  [TokyoTyrant database statistics])
5334 AC_PLUGIN([unixsock],    [yes],                [Unixsock communication plugin])
5335 AC_PLUGIN([uptime],      [$plugin_uptime],     [Uptime statistics])
5336 AC_PLUGIN([users],       [$plugin_users],      [User statistics])
5337 AC_PLUGIN([uuid],        [yes],                [UUID as hostname plugin])
5338 AC_PLUGIN([varnish],     [$with_libvarnish],   [Varnish cache statistics])
5339 AC_PLUGIN([vmem],        [$plugin_vmem],       [Virtual memory statistics])
5340 AC_PLUGIN([vserver],     [$plugin_vserver],    [Linux VServer statistics])
5341 AC_PLUGIN([wireless],    [$plugin_wireless],   [Wireless statistics])
5342 AC_PLUGIN([write_graphite], [yes],             [Graphite / Carbon output plugin])
5343 AC_PLUGIN([write_http],  [$with_libcurl],      [HTTP output plugin])
5344 AC_PLUGIN([write_mongodb], [$with_libmongoc],  [MongoDB output plugin])
5345 AC_PLUGIN([write_redis], [$with_libcredis],    [Redis output plugin])
5346 AC_PLUGIN([write_riemann], [$have_protoc_c],   [Riemann output plugin])
5347 AC_PLUGIN([xmms],        [$with_libxmms],      [XMMS statistics])
5348 AC_PLUGIN([zfs_arc],     [$plugin_zfs_arc],    [ZFS ARC statistics])
5349
5350 dnl Default configuration file
5351 # Load either syslog or logfile
5352 LOAD_PLUGIN_SYSLOG=""
5353 LOAD_PLUGIN_LOGFILE=""
5354
5355 AC_MSG_CHECKING([which default log plugin to load])
5356 default_log_plugin="none"
5357 if test "x$enable_syslog" = "xyes"
5358 then
5359         default_log_plugin="syslog"
5360 else
5361         LOAD_PLUGIN_SYSLOG="##"
5362 fi
5363
5364 if test "x$enable_logfile" = "xyes"
5365 then
5366         if test "x$default_log_plugin" = "xnone"
5367         then
5368                 default_log_plugin="logfile"
5369         else
5370                 LOAD_PLUGIN_LOGFILE="#"
5371         fi
5372 else
5373         LOAD_PLUGIN_LOGFILE="##"
5374 fi
5375 AC_MSG_RESULT([$default_log_plugin])
5376
5377 AC_SUBST(LOAD_PLUGIN_SYSLOG)
5378 AC_SUBST(LOAD_PLUGIN_LOGFILE)
5379
5380 DEFAULT_LOG_LEVEL="info"
5381 if test "x$enable_debug" = "xyes"
5382 then
5383         DEFAULT_LOG_LEVEL="debug"
5384 fi
5385 AC_SUBST(DEFAULT_LOG_LEVEL)
5386
5387 # Load only one of rrdtool, network, csv in the default config.
5388 LOAD_PLUGIN_RRDTOOL=""
5389 LOAD_PLUGIN_NETWORK=""
5390 LOAD_PLUGIN_CSV=""
5391
5392 AC_MSG_CHECKING([which default write plugin to load])
5393 default_write_plugin="none"
5394 if test "x$enable_rrdtool" = "xyes"
5395 then
5396         default_write_plugin="rrdtool"
5397 else
5398         LOAD_PLUGIN_RRDTOOL="##"
5399 fi
5400
5401 if test "x$enable_network" = "xyes"
5402 then
5403         if test "x$default_write_plugin" = "xnone"
5404         then
5405                 default_write_plugin="network"
5406         else
5407                 LOAD_PLUGIN_NETWORK="#"
5408         fi
5409 else
5410         LOAD_PLUGIN_NETWORK="##"
5411 fi
5412
5413 if test "x$enable_csv" = "xyes"
5414 then
5415         if test "x$default_write_plugin" = "xnone"
5416         then
5417                 default_write_plugin="csv"
5418         else
5419                 LOAD_PLUGIN_CSV="#"
5420         fi
5421 else
5422         LOAD_PLUGIN_CSV="##"
5423 fi
5424 AC_MSG_RESULT([$default_write_plugin])
5425
5426 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
5427 AC_SUBST(LOAD_PLUGIN_NETWORK)
5428 AC_SUBST(LOAD_PLUGIN_CSV)
5429
5430 dnl ip_vs.h
5431 if test "x$ac_system" = "xLinux" \
5432         && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
5433 then
5434         enable_ipvs="$enable_ipvs (ip_vs.h not found)"
5435 fi
5436
5437 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
5438 then
5439         enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
5440 fi
5441
5442 dnl Perl bindings
5443 PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
5444 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
5445 [
5446         if test "x$withval" != "xno" && test "x$withval" != "xyes"
5447         then
5448                 PERL_BINDINGS_OPTIONS="$withval"
5449                 with_perl_bindings="yes"
5450         else
5451                 with_perl_bindings="$withval"
5452         fi
5453 ],
5454 [
5455         if test -n "$perl_interpreter"
5456         then
5457                 with_perl_bindings="yes"
5458         else
5459                 with_perl_bindings="no (no perl interpreter found)"
5460         fi
5461 ])
5462 if test "x$with_perl_bindings" = "xyes"
5463 then
5464         PERL_BINDINGS="perl"
5465 else
5466         PERL_BINDINGS=""
5467 fi
5468 AC_SUBST(PERL_BINDINGS)
5469 AC_SUBST(PERL_BINDINGS_OPTIONS)
5470
5471 dnl libcollectdclient
5472 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
5473 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
5474 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
5475
5476 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
5477
5478 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
5479
5480 AC_SUBST(LCC_VERSION_MAJOR)
5481 AC_SUBST(LCC_VERSION_MINOR)
5482 AC_SUBST(LCC_VERSION_PATCH)
5483 AC_SUBST(LCC_VERSION_EXTRA)
5484 AC_SUBST(LCC_VERSION_STRING)
5485
5486 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
5487
5488 AC_CONFIG_FILES([Makefile src/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile])
5489 AC_OUTPUT
5490
5491 if test "x$with_librrd" = "xyes" \
5492         && test "x$librrd_threadsafe" != "xyes"
5493 then
5494         with_librrd="yes (warning: librrd is not thread-safe)"
5495 fi
5496
5497 if test "x$with_libperl" = "xyes"
5498 then
5499         with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
5500 else
5501         enable_perl="no (needs libperl)"
5502 fi
5503
5504 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
5505 then
5506         enable_perl="no (libperl doesn't support ithreads)"
5507 fi
5508
5509 if test "x$with_perl_bindings" = "xyes" \
5510         && test "x$PERL_BINDINGS_OPTIONS" != "x"
5511 then
5512         with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
5513 fi
5514
5515 cat <<EOF;
5516
5517 Configuration:
5518   Libraries:
5519     intel mic . . . . . . $with_mic
5520     libaquaero5 . . . . . $with_libaquaero5
5521     libcredis . . . . . . $with_libcredis
5522     libcurl . . . . . . . $with_libcurl
5523     libdbi  . . . . . . . $with_libdbi
5524     libesmtp  . . . . . . $with_libesmtp
5525     libganglia  . . . . . $with_libganglia
5526     libgcrypt . . . . . . $with_libgcrypt
5527     libhal  . . . . . . . $with_libhal
5528     libiokit  . . . . . . $with_libiokit
5529     libiptc . . . . . . . $with_libiptc
5530     libjvm  . . . . . . . $with_java
5531     libkstat  . . . . . . $with_kstat
5532     libkvm  . . . . . . . $with_libkvm
5533     liblvm2app  . . . . . $with_liblvm2app
5534     libmemcached  . . . . $with_libmemcached
5535     libmnl  . . . . . . . $with_libmnl
5536     libmodbus . . . . . . $with_libmodbus
5537     libmongoc . . . . . . $with_libmongoc
5538     libmysql  . . . . . . $with_libmysql
5539     libnetapp . . . . . . $with_libnetapp
5540     libnetsnmp  . . . . . $with_libnetsnmp
5541     libnotify . . . . . . $with_libnotify
5542     liboconfig  . . . . . $with_liboconfig
5543     libopenipmi . . . . . $with_libopenipmipthread
5544     liboping  . . . . . . $with_liboping
5545     libowcapi . . . . . . $with_libowcapi
5546     libpcap . . . . . . . $with_libpcap
5547     libperfstat . . . . . $with_perfstat
5548     libperl . . . . . . . $with_libperl
5549     libpq . . . . . . . . $with_libpq
5550     libpthread  . . . . . $with_libpthread
5551     librabbitmq . . . . . $with_librabbitmq
5552     librouteros . . . . . $with_librouteros
5553     librrd  . . . . . . . $with_librrd
5554     libsensors  . . . . . $with_libsensors
5555     libsigrok   . . . . . $with_libsigrok
5556     libstatgrab . . . . . $with_libstatgrab
5557     libtokyotyrant  . . . $with_libtokyotyrant
5558     libupsclient  . . . . $with_libupsclient
5559     libvarnish  . . . . . $with_libvarnish
5560     libvirt . . . . . . . $with_libvirt
5561     libxml2 . . . . . . . $with_libxml2
5562     libxmms . . . . . . . $with_libxmms
5563     libyajl . . . . . . . $with_libyajl
5564     oracle  . . . . . . . $with_oracle
5565     protobuf-c  . . . . . $have_protoc_c
5566     python  . . . . . . . $with_python
5567
5568   Features:
5569     daemon mode . . . . . $enable_daemon
5570     debug . . . . . . . . $enable_debug
5571
5572   Bindings:
5573     perl  . . . . . . . . $with_perl_bindings
5574
5575   Modules:
5576     aggregation . . . . . $enable_aggregation
5577     amqp    . . . . . . . $enable_amqp
5578     apache  . . . . . . . $enable_apache
5579     apcups  . . . . . . . $enable_apcups
5580     aquaero . . . . . . . $enable_aquaero
5581     apple_sensors . . . . $enable_apple_sensors
5582     ascent  . . . . . . . $enable_ascent
5583     battery . . . . . . . $enable_battery
5584     bind  . . . . . . . . $enable_bind
5585     conntrack . . . . . . $enable_conntrack
5586     contextswitch . . . . $enable_contextswitch
5587     cgroups . . . . . . . $enable_cgroups
5588     cpu . . . . . . . . . $enable_cpu
5589     cpufreq . . . . . . . $enable_cpufreq
5590     csv . . . . . . . . . $enable_csv
5591     curl  . . . . . . . . $enable_curl
5592     curl_json . . . . . . $enable_curl_json
5593     curl_xml  . . . . . . $enable_curl_xml
5594     dbi . . . . . . . . . $enable_dbi
5595     df  . . . . . . . . . $enable_df
5596     disk  . . . . . . . . $enable_disk
5597     dns . . . . . . . . . $enable_dns
5598     email . . . . . . . . $enable_email
5599     entropy . . . . . . . $enable_entropy
5600     ethstat . . . . . . . $enable_ethstat
5601     exec  . . . . . . . . $enable_exec
5602     filecount . . . . . . $enable_filecount
5603     fscache . . . . . . . $enable_fscache
5604     gmond . . . . . . . . $enable_gmond
5605     hddtemp . . . . . . . $enable_hddtemp
5606     interface . . . . . . $enable_interface
5607     ipmi  . . . . . . . . $enable_ipmi
5608     iptables  . . . . . . $enable_iptables
5609     ipvs  . . . . . . . . $enable_ipvs
5610     irq . . . . . . . . . $enable_irq
5611     java  . . . . . . . . $enable_java
5612     libvirt . . . . . . . $enable_libvirt
5613     load  . . . . . . . . $enable_load
5614     logfile . . . . . . . $enable_logfile
5615     lpar  . . . . . . . . $enable_lpar
5616     lvm . . . . . . . . . $enable_lvm
5617     madwifi . . . . . . . $enable_madwifi
5618     match_empty_counter . $enable_match_empty_counter
5619     match_hashed  . . . . $enable_match_hashed
5620     match_regex . . . . . $enable_match_regex
5621     match_timediff  . . . $enable_match_timediff
5622     match_value . . . . . $enable_match_value
5623     mbmon . . . . . . . . $enable_mbmon
5624     md  . . . . . . . . . $enable_md
5625     memcachec . . . . . . $enable_memcachec
5626     memcached . . . . . . $enable_memcached
5627     memory  . . . . . . . $enable_memory
5628     mic . . . . . . . . . $enable_mic
5629     modbus  . . . . . . . $enable_modbus
5630     multimeter  . . . . . $enable_multimeter
5631     mysql . . . . . . . . $enable_mysql
5632     netapp  . . . . . . . $enable_netapp
5633     netlink . . . . . . . $enable_netlink
5634     network . . . . . . . $enable_network
5635     nfs . . . . . . . . . $enable_nfs
5636     nginx . . . . . . . . $enable_nginx
5637     notify_desktop  . . . $enable_notify_desktop
5638     notify_email  . . . . $enable_notify_email
5639     ntpd  . . . . . . . . $enable_ntpd
5640     numa  . . . . . . . . $enable_numa
5641     nut . . . . . . . . . $enable_nut
5642     olsrd . . . . . . . . $enable_olsrd
5643     onewire . . . . . . . $enable_onewire
5644     openvpn . . . . . . . $enable_openvpn
5645     oracle  . . . . . . . $enable_oracle
5646     perl  . . . . . . . . $enable_perl
5647     pf  . . . . . . . . . $enable_pf
5648     pinba . . . . . . . . $enable_pinba
5649     ping  . . . . . . . . $enable_ping
5650     postgresql  . . . . . $enable_postgresql
5651     powerdns  . . . . . . $enable_powerdns
5652     processes . . . . . . $enable_processes
5653     protocols . . . . . . $enable_protocols
5654     python  . . . . . . . $enable_python
5655     redis . . . . . . . . $enable_redis
5656     routeros  . . . . . . $enable_routeros
5657     rrdcached . . . . . . $enable_rrdcached
5658     rrdtool . . . . . . . $enable_rrdtool
5659     sensors . . . . . . . $enable_sensors
5660     serial  . . . . . . . $enable_serial
5661     sigrok  . . . . . . . $enable_sigrok
5662     snmp  . . . . . . . . $enable_snmp
5663     statsd  . . . . . . . $enable_statsd
5664     swap  . . . . . . . . $enable_swap
5665     syslog  . . . . . . . $enable_syslog
5666     table . . . . . . . . $enable_table
5667     tail  . . . . . . . . $enable_tail
5668     tail_csv  . . . . . . $enable_tail_csv
5669     tape  . . . . . . . . $enable_tape
5670     target_notification . $enable_target_notification
5671     target_replace  . . . $enable_target_replace
5672     target_scale  . . . . $enable_target_scale
5673     target_set  . . . . . $enable_target_set
5674     target_v5upgrade  . . $enable_target_v5upgrade
5675     tcpconns  . . . . . . $enable_tcpconns
5676     teamspeak2  . . . . . $enable_teamspeak2
5677     ted . . . . . . . . . $enable_ted
5678     thermal . . . . . . . $enable_thermal
5679     threshold . . . . . . $enable_threshold
5680     tokyotyrant . . . . . $enable_tokyotyrant
5681     unixsock  . . . . . . $enable_unixsock
5682     uptime  . . . . . . . $enable_uptime
5683     users . . . . . . . . $enable_users
5684     uuid  . . . . . . . . $enable_uuid
5685     varnish . . . . . . . $enable_varnish
5686     vmem  . . . . . . . . $enable_vmem
5687     vserver . . . . . . . $enable_vserver
5688     wireless  . . . . . . $enable_wireless
5689     write_graphite  . . . $enable_write_graphite
5690     write_http  . . . . . $enable_write_http
5691     write_mongodb . . . . $enable_write_mongodb
5692     write_redis . . . . . $enable_write_redis
5693     write_riemann . . . . $enable_write_riemann
5694     xmms  . . . . . . . . $enable_xmms
5695     zfs_arc . . . . . . . $enable_zfs_arc
5696
5697 EOF
5698
5699 if test "x$dependency_error" = "xyes"; then
5700         AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
5701 fi
5702
5703 if test "x$dependency_warning" = "xyes"; then
5704         AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
5705 fi
5706
5707 # vim: set fdm=marker :