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