Build system: enable the "df" plugin when getmntent_r() is available.
[collectd.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ([2.60])
3 AC_INIT([collectd],[m4_esyscmd(./version-gen.sh)])
4 AC_CONFIG_SRCDIR(src/target_set.c)
5 AC_CONFIG_HEADERS(src/config.h)
6 AC_CONFIG_AUX_DIR([libltdl/config])
7
8 dnl older automake's default of ARFLAGS=cru is noisy on newer binutils;
9 dnl we don't really need the 'u' even in older toolchains.  Then there is
10 dnl older libtool, which spelled it AR_FLAGS
11 m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"])
12
13 m4_ifdef([LT_PACKAGE_VERSION],
14         # libtool >= 2.2
15         [
16          LT_CONFIG_LTDL_DIR([libltdl])
17          LT_INIT([dlopen])
18          LTDL_INIT([convenience])
19          AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.])
20         ]
21 ,
22         # libtool <= 1.5
23         [
24          AC_LIBLTDL_CONVENIENCE
25          AC_SUBST(LTDLINCL)
26          AC_SUBST(LIBLTDL)
27          AC_LIBTOOL_DLOPEN
28          AC_CONFIG_SUBDIRS(libltdl)
29          AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.])
30         ]
31 )
32
33 AM_CONDITIONAL([BUILD_INCLUDED_LTDL], [test "x$LTDLDEPS" != "x"])
34
35 AM_INIT_AUTOMAKE([subdir-objects tar-pax dist-bzip2 no-dist-gzip foreign])
36 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
37 AC_LANG(C)
38
39 AC_PREFIX_DEFAULT("/opt/collectd")
40
41 AC_SYS_LARGEFILE
42
43 #
44 # Checks for programs.
45 #
46 AC_PROG_CC_C99([],
47   [AC_MSG_ERROR([No compiler found that supports C99])]
48 )
49 AC_PROG_CXX
50 AC_PROG_CPP
51 AC_PROG_EGREP
52 AC_PROG_INSTALL
53 AC_PROG_LN_S
54 AC_PROG_MAKE_SET
55 AM_PROG_CC_C_O
56 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
57
58 AC_DISABLE_STATIC
59 AC_PROG_LIBTOOL
60 AC_PROG_LEX
61 AC_PROG_YACC
62
63 AC_PATH_PROG([VALGRIND], [valgrind])
64
65 # Warn when pkg.m4 is missing
66 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
67
68 PKG_PROG_PKG_CONFIG
69
70 AC_CACHE_CHECK([if bison is the parser generator],
71         [collectd_cv_prog_bison],
72         [AS_IF([$YACC --version 2>/dev/null | $EGREP -q '^bison '],
73                 [collectd_cv_prog_bison=yes], [collectd_cv_prog_bison=no]
74         )]
75 )
76
77 if test "x$collectd_cv_prog_bison" = "xno" && test ! -f "${srcdir}/src/liboconfig/parser.c"
78 then
79         AC_MSG_ERROR([bison is missing and you do not have ${srcdir}/src/liboconfig/parser.c. Please install bison])
80 fi
81
82 AC_ARG_VAR([PROTOC], [path to the protoc binary])
83 AC_PATH_PROG([PROTOC], [protoc])
84 have_protoc3="no"
85 if test "x$PROTOC" != "x"; then
86         AC_MSG_CHECKING([for protoc 3.0.0+])
87         if $PROTOC --version | $EGREP libprotoc.3 >/dev/null; then
88                 protoc3="yes (`$PROTOC --version`)"
89                 have_protoc3="yes"
90         else
91                 protoc3="no (`$PROTOC --version`)"
92         fi
93         AC_MSG_RESULT([$protoc3])
94 fi
95 AM_CONDITIONAL(HAVE_PROTOC3, test "x$have_protoc3" = "xyes")
96
97 AC_ARG_VAR([GRPC_CPP_PLUGIN], [path to the grpc_cpp_plugin binary])
98 AC_PATH_PROG([GRPC_CPP_PLUGIN], [grpc_cpp_plugin])
99 AM_CONDITIONAL(HAVE_GRPC_CPP, test "x$GRPC_CPP_PLUGIN" != "x")
100
101 AC_ARG_VAR([PROTOC_C], [path to the protoc-c binary])
102 AC_PATH_PROG([PROTOC_C], [protoc-c])
103 if test "x$PROTOC_C" = "x"
104 then
105   have_protoc_c="no (protoc-c compiler not found)"
106 else
107   have_protoc_c="yes"
108 fi
109
110 AC_MSG_CHECKING([for kernel type ($host_os)])
111 case $host_os in
112         *linux*)
113         AC_DEFINE([KERNEL_LINUX], 1, [True if program is to be compiled for a Linux kernel])
114         ac_system="Linux"
115         ;;
116         *solaris*)
117         AC_DEFINE([KERNEL_SOLARIS], 1, [True if program is to be compiled for a Solaris kernel])
118         ac_system="Solaris"
119         ;;
120         *darwin*)
121         AC_DEFINE([KERNEL_DARWIN], 1, [True if program is to be compiled for a Darwin kernel])
122         ac_system="Darwin"
123         ;;
124         *openbsd*)
125         AC_DEFINE([KERNEL_OPENBSD], 1, [True if program is to be compiled for an OpenBSD kernel])
126         ac_system="OpenBSD"
127         ;;
128         *netbsd*)
129         AC_DEFINE([KERNEL_NETBSD], 1, [True if program is to be compiled for a NetBSD kernel])
130         ac_system="NetBSD"
131         ;;
132         *aix*)
133         AC_DEFINE([KERNEL_AIX], 1, [True if program is to be compiled for a AIX kernel])
134         ac_system="AIX"
135         ;;
136         *freebsd*)
137         AC_DEFINE([KERNEL_FREEBSD], 1, [True if program is to be compiled for a FreeBSD kernel])
138         ac_system="FreeBSD"
139         ;;
140         *)
141         ac_system="unknown"
142 esac
143 AC_MSG_RESULT([$ac_system])
144
145 AM_CONDITIONAL([BUILD_AIX], [test "x$ac_system" = "xAIX"])
146 AM_CONDITIONAL([BUILD_DARWIN], [test "x$ac_system" = "xDarwin"])
147 AM_CONDITIONAL([BUILD_FREEBSD], [test "x$ac_system" = "xFreeBSD"])
148 AM_CONDITIONAL([BUILD_LINUX], [test "x$ac_system" = "xLinux"])
149 AM_CONDITIONAL([BUILD_OPENBSD], [test "x$ac_system" = "xOpenBSD"])
150 AM_CONDITIONAL([BUILD_SOLARIS], [test "x$ac_system" = "xSolaris"])
151
152 if test "x$ac_system" = "xLinux"
153 then
154         AC_ARG_VAR([KERNEL_DIR], [path to Linux kernel sources])
155         if test -z "$KERNEL_DIR"
156         then
157                 KERNEL_DIR="/lib/modules/`uname -r`/source"
158         fi
159
160         KERNEL_CFLAGS="-I$KERNEL_DIR/include"
161         AC_SUBST(KERNEL_CFLAGS)
162 fi
163
164 if test "x$ac_system" = "xSolaris"
165 then
166         AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to enforce POSIX thread semantics under Solaris.])
167         AC_DEFINE(_REENTRANT,               1, [Define to enable reentrancy interfaces.])
168
169         AC_MSG_CHECKING([whether compiler builds 64bit binaries])
170         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
171                            #ifndef _LP64
172                            # error "Compiler not in 64bit mode."
173                            #endif
174                            ])],
175                            [AC_MSG_RESULT([yes])],
176                            [
177                             AC_MSG_RESULT([no])
178                             AC_MSG_NOTICE([Solaris detected. Please consider building a 64-bit binary.])
179                            ])
180 fi
181
182 if test "x$ac_system" = "xAIX"
183 then
184         AC_DEFINE(_THREAD_SAFE_ERRNO, 1, [Define to use the thread-safe version of errno under AIX.])
185 fi
186
187 # Where to install .pc files.
188 pkgconfigdir="${libdir}/pkgconfig"
189 AC_SUBST(pkgconfigdir)
190
191 # Check for standards compliance mode
192 AC_ARG_ENABLE(standards,
193               AS_HELP_STRING([--enable-standards], [Enable standards compliance mode]),
194               [enable_standards="$enableval"],
195               [enable_standards="no"])
196 if test "x$enable_standards" = "xyes"
197 then
198         AC_DEFINE(_ISOC99_SOURCE,        1, [Define to enforce ISO C99 compliance.])
199         AC_DEFINE(_POSIX_C_SOURCE, 200809L, [Define to enforce POSIX.1-2008 compliance.])
200         AC_DEFINE(_XOPEN_SOURCE,       700, [Define to enforce X/Open 7 (XSI) compliance.])
201         AC_DEFINE(_REENTRANT,            1, [Define to enable reentrancy interfaces.])
202         if test "x$GCC" = "xyes"
203         then
204                 CFLAGS="$CFLAGS -std=c99"
205         fi
206 fi
207 AM_CONDITIONAL(BUILD_FEATURE_STANDARDS, test "x$enable_standards" = "xyes")
208
209 #
210 # Checks for header files.
211 #
212 AC_HEADER_STDC
213 AC_HEADER_SYS_WAIT
214 AC_HEADER_DIRENT
215 AC_HEADER_STDBOOL
216
217 AC_CHECK_HEADERS([ \
218   arpa/inet.h \
219   assert.h \
220   ctype.h \
221   endian.h \
222   errno.h \
223   fcntl.h \
224   fnmatch.h \
225   fs_info.h \
226   fshelp.h \
227   grp.h \
228   kstat.h \
229   kvm.h \
230   libgen.h \
231   limits.h \
232   locale.h \
233   math.h \
234   mntent.h \
235   mnttab.h \
236   netdb.h \
237   paths.h \
238   poll.h \
239   pthread_np.h \
240   pwd.h \
241   regex.h \
242   signal.h \
243   stdarg.h \
244   stdio.h \
245   sys/fs_types.h \
246   sys/fstyp.h \
247   sys/ioctl.h \
248   sys/isa_defs.h \
249   sys/mntent.h \
250   sys/mnttab.h \
251   sys/param.h \
252   sys/resource.h \
253   sys/select.h \
254   sys/socket.h \
255   sys/statfs.h \
256   sys/statvfs.h \
257   sys/types.h \
258   sys/un.h \
259   sys/vfs.h \
260   sys/vfstab.h \
261   sys/vmmeter.h \
262   syslog.h \
263   wordexp.h \
264 ])
265
266 # For entropy plugin on newer NetBSD
267 AC_CHECK_HEADERS(sys/rndio.h, [], [],
268 [#if HAVE_SYS_TYPES_H
269 # include <sys/types.h>
270 #endif
271 #if HAVE_SYS_IOCTL_H
272 # include <sys/ioctl.h>
273 #endif
274 #if HAVE_SYS_PARAM_H
275 # include <sys/param.h>
276 #endif
277 ])
278
279 # For ping library
280 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
281 [#if HAVE_STDINT_H
282 # include <stdint.h>
283 #endif
284 #if HAVE_SYS_TYPES_H
285 # include <sys/types.h>
286 #endif
287 ])
288 AC_CHECK_HEADERS(netinet/in.h, [], [],
289 [#if HAVE_STDINT_H
290 # include <stdint.h>
291 #endif
292 #if HAVE_SYS_TYPES_H
293 # include <sys/types.h>
294 #endif
295 #if HAVE_NETINET_IN_SYSTM_H
296 # include <netinet/in_systm.h>
297 #endif
298 ])
299 AC_CHECK_HEADERS(netinet/ip.h, [], [],
300 [#if HAVE_STDINT_H
301 # include <stdint.h>
302 #endif
303 #if HAVE_SYS_TYPES_H
304 # include <sys/types.h>
305 #endif
306 #if HAVE_NETINET_IN_SYSTM_H
307 # include <netinet/in_systm.h>
308 #endif
309 #if HAVE_NETINET_IN_H
310 # include <netinet/in.h>
311 #endif
312 ])
313 AC_CHECK_HEADERS(netinet/ip_icmp.h, [], [],
314 [#if HAVE_STDINT_H
315 # include <stdint.h>
316 #endif
317 #if HAVE_SYS_TYPES_H
318 # include <sys/types.h>
319 #endif
320 #if HAVE_NETINET_IN_SYSTM_H
321 # include <netinet/in_systm.h>
322 #endif
323 #if HAVE_NETINET_IN_H
324 # include <netinet/in.h>
325 #endif
326 #if HAVE_NETINET_IP_H
327 # include <netinet/ip.h>
328 #endif
329 ])
330 AC_CHECK_HEADERS(netinet/ip_var.h, [], [],
331 [#if HAVE_STDINT_H
332 # include <stdint.h>
333 #endif
334 #if HAVE_SYS_TYPES_H
335 # include <sys/types.h>
336 #endif
337 #if HAVE_NETINET_IN_SYSTM_H
338 # include <netinet/in_systm.h>
339 #endif
340 #if HAVE_NETINET_IN_H
341 # include <netinet/in.h>
342 #endif
343 #if HAVE_NETINET_IP_H
344 # include <netinet/ip.h>
345 #endif
346 ])
347 AC_CHECK_HEADERS(netinet/ip6.h, [], [],
348 [#if HAVE_STDINT_H
349 # include <stdint.h>
350 #endif
351 #if HAVE_SYS_TYPES_H
352 # include <sys/types.h>
353 #endif
354 #if HAVE_NETINET_IN_SYSTM_H
355 # include <netinet/in_systm.h>
356 #endif
357 #if HAVE_NETINET_IN_H
358 # include <netinet/in.h>
359 #endif
360 ])
361 AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
362 [#if HAVE_STDINT_H
363 # include <stdint.h>
364 #endif
365 #if HAVE_SYS_TYPES_H
366 # include <sys/types.h>
367 #endif
368 #if HAVE_NETINET_IN_SYSTM_H
369 # include <netinet/in_systm.h>
370 #endif
371 #if HAVE_NETINET_IN_H
372 # include <netinet/in.h>
373 #endif
374 #if HAVE_NETINET_IP6_H
375 # include <netinet/ip6.h>
376 #endif
377 ])
378 AC_CHECK_HEADERS(netinet/tcp.h, [], [],
379 [#if HAVE_STDINT_H
380 # include <stdint.h>
381 #endif
382 #if HAVE_SYS_TYPES_H
383 # include <sys/types.h>
384 #endif
385 #if HAVE_NETINET_IN_SYSTM_H
386 # include <netinet/in_systm.h>
387 #endif
388 #if HAVE_NETINET_IN_H
389 # include <netinet/in.h>
390 #endif
391 #if HAVE_NETINET_IP_H
392 # include <netinet/ip.h>
393 #endif
394 ])
395 AC_CHECK_HEADERS(netinet/udp.h, [], [],
396 [#if HAVE_STDINT_H
397 # include <stdint.h>
398 #endif
399 #if HAVE_SYS_TYPES_H
400 # include <sys/types.h>
401 #endif
402 #if HAVE_NETINET_IN_SYSTM_H
403 # include <netinet/in_systm.h>
404 #endif
405 #if HAVE_NETINET_IN_H
406 # include <netinet/in.h>
407 #endif
408 #if HAVE_NETINET_IP_H
409 # include <netinet/ip.h>
410 #endif
411 ])
412
413 have_ip6_ext="no"
414 AC_CHECK_TYPES([struct ip6_ext], [have_ip6_ext="yes"], [have_ip6_ext="no"],
415 [#if HAVE_STDINT_H
416 # include <stdint.h>
417 #endif
418 #if HAVE_SYS_TYPES_H
419 # include <sys/types.h>
420 #endif
421 #if HAVE_NETINET_IN_SYSTM_H
422 # include <netinet/in_systm.h>
423 #endif
424 #if HAVE_NETINET_IN_H
425 # include <netinet/in.h>
426 #endif
427 #if HAVE_NETINET_IP6_H
428 # include <netinet/ip6.h>
429 #endif
430 ])
431
432 if test "x$have_ip6_ext" = "xno"; then
433         SAVE_CFLAGS="$CFLAGS"
434         CFLAGS="$CFLAGS -DSOLARIS2=8"
435
436         AC_CHECK_TYPES([struct ip6_ext],
437                        [have_ip6_ext="yes, with -DSOLARIS2=8"],
438                        [have_ip6_ext="no"],
439 [#if HAVE_STDINT_H
440 # include <stdint.h>
441 #endif
442 #if HAVE_SYS_TYPES_H
443 # include <sys/types.h>
444 #endif
445 #if HAVE_NETINET_IN_SYSTM_H
446 # include <netinet/in_systm.h>
447 #endif
448 #if HAVE_NETINET_IN_H
449 # include <netinet/in.h>
450 #endif
451 #if HAVE_NETINET_IP6_H
452 # include <netinet/ip6.h>
453 #endif
454 ])
455
456         if test "x$have_ip6_ext" = "xno"; then
457                 CFLAGS="$SAVE_CFLAGS"
458         fi
459 fi
460
461 # For cpu modules
462 AC_CHECK_HEADERS(sys/dkstat.h)
463 if test "x$ac_system" = "xDarwin"
464 then
465         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)
466         AC_CHECK_HEADERS(CoreFoundation/CoreFoundation.h IOKit/IOKitLib.h IOKit/IOTypes.h IOKit/ps/IOPSKeys.h IOKit/IOBSD.h IOKit/storage/IOBlockStorageDriver.h)
467         # For the battery plugin
468         AC_CHECK_HEADERS(IOKit/ps/IOPowerSources.h, [], [],
469 [
470 #if HAVE_IOKIT_IOKITLIB_H
471 #  include <IOKit/IOKitLib.h>
472 #endif
473 #if HAVE_IOKIT_IOTYPES_H
474 #  include <IOKit/IOTypes.h>
475 #endif
476 ])
477
478 fi
479
480 AC_CHECK_HEADERS(sys/sysctl.h, [], [],
481 [
482 #if HAVE_SYS_TYPES_H
483 #  include <sys/types.h>
484 #endif
485 #if HAVE_SYS_PARAM_H
486 # include <sys/param.h>
487 #endif
488 ])
489
490 AC_MSG_CHECKING([for sysctl kern.cp_times])
491 if test -x /sbin/sysctl
492 then
493         /sbin/sysctl kern.cp_times >/dev/null 2>&1
494         if test $? -eq 0
495         then
496                 AC_MSG_RESULT([yes])
497                 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIMES, 1,
498                 [Define if sysctl supports kern.cp_times])
499         else
500                 AC_MSG_RESULT([no])
501         fi
502 else
503         AC_MSG_RESULT([no])
504 fi
505
506 AC_MSG_CHECKING([for sysctl kern.cp_time])
507 if test -x /sbin/sysctl
508 then
509         /sbin/sysctl kern.cp_time >/dev/null 2>&1
510         if test $? -eq 0
511         then
512                 AC_MSG_RESULT([yes])
513                 AC_DEFINE(HAVE_SYSCTL_KERN_CP_TIME, 1,
514                         [Define if sysctl supports kern.cp_time])
515         else
516                 AC_MSG_RESULT([no])
517         fi
518 else
519         AC_MSG_RESULT([no])
520 fi
521
522 # For hddtemp module
523 AC_CHECK_HEADERS(linux/major.h)
524
525 # For md module (Linux only)
526 if test "x$ac_system" = "xLinux"
527 then
528         AC_CHECK_HEADERS(linux/raid/md_u.h,
529                          [have_linux_raid_md_u_h="yes"],
530                          [have_linux_raid_md_u_h="no"],
531 [
532 #include <sys/ioctl.h>
533 #include <linux/major.h>
534 #include <linux/types.h>
535 ])
536         AC_CHECK_HEADERS([sys/sysmacros.h])
537 else
538         have_linux_raid_md_u_h="no"
539 fi
540
541 # For the wireless module
542 have_linux_wireless_h="no"
543 if test "x$ac_system" = "xLinux"
544 then
545   AC_CHECK_HEADERS(linux/wireless.h,
546                    [have_linux_wireless_h="yes"],
547                    [have_linux_wireless_h="no"],
548 [
549 #include <dirent.h>
550 #include <sys/ioctl.h>
551 #include <sys/socket.h>
552 ])
553 fi
554
555 # For the swap module
556 have_sys_swap_h="yes"
557 AC_CHECK_HEADERS(sys/swap.h vm/anon.h, [], [have_sys_swap_h="no"],
558 [
559 #undef _FILE_OFFSET_BITS
560 #undef _LARGEFILE64_SOURCE
561 #if HAVE_SYS_TYPES_H
562 #  include <sys/types.h>
563 #endif
564 #if HAVE_SYS_PARAM_H
565 # include <sys/param.h>
566 #endif
567 ])
568
569 # For load module
570 # For the processes plugin
571 # For users module
572 AC_CHECK_HEADERS(sys/loadavg.h linux/config.h utmp.h utmpx.h)
573
574 # For interface plugin
575 AC_CHECK_HEADERS(ifaddrs.h)
576 AC_CHECK_HEADERS(net/if.h, [], [],
577 [
578 #if HAVE_SYS_TYPES_H
579 #  include <sys/types.h>
580 #endif
581 #if HAVE_SYS_SOCKET_H
582 #  include <sys/socket.h>
583 #endif
584 ])
585 AC_CHECK_HEADERS(linux/if.h, [], [],
586 [
587 #if HAVE_SYS_TYPES_H
588 #  include <sys/types.h>
589 #endif
590 #if HAVE_SYS_SOCKET_H
591 #  include <sys/socket.h>
592 #endif
593 ])
594 AC_CHECK_HEADERS(linux/inet_diag.h, [], [],
595 [
596 #if HAVE_SYS_TYPES_H
597 #  include <sys/types.h>
598 #endif
599 #if HAVE_SYS_SOCKET_H
600 #  include <sys/socket.h>
601 #endif
602 #if HAVE_LINUX_INET_DIAG_H
603 # include <linux/inet_diag.h>
604 #endif
605 ])
606 AC_CHECK_HEADERS(linux/netdevice.h, [], [],
607 [
608 #if HAVE_SYS_TYPES_H
609 #  include <sys/types.h>
610 #endif
611 #if HAVE_SYS_SOCKET_H
612 #  include <sys/socket.h>
613 #endif
614 #if HAVE_LINUX_IF_H
615 # include <linux/if.h>
616 #endif
617 ])
618
619 # For ethstat module
620 AC_CHECK_HEADERS(linux/sockios.h,
621     [have_linux_sockios_h="yes"],
622     [have_linux_sockios_h="no"],
623     [
624 #if HAVE_SYS_IOCTL_H
625 # include <sys/ioctl.h>
626 #endif
627 #if HAVE_NET_IF_H
628 # include <net/if.h>
629 #endif
630     ])
631 AC_CHECK_HEADERS(linux/ethtool.h,
632     [have_linux_ethtool_h="yes"],
633     [have_linux_ethtool_h="no"],
634     [
635 #if HAVE_SYS_IOCTL_H
636 # include <sys/ioctl.h>
637 #endif
638 #if HAVE_NET_IF_H
639 # include <net/if.h>
640 #endif
641 #if HAVE_LINUX_SOCKIOS_H
642 # include <linux/sockios.h>
643 #endif
644     ])
645
646 # For ipvs module
647 have_linux_ip_vs_h="no"
648 have_net_ip_vs_h="no"
649 have_ip_vs_h="no"
650 ip_vs_h_needs_kernel_cflags="no"
651 if test "x$ac_system" = "xLinux"
652 then
653         AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
654         AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
655         AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
656
657         if test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono" && test -d "$KERNEL_DIR"
658         then
659                 SAVE_CFLAGS="$CFLAGS"
660                 CFLAGS="$CFLAGS $KERNEL_CFLAGS"
661
662                 AC_MSG_NOTICE([Did not find ip_vs.h. Trying again using headers from $KERNEL_DIR.])
663
664                 AC_CHECK_HEADERS(linux/ip_vs.h, [have_linux_ip_vs_h="yes"])
665                 AC_CHECK_HEADERS(net/ip_vs.h, [have_net_ip_vs_h="yes"])
666                 AC_CHECK_HEADERS(ip_vs.h, [have_ip_vs_h="yes"])
667
668                 if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
669                 then
670                         ip_vs_h_needs_kernel_cflags="yes"
671                 fi
672
673                 CFLAGS="$SAVE_CFLAGS"
674         fi
675 fi
676 AM_CONDITIONAL(IP_VS_H_NEEDS_KERNEL_CFLAGS, test "x$ip_vs_h_needs_kernel_cflags" = "xyes")
677
678 # For quota module
679 AC_CHECK_HEADERS(sys/ucred.h, [], [],
680 [
681 #if HAVE_SYS_TYPES_H
682 #  include <sys/types.h>
683 #endif
684 #if HAVE_SYS_PARAM_H
685 # include <sys/param.h>
686 #endif
687 ])
688
689 # For mount interface
690 AC_CHECK_HEADERS(sys/mount.h, [], [],
691 [
692 #if HAVE_SYS_TYPES_H
693 #  include <sys/types.h>
694 #endif
695 #if HAVE_SYS_PARAM_H
696 # include <sys/param.h>
697 #endif
698 ])
699
700 # For the email plugin
701 AC_CHECK_HEADERS(linux/un.h, [], [],
702 [
703 #if HAVE_SYS_SOCKET_H
704 #       include <sys/socket.h>
705 #endif
706 ])
707
708 # --enable-xfs {{{
709 AC_ARG_ENABLE([xfs],
710   [AS_HELP_STRING([--enable-xfs], [xfs support in df plugin @<:@default=yes@:>@])],
711   [],
712   [enable_xfs="auto"]
713 )
714
715 if test "x$enable_xfs" != "xno"; then
716   AC_CHECK_HEADERS([xfs/xqm.h],
717     [],
718     [
719       if test "x$enable_xfs" = "xyes"; then
720         AC_MSG_ERROR([xfs/xqm.h not found])
721       fi
722     ],
723     [[#define _GNU_SOURCE]]
724   )
725 fi
726
727 # }}}
728
729 # For the dns plugin
730 AC_CHECK_HEADERS(arpa/nameser.h)
731 AC_CHECK_HEADERS(arpa/nameser_compat.h, [], [],
732 [
733 #if HAVE_ARPA_NAMESER_H
734 # include <arpa/nameser.h>
735 #endif
736 ])
737
738 AC_CHECK_HEADERS(net/if_arp.h, [], [],
739 [#if HAVE_SYS_SOCKET_H
740 # include <sys/socket.h>
741 #endif
742 ])
743 AC_CHECK_HEADERS(net/ppp_defs.h)
744 AC_CHECK_HEADERS(net/if_ppp.h, [], [],
745 [#if HAVE_NET_PPP_DEFS_H
746 # include <net/ppp_defs.h>
747 #endif
748 ])
749 AC_CHECK_HEADERS(netinet/if_ether.h, [], [],
750 [#if HAVE_STDINT_H
751 # include <stdint.h>
752 #endif
753 #if HAVE_SYS_TYPES_H
754 # include <sys/types.h>
755 #endif
756 #if HAVE_SYS_SOCKET_H
757 # include <sys/socket.h>
758 #endif
759 #if HAVE_NET_IF_H
760 # include <net/if.h>
761 #endif
762 #if HAVE_NETINET_IN_H
763 # include <netinet/in.h>
764 #endif
765 ])
766
767 have_net_pfvar_h="no"
768 AC_CHECK_HEADERS(net/pfvar.h,
769                [have_net_pfvar_h="yes"],
770                [have_net_pfvar_h="no"],
771 [
772 #if HAVE_SYS_IOCTL_H
773 # include <sys/ioctl.h>
774 #endif
775 #if HAVE_SYS_SOCKET_H
776 # include <sys/socket.h>
777 #endif
778 #if HAVE_NET_IF_H
779 # include <net/if.h>
780 #endif
781 #if HAVE_NETINET_IN_H
782 # include <netinet/in.h>
783 #endif
784 ])
785
786 # For the multimeter plugin
787 have_termios_h="no"
788 AC_CHECK_HEADERS(termios.h, [have_termios_h="yes"])
789
790 # For cpusleep plugin
791 AC_CACHE_CHECK([whether clock_boottime and clock_monotonic are supported],
792                        [c_cv_have_clock_boottime_monotonic],
793                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
794 [[
795 #include <time.h>
796 ]],
797 [[
798  struct timespec b, m;
799  clock_gettime(CLOCK_BOOTTIME, &b );
800  clock_gettime(CLOCK_MONOTONIC, &m );
801 ]]
802                        )],
803                        [c_cv_have_clock_boottime_monotonic="yes"],
804                        [c_cv_have_clock_boottime_monotonic="no"]))
805
806
807 # For the turbostat plugin
808 AC_CHECK_HEADERS([cpuid.h],
809   [have_cpuid_h="yes"],
810   [have_cpuid_h="no (cpuid.h not found)"]
811 )
812
813 have_capability="yes"
814 AC_CHECK_HEADERS(sys/capability.h,
815                  [have_capability="yes"],
816                  [have_capability="no (<sys/capability.h> not found)"])
817 if test "x$have_capability" = "xyes"; then
818 AC_CHECK_LIB(cap, cap_get_proc,
819                  [have_capability="yes"],
820                  [have_capability="no (cap_get_proc() not found)"])
821 fi
822 if test "x$have_capability" = "xyes"; then
823 AC_CHECK_DECL([CAP_IS_SUPPORTED],
824                  [have_capability="yes"],
825                  [have_capability="no (CAP_IS_SUPPORTED not found)"],
826                  [[#include <sys/capability.h>]])
827 fi
828 if test "x$have_capability" = "xyes"; then
829   AC_DEFINE(HAVE_CAPABILITY, 1, [Define to 1 if you have cap_get_proc() (-lcap).])
830 fi
831 AM_CONDITIONAL(BUILD_WITH_CAPABILITY, test "x$have_capability" = "xyes")
832
833 #
834 # Checks for typedefs, structures, and compiler characteristics.
835 #
836 AC_C_CONST
837 AC_TYPE_PID_T
838 AC_TYPE_SIZE_T
839 AC_TYPE_UID_T
840 AC_HEADER_TIME
841
842 #
843 # Checks for library functions.
844 #
845 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen strncasecmp strcasecmp openlog closelog sysconf setenv if_indextoname setlocale asprintf)
846
847 AC_FUNC_STRERROR_R
848
849 test_cxx_flags() {
850         AC_LANG_PUSH([C++])
851         AC_LANG_CONFTEST([
852                 AC_LANG_SOURCE([[int main(void){}]])
853         ])
854         $CXX -c conftest.cpp $CXXFLAGS $@ > /dev/null 2> /dev/null
855         ret=$?
856         rm -f conftest.o
857         AC_LANG_POP([C++])
858         return $ret
859 }
860
861 SAVE_CFLAGS="$CFLAGS"
862 # Emulate behavior of src/Makefile.am
863 if test "x$GCC" = "xyes"
864 then
865         CFLAGS="$CFLAGS -Wall -Werror"
866 fi
867
868 AC_CACHE_CHECK([for strtok_r],
869   [c_cv_have_strtok_r_default],
870   AC_LINK_IFELSE(
871     [AC_LANG_PROGRAM(
872 [[[
873 #include <stdlib.h>
874 #include <stdio.h>
875 #include <string.h>
876 ]]],
877 [[[
878       char buffer[] = "foo,bar,baz";
879       char *token;
880       char *dummy;
881       char *saveptr;
882
883       dummy = buffer;
884       saveptr = NULL;
885       while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
886       {
887         dummy = NULL;
888         printf ("token = %s;\n", token);
889       }
890 ]]]
891     )],
892     [c_cv_have_strtok_r_default="yes"],
893     [c_cv_have_strtok_r_default="no"]
894   )
895 )
896
897 if test "x$c_cv_have_strtok_r_default" = "xno"
898 then
899   CFLAGS="$CFLAGS -D_REENTRANT=1"
900
901   AC_CACHE_CHECK([if strtok_r needs _REENTRANT],
902     [c_cv_have_strtok_r_reentrant],
903     AC_LINK_IFELSE(
904       [AC_LANG_PROGRAM(
905 [[[
906 #include <stdlib.h>
907 #include <stdio.h>
908 #include <string.h>
909 ]]],
910 [[[
911         char buffer[] = "foo,bar,baz";
912         char *token;
913         char *dummy;
914         char *saveptr;
915
916         dummy = buffer;
917         saveptr = NULL;
918         while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
919         {
920           dummy = NULL;
921           printf ("token = %s;\n", token);
922         }
923 ]]]
924       )],
925       [c_cv_have_strtok_r_reentrant="yes"],
926       [AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
927     )
928   )
929 fi
930
931 CFLAGS="$SAVE_CFLAGS"
932 if test "x$c_cv_have_strtok_r_reentrant" = "xyes"
933 then
934         CFLAGS="$CFLAGS -D_REENTRANT=1"
935 fi
936
937 AC_CHECK_FUNCS(getpwnam_r getgrnam_r setgroups regcomp regerror regexec regfree)
938
939 socket_needs_socket="no"
940 AC_CHECK_FUNCS(socket, [], AC_CHECK_LIB(socket, socket, [socket_needs_socket="yes"], AC_MSG_ERROR(cannot find socket)))
941 AM_CONDITIONAL(BUILD_WITH_LIBSOCKET, test "x$socket_needs_socket" = "xyes")
942
943 clock_gettime_needs_rt="no"
944 clock_gettime_needs_posix4="no"
945 have_clock_gettime="no"
946 AC_CHECK_FUNCS(clock_gettime, [have_clock_gettime="yes"])
947 if test "x$have_clock_gettime" = "xno"
948 then
949         AC_CHECK_LIB(rt, clock_gettime, [clock_gettime_needs_rt="yes"
950                                          have_clock_gettime="yes"])
951 fi
952 if test "x$have_clock_gettime" = "xno"
953 then
954         AC_CHECK_LIB(posix4, clock_gettime, [clock_gettime_needs_posix4="yes"
955                                              have_clock_gettime="yes"])
956 fi
957 if test "x$have_clock_gettime" = "xyes"
958 then
959         AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if the clock_gettime(2) function is available.])
960 fi
961
962 nanosleep_needs_rt="no"
963 nanosleep_needs_posix4="no"
964 AC_CHECK_FUNCS(nanosleep,
965     [],
966     AC_CHECK_LIB(rt, nanosleep,
967         [nanosleep_needs_rt="yes"],
968         AC_CHECK_LIB(posix4, nanosleep,
969             [nanosleep_needs_posix4="yes"],
970             AC_MSG_ERROR(cannot find nanosleep))))
971
972 AM_CONDITIONAL(BUILD_WITH_LIBRT, test "x$clock_gettime_needs_rt" = "xyes" || test "x$nanosleep_needs_rt" = "xyes")
973 AM_CONDITIONAL(BUILD_WITH_LIBPOSIX4, test "x$clock_gettime_needs_posix4" = "xyes" || test "x$nanosleep_needs_posix4" = "xyes")
974
975 AC_CHECK_FUNCS(sysctl, [have_sysctl="yes"], [have_sysctl="no"])
976 AC_CHECK_FUNCS(sysctlbyname, [have_sysctlbyname="yes"], [have_sysctlbyname="no"])
977 AC_CHECK_FUNCS(host_statistics, [have_host_statistics="yes"], [have_host_statistics="no"])
978 AC_CHECK_FUNCS(processor_info, [have_processor_info="yes"], [have_processor_info="no"])
979 AC_CHECK_FUNCS(thread_info, [have_thread_info="yes"], [have_thread_info="no"])
980 AC_CHECK_FUNCS(statfs, [have_statfs="yes"], [have_statfs="no"])
981 AC_CHECK_FUNCS(statvfs, [have_statvfs="yes"], [have_statvfs="no"])
982 AC_CHECK_FUNCS(getifaddrs, [have_getifaddrs="yes"], [have_getifaddrs="no"])
983 AC_CHECK_FUNCS(getloadavg, [have_getloadavg="yes"], [have_getloadavg="no"])
984 AC_CHECK_FUNCS(syslog, [have_syslog="yes"], [have_syslog="no"])
985 AC_CHECK_FUNCS(getutent, [have_getutent="yes"], [have_getutent="no"])
986 AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"])
987
988 # Check for strptime {{{
989 if test "x$GCC" = "xyes"
990 then
991         SAVE_CFLAGS="$CFLAGS"
992         CFLAGS="$CFLAGS -Wall -Wextra -Werror"
993 fi
994
995 AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"])
996 if test "x$have_strptime" = "xyes"
997 then
998         AC_CACHE_CHECK([whether strptime is exported by default],
999                        [c_cv_have_strptime_default],
1000                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1001 [[[
1002 #include <time.h>
1003 ]]],
1004 [[[
1005  struct tm stm;
1006  (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
1007 ]]]
1008                        )],
1009                        [c_cv_have_strptime_default="yes"],
1010                        [c_cv_have_strptime_default="no"]))
1011 fi
1012 if test "x$have_strptime" = "xyes" && test "x$c_cv_have_strptime_default" = "xno"
1013 then
1014         AC_CACHE_CHECK([whether strptime needs standards mode],
1015                        [c_cv_have_strptime_standards],
1016                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1017 [[[
1018 #ifndef _ISOC99_SOURCE
1019 # define _ISOC99_SOURCE 1
1020 #endif
1021 #ifndef _POSIX_C_SOURCE
1022 # define _POSIX_C_SOURCE 200112L
1023 #endif
1024 #ifndef _XOPEN_SOURCE
1025 # define _XOPEN_SOURCE 500
1026 #endif
1027 #include <time.h>
1028 ]]],
1029 [[[
1030  struct tm stm;
1031  (void) strptime ("2010-12-30%13:42:42", "%Y-%m-%dT%T", &stm);
1032 ]]]
1033                        )],
1034                        [c_cv_have_strptime_standards="yes"],
1035                        [c_cv_have_strptime_standards="no"]))
1036
1037         if test "x$c_cv_have_strptime_standards" = "xyes"
1038         then
1039                 AC_DEFINE([STRPTIME_NEEDS_STANDARDS], 1, [Set to true if strptime is only exported in X/Open mode (GNU libc).])
1040         else
1041                 have_strptime="no"
1042         fi
1043 fi
1044
1045 if test "x$GCC" = "xyes"
1046 then
1047         CFLAGS="$SAVE_CFLAGS"
1048 fi
1049 # }}} Check for strptime
1050
1051 # Check for timegm {{{
1052
1053 # These checks need -Werror because implicit function declarations are only a
1054 # warning ...
1055 SAVE_CFLAGS="$CFLAGS"
1056 CFLAGS="$CFLAGS -Werror"
1057
1058 AC_CACHE_CHECK([for timegm],
1059   [c_cv_have_timegm],
1060   AC_LINK_IFELSE(
1061     [AC_LANG_PROGRAM(
1062 [[[
1063 #if STRPTIME_NEEDS_STANDARDS
1064 # ifndef _ISOC99_SOURCE
1065 #  define _ISOC99_SOURCE 1
1066 # endif
1067 # ifndef _POSIX_C_SOURCE
1068 #  define _POSIX_C_SOURCE 200112L
1069 # endif
1070 # ifndef _XOPEN_SOURCE
1071 #  define _XOPEN_SOURCE 500
1072 # endif
1073 #endif
1074 #include <time.h>
1075 ]]],
1076 [[[
1077  time_t t = timegm(&(struct tm){0});
1078  if (t == ((time_t) -1)) {
1079    return 1;
1080  }
1081 ]]]
1082     )],
1083     [c_cv_have_timegm="yes"],
1084     [c_cv_have_timegm="no"]
1085   )
1086 )
1087
1088 if test "x$c_cv_have_timegm" != "xyes"
1089 then
1090   AC_CACHE_CHECK([for timegm with _BSD_SOURCE],
1091     [c_cv_have_timegm_bsd],
1092     AC_LINK_IFELSE(
1093       [AC_LANG_PROGRAM(
1094 [[[
1095 #if STRPTIME_NEEDS_STANDARDS
1096 # ifndef _ISOC99_SOURCE
1097 #  define _ISOC99_SOURCE 1
1098 # endif
1099 # ifndef _POSIX_C_SOURCE
1100 #  define _POSIX_C_SOURCE 200112L
1101 # endif
1102 # ifndef _XOPEN_SOURCE
1103 #  define _XOPEN_SOURCE 500
1104 # endif
1105 #endif
1106 #ifndef _BSD_SOURCE
1107 # define _BSD_SOURCE 1
1108 #endif
1109 #include <time.h>
1110 ]]],
1111 [[[
1112  time_t t = timegm(&(struct tm){0});
1113  if (t == ((time_t) -1)) {
1114    return 1;
1115  }
1116 ]]]
1117       )],
1118       [c_cv_have_timegm_bsd="yes"
1119        c_cv_have_timegm="yes"],
1120       [c_cv_have_timegm_bsd="no"]
1121     )
1122   )
1123 fi
1124
1125 if test "x$c_cv_have_timegm" = "xyes"
1126 then
1127   AC_DEFINE(HAVE_TIMEGM, 1, [Define if the timegm(3) function is available.])
1128   if test "x$c_cv_have_timegm_bsd" = "xyes"
1129   then
1130     AC_DEFINE(TIMEGM_NEEDS_BSD, 1, [Set to true if timegm is only exported in BSD mode.])
1131   fi
1132 fi
1133
1134 CFLAGS="$SAVE_CFLAGS"
1135 # }}} Check for timegm
1136
1137 AC_CHECK_FUNCS(swapctl, [have_swapctl="yes"], [have_swapctl="no"])
1138 if test "x$have_swapctl" = "xyes"; then
1139         AC_CACHE_CHECK([whether swapctl takes two arguments],
1140                 [c_cv_have_swapctl_two_args],
1141                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1142 [[[
1143 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
1144 #  undef _FILE_OFFSET_BITS
1145 #  undef _LARGEFILE64_SOURCE
1146 #endif
1147 #include <sys/stat.h>
1148 #include <sys/param.h>
1149 #include <sys/swap.h>
1150 #include <unistd.h>
1151 ]]],
1152 [[[
1153 int num = swapctl(0, NULL);
1154 ]]]
1155                         )],
1156                         [c_cv_have_swapctl_two_args="yes"],
1157                         [c_cv_have_swapctl_two_args="no"]
1158                 )
1159         )
1160         AC_CACHE_CHECK([whether swapctl takes three arguments],
1161                 [c_cv_have_swapctl_three_args],
1162                 AC_COMPILE_IFELSE(
1163                         [AC_LANG_PROGRAM(
1164 [[[
1165 #if HAVE_SYS_SWAP_H && !defined(_LP64) && _FILE_OFFSET_BITS == 64
1166 #  undef _FILE_OFFSET_BITS
1167 #  undef _LARGEFILE64_SOURCE
1168 #endif
1169 #include <sys/stat.h>
1170 #include <sys/param.h>
1171 #include <sys/swap.h>
1172 #include <unistd.h>
1173 ]]],
1174 [[[
1175 int num = swapctl(0, NULL, 0);
1176 ]]]
1177                         )],
1178                         [c_cv_have_swapctl_three_args="yes"],
1179                         [c_cv_have_swapctl_three_args="no"]
1180                 )
1181         )
1182 fi
1183 # Check for different versions of `swapctl' here..
1184 if test "x$have_swapctl" = "xyes"; then
1185         if test "x$c_cv_have_swapctl_two_args" = "xyes"; then
1186                 AC_DEFINE(HAVE_SWAPCTL_TWO_ARGS, 1,
1187                           [Define if the function swapctl exists and takes two arguments.])
1188         fi
1189         if test "x$c_cv_have_swapctl_three_args" = "xyes"; then
1190                 AC_DEFINE(HAVE_SWAPCTL_THREE_ARGS, 1,
1191                           [Define if the function swapctl exists and takes three arguments.])
1192         fi
1193 fi
1194
1195 # Check for NAN
1196 AC_ARG_WITH(nan-emulation, [AS_HELP_STRING([--with-nan-emulation], [use emulated NAN. For crosscompiling only.])],
1197 [
1198  if test "x$withval" = "xno"; then
1199          nan_type="none"
1200  else if test "x$withval" = "xyes"; then
1201          nan_type="zero"
1202  else
1203          nan_type="$withval"
1204  fi; fi
1205 ],
1206 [nan_type="none"])
1207 if test "x$nan_type" = "xnone"; then
1208   AC_CACHE_CHECK([whether NAN is defined by default],
1209     [c_cv_have_nan_default],
1210     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1211 [[[
1212 #include <stdlib.h>
1213 #include <math.h>
1214 static double foo = NAN;
1215 ]]],
1216 [[[
1217        if (isnan (foo))
1218         return 0;
1219        else
1220         return 1;
1221 ]]]
1222       )],
1223       [c_cv_have_nan_default="yes"],
1224       [c_cv_have_nan_default="no"]
1225     )
1226   )
1227   if test "x$c_cv_have_nan_default" = "xyes"
1228   then
1229     nan_type="default"
1230   fi
1231 fi
1232 if test "x$nan_type" = "xnone"; then
1233   AC_CACHE_CHECK([whether NAN is defined by __USE_ISOC99],
1234     [c_cv_have_nan_isoc],
1235     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1236 [[[
1237 #include <stdlib.h>
1238 #define __USE_ISOC99 1
1239 #include <math.h>
1240 static double foo = NAN;
1241 ]]],
1242 [[[
1243        if (isnan (foo))
1244         return 0;
1245        else
1246         return 1;
1247 ]]]
1248       )],
1249       [c_cv_have_nan_isoc="yes"],
1250       [c_cv_have_nan_isoc="no"]
1251     )
1252   )
1253   if test "x$c_cv_have_nan_isoc" = "xyes"
1254   then
1255     nan_type="isoc99"
1256   fi
1257 fi
1258 if test "x$nan_type" = "xnone"; then
1259   SAVE_LDFLAGS=$LDFLAGS
1260   LDFLAGS="$LDFLAGS -lm"
1261   AC_CACHE_CHECK([whether NAN can be defined by 0/0],
1262     [c_cv_have_nan_zero],
1263     AC_RUN_IFELSE([AC_LANG_PROGRAM(
1264 [[[
1265 #include <stdlib.h>
1266 #include <math.h>
1267 #ifdef NAN
1268 # undef NAN
1269 #endif
1270 #define NAN (0.0 / 0.0)
1271 #ifndef isnan
1272 # define isnan(f) ((f) != (f))
1273 #endif
1274 static double foo = NAN;
1275 ]]],
1276 [[[
1277        if (isnan (foo))
1278         return 0;
1279        else
1280         return 1;
1281 ]]]
1282       )],
1283       [c_cv_have_nan_zero="yes"],
1284       [c_cv_have_nan_zero="no"]
1285     )
1286   )
1287   LDFLAGS=$SAVE_LDFLAGS
1288   if test "x$c_cv_have_nan_zero" = "xyes"
1289   then
1290     nan_type="zero"
1291   fi
1292 fi
1293
1294 if test "x$nan_type" = "xdefault"; then
1295   AC_DEFINE(NAN_STATIC_DEFAULT, 1,
1296     [Define if NAN is defined by default and can initialize static variables.])
1297 else if test "x$nan_type" = "xisoc99"; then
1298   AC_DEFINE(NAN_STATIC_ISOC, 1,
1299     [Define if NAN is defined by __USE_ISOC99 and can initialize static variables.])
1300 else if test "x$nan_type" = "xzero"; then
1301   AC_DEFINE(NAN_ZERO_ZERO, 1,
1302     [Define if NAN can be defined as (0.0 / 0.0)])
1303 else
1304   AC_MSG_ERROR([Didn't find out how to statically initialize variables to NAN. Sorry.])
1305 fi; fi; fi
1306
1307 AC_ARG_WITH(fp-layout, [AS_HELP_STRING([--with-fp-layout], [set the memory layout of doubles. For crosscompiling only.])],
1308 [
1309  if test "x$withval" = "xnothing"; then
1310         fp_layout_type="nothing"
1311  else if test "x$withval" = "xendianflip"; then
1312         fp_layout_type="endianflip"
1313  else if test "x$withval" = "xintswap"; then
1314         fp_layout_type="intswap"
1315  else
1316         AC_MSG_ERROR([Invalid argument for --with-fp-layout. Valid arguments are: nothing, endianflip, intswap]);
1317 fi; fi; fi
1318 ],
1319 [fp_layout_type="unknown"])
1320
1321 if test "x$fp_layout_type" = "xunknown"; then
1322   AC_CACHE_CHECK([if doubles are stored in x86 representation],
1323     [c_cv_fp_layout_need_nothing],
1324     AC_RUN_IFELSE([AC_LANG_PROGRAM(
1325 [[[
1326 #include <stdlib.h>
1327 #include <stdio.h>
1328 #include <string.h>
1329 #if HAVE_STDINT_H
1330 # include <stdint.h>
1331 #endif
1332 #if HAVE_INTTYPES_H
1333 # include <inttypes.h>
1334 #endif
1335 #if HAVE_STDBOOL_H
1336 # include <stdbool.h>
1337 #endif
1338 ]]],
1339 [[[
1340         uint64_t i0;
1341         uint64_t i1;
1342         uint8_t c[8];
1343         double d;
1344
1345         d = 8.642135e130;
1346         memcpy ((void *) &i0, (void *) &d, 8);
1347
1348         i1 = i0;
1349         memcpy ((void *) c, (void *) &i1, 8);
1350
1351         if ((c[0] == 0x2f) && (c[1] == 0x25)
1352                         && (c[2] == 0xc0) && (c[3] == 0xc7)
1353                         && (c[4] == 0x43) && (c[5] == 0x2b)
1354                         && (c[6] == 0x1f) && (c[7] == 0x5b))
1355                 return (0);
1356         else
1357                 return (1);
1358 ]]]
1359       )],
1360       [c_cv_fp_layout_need_nothing="yes"],
1361       [c_cv_fp_layout_need_nothing="no"]
1362     )
1363   )
1364   if test "x$c_cv_fp_layout_need_nothing" = "xyes"; then
1365     fp_layout_type="nothing"
1366   fi
1367 fi
1368 if test "x$fp_layout_type" = "xunknown"; then
1369   AC_CACHE_CHECK([if endianflip converts to x86 representation],
1370     [c_cv_fp_layout_need_endianflip],
1371     AC_RUN_IFELSE([AC_LANG_PROGRAM(
1372 [[[
1373 #include <stdlib.h>
1374 #include <stdio.h>
1375 #include <string.h>
1376 #if HAVE_STDINT_H
1377 # include <stdint.h>
1378 #endif
1379 #if HAVE_INTTYPES_H
1380 # include <inttypes.h>
1381 #endif
1382 #if HAVE_STDBOOL_H
1383 # include <stdbool.h>
1384 #endif
1385 #define endianflip(A) ((((uint64_t)(A) & 0xff00000000000000LL) >> 56) | \
1386                        (((uint64_t)(A) & 0x00ff000000000000LL) >> 40) | \
1387                        (((uint64_t)(A) & 0x0000ff0000000000LL) >> 24) | \
1388                        (((uint64_t)(A) & 0x000000ff00000000LL) >> 8)  | \
1389                        (((uint64_t)(A) & 0x00000000ff000000LL) << 8)  | \
1390                        (((uint64_t)(A) & 0x0000000000ff0000LL) << 24) | \
1391                        (((uint64_t)(A) & 0x000000000000ff00LL) << 40) | \
1392                        (((uint64_t)(A) & 0x00000000000000ffLL) << 56))
1393 ]]],
1394 [[[
1395         uint64_t i0;
1396         uint64_t i1;
1397         uint8_t c[8];
1398         double d;
1399
1400         d = 8.642135e130;
1401         memcpy ((void *) &i0, (void *) &d, 8);
1402
1403         i1 = endianflip (i0);
1404         memcpy ((void *) c, (void *) &i1, 8);
1405
1406         if ((c[0] == 0x2f) && (c[1] == 0x25)
1407                         && (c[2] == 0xc0) && (c[3] == 0xc7)
1408                         && (c[4] == 0x43) && (c[5] == 0x2b)
1409                         && (c[6] == 0x1f) && (c[7] == 0x5b))
1410                 return (0);
1411         else
1412                 return (1);
1413 ]]]
1414       )],
1415       [c_cv_fp_layout_need_endianflip="yes"],
1416       [c_cv_fp_layout_need_endianflip="no"]
1417     )
1418   )
1419   if test "x$c_cv_fp_layout_need_endianflip" = "xyes"; then
1420     fp_layout_type="endianflip"
1421   fi
1422 fi
1423 if test "x$fp_layout_type" = "xunknown"; then
1424   AC_CACHE_CHECK([if intswap converts to x86 representation],
1425     [c_cv_fp_layout_need_intswap],
1426     AC_RUN_IFELSE([AC_LANG_PROGRAM(
1427 [[[
1428 #include <stdlib.h>
1429 #include <stdio.h>
1430 #include <string.h>
1431 #if HAVE_STDINT_H
1432 # include <stdint.h>
1433 #endif
1434 #if HAVE_INTTYPES_H
1435 # include <inttypes.h>
1436 #endif
1437 #if HAVE_STDBOOL_H
1438 # include <stdbool.h>
1439 #endif
1440 #define intswap(A)    ((((uint64_t)(A) & 0xffffffff00000000LL) >> 32) | \
1441                        (((uint64_t)(A) & 0x00000000ffffffffLL) << 32))
1442 ]]],
1443 [[[
1444         uint64_t i0;
1445         uint64_t i1;
1446         uint8_t c[8];
1447         double d;
1448
1449         d = 8.642135e130;
1450         memcpy ((void *) &i0, (void *) &d, 8);
1451
1452         i1 = intswap (i0);
1453         memcpy ((void *) c, (void *) &i1, 8);
1454
1455         if ((c[0] == 0x2f) && (c[1] == 0x25)
1456                         && (c[2] == 0xc0) && (c[3] == 0xc7)
1457                         && (c[4] == 0x43) && (c[5] == 0x2b)
1458                         && (c[6] == 0x1f) && (c[7] == 0x5b))
1459                 return (0);
1460         else
1461                 return (1);
1462 ]]]
1463       )],
1464       [c_cv_fp_layout_need_intswap="yes"],
1465       [c_cv_fp_layout_need_intswap="no"]
1466     )
1467   )
1468   if test "x$c_cv_fp_layout_need_intswap" = "xyes"; then
1469     fp_layout_type="intswap"
1470   fi
1471 fi
1472
1473 if test "x$fp_layout_type" = "xnothing"; then
1474   AC_DEFINE(FP_LAYOUT_NEED_NOTHING, 1,
1475   [Define if doubles are stored in x86 representation.])
1476 else if test "x$fp_layout_type" = "xendianflip"; then
1477   AC_DEFINE(FP_LAYOUT_NEED_ENDIANFLIP, 1,
1478   [Define if endianflip is needed to convert to x86 representation.])
1479 else if test "x$fp_layout_type" = "xintswap"; then
1480   AC_DEFINE(FP_LAYOUT_NEED_INTSWAP, 1,
1481   [Define if intswap is needed to convert to x86 representation.])
1482 else
1483   AC_MSG_ERROR([Didn't find out how doubles are stored in memory. Sorry.])
1484 fi; fi; fi
1485
1486 # --with-useragent {{{
1487 AC_ARG_WITH(useragent, [AS_HELP_STRING([--with-useragent@<:@=AGENT@:>@], [User agent to use on http requests])],
1488 [
1489     if test "x$withval" != "xno" && test "x$withval" != "xyes"
1490     then
1491         AC_DEFINE_UNQUOTED(COLLECTD_USERAGENT, ["$withval"], [User agent for http requests])
1492     fi
1493 ])
1494
1495 # }}}
1496
1497 # --with-data-max-name-len {{{
1498 AC_ARG_WITH(data-max-name-len, [AS_HELP_STRING([--with-data-max-name-len@<:@=VALUE@:>@], [Maximum length of data buffers])],
1499 [
1500     if test "x$withval" != "x" && test $withval -gt 0
1501     then
1502         AC_DEFINE_UNQUOTED(DATA_MAX_NAME_LEN, [$withval], [Maximum length of data buffers])
1503     else
1504         AC_MSG_ERROR([DATA_MAX_NAME_LEN must be a positive integer -- $withval given])
1505     fi
1506 ],
1507 [   AC_DEFINE(DATA_MAX_NAME_LEN, 128, [Maximum length of data buffers])]
1508 )
1509 # }}}
1510
1511 have_getfsstat="no"
1512 AC_CHECK_FUNCS(getfsstat, [have_getfsstat="yes"])
1513 have_getvfsstat="no"
1514 AC_CHECK_FUNCS(getvfsstat, [have_getvfsstat="yes"])
1515 have_listmntent="no"
1516 AC_CHECK_FUNCS(listmntent, [have_listmntent="yes"])
1517 have_getmntent_r="no"
1518 AC_CHECK_FUNCS(getmntent_r, [have_getmntent_r="yes"])
1519
1520 have_getmntent="no"
1521 AC_CHECK_FUNCS(getmntent, [have_getmntent="c"])
1522 if test "x$have_getmntent" = "xno"; then
1523         AC_CHECK_LIB(sun, getmntent, [have_getmntent="sun"])
1524 fi
1525 if test "x$have_getmntent" = "xno"; then
1526         AC_CHECK_LIB(seq, getmntent, [have_getmntent="seq"])
1527 fi
1528 if test "x$have_getmntent" = "xno"; then
1529         AC_CHECK_LIB(gen, getmntent, [have_getmntent="gen"])
1530 fi
1531
1532 if test "x$have_getmntent" = "xc"; then
1533         AC_CACHE_CHECK([whether getmntent takes one argument],
1534                 [c_cv_have_one_getmntent],
1535                 AC_COMPILE_IFELSE(
1536                         [AC_LANG_PROGRAM(
1537 [[[
1538 #include "$srcdir/src/utils_mount.h"
1539 ]]],
1540 [[[
1541 FILE *fh;
1542 struct mntent *me;
1543 fh = setmntent ("/etc/mtab", "r");
1544 me = getmntent (fh);
1545 return(me->mnt_passno);
1546 ]]]
1547                         )],
1548                         [c_cv_have_one_getmntent="yes"],
1549                         [c_cv_have_one_getmntent="no"]
1550                 )
1551         )
1552         AC_CACHE_CHECK([whether getmntent takes two arguments],
1553                 [c_cv_have_two_getmntent],
1554                 AC_COMPILE_IFELSE(
1555                         [AC_LANG_PROGRAM(
1556 [[[
1557 #include "$srcdir/src/utils_mount.h"
1558 ]]],
1559 [[[
1560                                  FILE *fh;
1561                                  struct mnttab mt;
1562                                  int status;
1563                                  fh = fopen ("/etc/mnttab", "r");
1564                                  status = getmntent (fh, &mt);
1565                                  return(status);
1566 ]]]
1567                         )],
1568                         [c_cv_have_two_getmntent="yes"],
1569                         [c_cv_have_two_getmntent="no"]
1570                 )
1571         )
1572 fi
1573
1574 # Check for different versions of `getmntent' here..
1575
1576 if test "x$have_getmntent" = "xc"; then
1577         if test "x$c_cv_have_one_getmntent" = "xyes"; then
1578                 AC_DEFINE(HAVE_ONE_GETMNTENT, 1,
1579                           [Define if the function getmntent exists and takes one argument.])
1580         fi
1581         if test "x$c_cv_have_two_getmntent" = "xyes"; then
1582                 AC_DEFINE(HAVE_TWO_GETMNTENT, 1,
1583                           [Define if the function getmntent exists and takes two arguments.])
1584         fi
1585 fi
1586 if test "x$have_getmntent" = "xsun"; then
1587         AC_DEFINE(HAVE_SUN_GETMNTENT, 1,
1588                   [Define if the function getmntent exists. It is the version from libsun.])
1589 fi
1590 if test "x$have_getmntent" = "xseq"; then
1591         AC_DEFINE(HAVE_SEQ_GETMNTENT, 1,
1592                   [Define if the function getmntent exists. It is the version from libseq.])
1593 fi
1594 if test "x$have_getmntent" = "xgen"; then
1595         AC_DEFINE(HAVE_GEN_GETMNTENT, 1,
1596                   [Define if the function getmntent exists. It is the version from libgen.])
1597 fi
1598
1599 # Check for htonll
1600 AC_CACHE_CHECK([if have htonll defined],
1601                   [c_cv_have_htonll],
1602                   AC_LINK_IFELSE([AC_LANG_PROGRAM(
1603 [[[
1604 #include <sys/types.h>
1605 #include <netinet/in.h>
1606 #if HAVE_INTTYPES_H
1607 # include <inttypes.h>
1608 #endif
1609 ]]],
1610 [[[
1611           return htonll(0);
1612 ]]]
1613     )],
1614     [c_cv_have_htonll="yes"],
1615     [c_cv_have_htonll="no"]
1616   )
1617 )
1618 if test "x$c_cv_have_htonll" = "xyes"
1619 then
1620     AC_DEFINE(HAVE_HTONLL, 1, [Define if the function htonll exists.])
1621 fi
1622
1623 # Check for structures
1624 AC_CHECK_MEMBERS([struct if_data.ifi_ibytes, struct if_data.ifi_opackets, struct if_data.ifi_ierrors],
1625         [AC_DEFINE(HAVE_STRUCT_IF_DATA, 1, [Define if struct if_data exists and is usable.])],
1626         [],
1627         [
1628         #include <sys/types.h>
1629         #include <sys/socket.h>
1630         #include <net/if.h>
1631         ])
1632 AC_CHECK_MEMBERS([struct net_device_stats.rx_bytes, struct net_device_stats.tx_packets, struct net_device_stats.rx_errors],
1633         [AC_DEFINE(HAVE_STRUCT_NET_DEVICE_STATS, 1, [Define if struct net_device_stats exists and is usable.])],
1634         [],
1635         [
1636         #include <sys/types.h>
1637         #include <sys/socket.h>
1638         #include <linux/if.h>
1639         #include <linux/netdevice.h>
1640         ])
1641 AC_CHECK_MEMBERS([struct inet_diag_req.id, struct inet_diag_req.idiag_states],
1642         [AC_DEFINE(HAVE_STRUCT_LINUX_INET_DIAG_REQ, 1, [Define if struct inet_diag_req exists and is usable.])],
1643         [],
1644         [
1645         #include <linux/inet_diag.h>
1646         ])
1647
1648
1649 AC_CHECK_MEMBERS([struct ip_mreqn.imr_ifindex], [],
1650         [],
1651         [
1652         #include <netinet/in.h>
1653         #include <net/if.h>
1654         ])
1655
1656 AC_CHECK_MEMBERS([struct kinfo_proc.ki_pid, struct kinfo_proc.ki_rssize, struct kinfo_proc.ki_rusage],
1657         [
1658                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_FREEBSD, 1,
1659                         [Define if struct kinfo_proc exists in the FreeBSD variant.])
1660                 have_struct_kinfo_proc_freebsd="yes"
1661         ],
1662         [
1663                 have_struct_kinfo_proc_freebsd="no"
1664         ],
1665         [
1666 #include <kvm.h>
1667 #include <sys/param.h>
1668 #include <sys/sysctl.h>
1669 #include <sys/user.h>
1670         ])
1671
1672 AC_CHECK_MEMBERS([struct kinfo_proc.p_pid, struct kinfo_proc.p_vm_rssize],
1673         [
1674                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC_OPENBSD, 1,
1675                         [Define if struct kinfo_proc exists in the OpenBSD variant.])
1676                 have_struct_kinfo_proc_openbsd="yes"
1677         ],
1678         [
1679                 have_struct_kinfo_proc_openbsd="no"
1680         ],
1681         [
1682 #include <sys/param.h>
1683 #include <sys/sysctl.h>
1684 #include <kvm.h>
1685         ])
1686
1687
1688 AC_CHECK_MEMBERS([struct kinfo_proc2.p_pid, struct kinfo_proc2.p_uru_maxrss],
1689         [
1690                 AC_DEFINE(HAVE_STRUCT_KINFO_PROC2_NETBSD, 1,
1691                         [Define if struct kinfo_proc2 exists in the NetBSD variant.])
1692                 have_struct_kinfo_proc2_netbsd="yes"
1693         ],
1694         [
1695                 have_struct_kinfo_proc2_netbsd="no"
1696         ],
1697         [
1698 #include <sys/param.h>
1699 #include <sys/sysctl.h>
1700 #include <kvm.h>
1701         ])
1702
1703
1704
1705 AC_CHECK_MEMBERS([struct udphdr.uh_dport, struct udphdr.uh_sport], [], [],
1706 [#define _BSD_SOURCE
1707 #define _DEFAULT_SOURCE
1708 #if HAVE_STDINT_H
1709 # include <stdint.h>
1710 #endif
1711 #if HAVE_SYS_TYPES_H
1712 # include <sys/types.h>
1713 #endif
1714 #if HAVE_NETINET_IN_SYSTM_H
1715 # include <netinet/in_systm.h>
1716 #endif
1717 #if HAVE_NETINET_IN_H
1718 # include <netinet/in.h>
1719 #endif
1720 #if HAVE_NETINET_IP_H
1721 # include <netinet/ip.h>
1722 #endif
1723 #if HAVE_NETINET_UDP_H
1724 # include <netinet/udp.h>
1725 #endif
1726 ])
1727 AC_CHECK_MEMBERS([struct udphdr.dest, struct udphdr.source], [], [],
1728 [#define _BSD_SOURCE
1729 #define _DEFAULT_SOURCE
1730 #if HAVE_STDINT_H
1731 # include <stdint.h>
1732 #endif
1733 #if HAVE_SYS_TYPES_H
1734 # include <sys/types.h>
1735 #endif
1736 #if HAVE_NETINET_IN_SYSTM_H
1737 # include <netinet/in_systm.h>
1738 #endif
1739 #if HAVE_NETINET_IN_H
1740 # include <netinet/in.h>
1741 #endif
1742 #if HAVE_NETINET_IP_H
1743 # include <netinet/ip.h>
1744 #endif
1745 #if HAVE_NETINET_UDP_H
1746 # include <netinet/udp.h>
1747 #endif
1748 ])
1749
1750 AC_CHECK_MEMBERS([kstat_io_t.nwritten, kstat_io_t.writes, kstat_io_t.nwrites, kstat_io_t.wtime],
1751         [],
1752         [],
1753         [
1754 #if HAVE_KSTAT_H
1755 # include <kstat.h>
1756 #endif
1757         ])
1758
1759 # check for pthread_setname_np
1760 SAVE_LDFLAGS="$LDFLAGS"
1761 LDFLAGS="$LDFLAGS -lpthread"
1762
1763 AC_MSG_CHECKING([for pthread_setname_np])
1764         have_pthread_setname_np="no"
1765         AC_LINK_IFELSE([AC_LANG_PROGRAM(
1766 [[
1767 #define _GNU_SOURCE
1768 #include <pthread.h>
1769 ]],
1770 [[
1771         pthread_setname_np((pthread_t) {0}, "conftest");
1772 ]]
1773         )], [
1774                 have_pthread_setname_np="yes"
1775                 AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [pthread_setname_np() is available.])
1776         ])
1777
1778 AC_MSG_RESULT([$have_pthread_setname_np])
1779
1780 # check for pthread_set_name_np(3) (FreeBSD)
1781 AC_MSG_CHECKING([for pthread_set_name_np])
1782         have_pthread_set_name_np="no"
1783         AC_LINK_IFELSE([AC_LANG_PROGRAM(
1784 [[
1785 #include <pthread_np.h>
1786 ]],
1787 [[
1788         pthread_set_name_np((pthread_t) {0}, "conftest");
1789 ]]
1790         )], [
1791                 have_pthread_set_name_np="yes"
1792                 AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [pthread_set_name_np() is available.])
1793         ])
1794 AC_MSG_RESULT([$have_pthread_set_name_np])
1795
1796 LDFLAGS="$SAVE_LDFLAGS"
1797
1798 #
1799 # Checks for libraries begin here
1800 #
1801
1802 with_libresolv="yes"
1803 AC_CHECK_LIB(resolv, res_search,
1804 [
1805         AC_DEFINE(HAVE_LIBRESOLV, 1, [Define to 1 if you have the 'resolv' library (-lresolv).])
1806 ],
1807 [with_libresolv="no"])
1808 AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
1809
1810 dnl Check for HAL (hardware abstraction library)
1811 with_libhal="no"
1812 PKG_CHECK_MODULES([HAL], [hal],
1813   [
1814     SAVE_LIBS="$LIBS"
1815     LIBS="$HAL_LIBS $LIBS"
1816     AC_CHECK_LIB([hal], [libhal_device_property_exists],
1817       [
1818         SAVE_CPPFLAGS="$CPPFLAGS"
1819         CPPFLAGS="$HAL_CFLAGS $CPPFLAGS"
1820         AC_CHECK_HEADERS([libhal.h],
1821         [
1822           with_libhal="yes"
1823           BUILD_WITH_LIBHAL_CFLAGS="$HAL_CFLAGS"
1824           BUILD_WITH_LIBHAL_LIBS="$HAL_LIBS"
1825         ])
1826         CPPFLAGS="$SAVE_CPPFLAGS"
1827       ],
1828       [ : ]
1829     )
1830     LIBS="$SAVE_LIBS"
1831   ],
1832   [ : ]
1833 )
1834 AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS)
1835 AC_SUBST(BUILD_WITH_LIBHAL_LIBS)
1836
1837
1838 SAVE_LIBS="$LIBS"
1839 AC_CHECK_LIB([pthread],
1840   [pthread_create],
1841   [],
1842   [AC_MSG_ERROR([Symbol 'pthread_create' not found in libpthread"])],
1843   []
1844 )
1845 PTHREAD_LIBS="$LIBS"
1846 LIBS="$SAVE_LIBS"
1847
1848 AC_CHECK_HEADERS([pthread.h],
1849   [],
1850   [AC_MSG_ERROR([pthread.h not found])]
1851 )
1852 AC_SUBST([PTHREAD_LIBS])
1853
1854 m4_divert_once([HELP_WITH], [
1855 collectd additional packages:])
1856
1857 if test "x$ac_system" = "xAIX"
1858 then
1859         with_perfstat="yes"
1860         with_procinfo="yes"
1861 else
1862         with_perfstat="no (AIX only)"
1863         with_procinfo="no (AIX only)"
1864 fi
1865
1866 if test "x$with_perfstat" = "xyes"
1867 then
1868         AC_CHECK_LIB(perfstat, perfstat_reset, [with_perfstat="yes"], [with_perfstat="no (perfstat not found)"], [])
1869 #       AC_CHECK_HEADERS(sys/protosw.h libperfstat.h,, [with_perfstat="no (perfstat not found)"])
1870 fi
1871 if test "x$with_perfstat" = "xyes"
1872 then
1873          AC_DEFINE(HAVE_PERFSTAT, 1, [Define to 1 if you have the 'perfstat' library (-lperfstat)])
1874          # struct members pertaining to donation have been added to libperfstat somewhere between AIX5.3ML5 and AIX5.3ML9
1875          AC_CHECK_MEMBER([perfstat_partition_type_t.b.donate_enabled], [], [], [[#include <libperfstat.h]])
1876          if test "x$av_cv_member_perfstat_partition_type_t_b_donate_enabled" = "xyes"
1877          then
1878                 AC_DEFINE(PERFSTAT_SUPPORTS_DONATION, 1, [Define to 1 if your version of the 'perfstat' library supports donation])
1879          fi
1880 fi
1881 AM_CONDITIONAL(BUILD_WITH_PERFSTAT, test "x$with_perfstat" = "xyes")
1882
1883 # Processes plugin under AIX.
1884 if test "x$with_procinfo" = "xyes"
1885 then
1886         AC_CHECK_HEADERS(procinfo.h,, [with_procinfo="no (procinfo.h not found)"])
1887 fi
1888 if test "x$with_procinfo" = "xyes"
1889 then
1890          AC_DEFINE(HAVE_PROCINFO_H, 1, [Define to 1 if you have the procinfo.h])
1891 fi
1892
1893 if test "x$ac_system" = "xSolaris"
1894 then
1895         with_kstat="yes"
1896         with_devinfo="yes"
1897 else
1898         with_kstat="no (Solaris only)"
1899         with_devinfo="no (Solaris only)"
1900 fi
1901
1902 if test "x$with_kstat" = "xyes"
1903 then
1904         AC_CHECK_LIB(kstat, kstat_open, [with_kstat="yes"], [with_kstat="no (libkstat not found)"], [])
1905 fi
1906 if test "x$with_kstat" = "xyes"
1907 then
1908         AC_CHECK_LIB(devinfo, di_init, [with_devinfo="yes"], [with_devinfo="no (not found)"], [])
1909         AC_CHECK_HEADERS(kstat.h,, [with_kstat="no (kstat.h not found)"])
1910 fi
1911 if test "x$with_kstat" = "xyes"
1912 then
1913         AC_DEFINE(HAVE_LIBKSTAT, 1,
1914                   [Define to 1 if you have the 'kstat' library (-lkstat)])
1915 fi
1916 AM_CONDITIONAL(BUILD_WITH_LIBKSTAT, test "x$with_kstat" = "xyes")
1917 AM_CONDITIONAL(BUILD_WITH_LIBDEVINFO, test "x$with_devinfo" = "xyes")
1918
1919 with_libiokit="no"
1920 if test "x$ac_system" = "xDarwin"
1921 then
1922         with_libiokit="yes"
1923 else
1924         with_libiokit="no"
1925 fi
1926 AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes")
1927
1928 with_libkvm="no"
1929 AC_CHECK_LIB(kvm, kvm_getprocs, [with_kvm_getprocs="yes"], [with_kvm_getprocs="no"])
1930 if test "x$with_kvm_getprocs" = "xyes"
1931 then
1932         AC_DEFINE(HAVE_LIBKVM_GETPROCS, 1,
1933                   [Define to 1 if you have the 'kvm' library with the 'kvm_getprocs' symbol (-lkvm)])
1934         with_libkvm="yes"
1935 fi
1936 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETPROCS, test "x$with_kvm_getprocs" = "xyes")
1937
1938 AC_CHECK_LIB(kvm, kvm_getswapinfo, [with_kvm_getswapinfo="yes"], [with_kvm_getswapinfo="no"])
1939 if test "x$with_kvm_getswapinfo" = "xyes"
1940 then
1941         AC_DEFINE(HAVE_LIBKVM_GETSWAPINFO, 1,
1942                   [Define to 1 if you have the 'kvm' library with the 'kvm_getswapinfo' symbol (-lkvm)])
1943         with_libkvm="yes"
1944 fi
1945 AM_CONDITIONAL(BUILD_WITH_LIBKVM_GETSWAPINFO, test "x$with_kvm_getswapinfo" = "xyes")
1946
1947 AC_CHECK_LIB(kvm, kvm_nlist, [with_kvm_nlist="yes"], [with_kvm_nlist="no"])
1948 if test "x$with_kvm_nlist" = "xyes"
1949 then
1950         AC_CHECK_HEADERS(bsd/nlist.h nlist.h)
1951         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1952                   [Define to 1 if you have the 'kvm' library with the 'kvm_nlist' symbol (-lkvm)])
1953         with_libkvm="yes"
1954 fi
1955 AM_CONDITIONAL(BUILD_WITH_LIBKVM_NLIST, test "x$with_kvm_nlist" = "xyes")
1956
1957 AC_CHECK_LIB(kvm, kvm_openfiles, [with_kvm_openfiles="yes"], [with_kvm_openfiles="no"])
1958 if test "x$with_kvm_openfiles" = "xyes"
1959 then
1960         AC_DEFINE(HAVE_LIBKVM_NLIST, 1,
1961                   [Define to 1 if you have the 'kvm' library with the 'kvm_openfiles' symbol (-lkvm)])
1962         with_libkvm="yes"
1963 fi
1964 AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes")
1965
1966 # --with-libaquaero5 {{{
1967 AC_ARG_WITH(libaquaero5, [AS_HELP_STRING([--with-libaquaero5@<:@=PREFIX@:>@], [Path to aquatools-ng source code.])],
1968 [
1969  if test "x$withval" = "xyes"
1970  then
1971          with_libaquaero5="yes"
1972  else if test "x$withval" = "xno"
1973  then
1974          with_libaquaero5="no"
1975  else
1976          with_libaquaero5="yes"
1977          LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS -I$withval/src"
1978          LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS -L$withval/obj"
1979  fi; fi
1980 ],
1981 [with_libaquaero5="yes"])
1982
1983 SAVE_CPPFLAGS="$CPPFLAGS"
1984 SAVE_LDFLAGS="$LDFLAGS"
1985
1986 CPPFLAGS="$CPPFLAGS $LIBAQUAERO5_CFLAGS"
1987 LDFLAGS="$LDFLAGS $LIBAQUAERO5_LDFLAGS"
1988
1989 if test "x$with_libaquaero5" = "xyes"
1990 then
1991         if test "x$LIBAQUAERO5_CFLAGS" != "x"
1992         then
1993                 AC_MSG_NOTICE([libaquaero5 CPPFLAGS: $LIBAQUAERO5_CFLAGS])
1994         fi
1995         AC_CHECK_HEADERS(libaquaero5.h,
1996         [with_libaquaero5="yes"],
1997         [with_libaquaero5="no (libaquaero5.h not found)"])
1998 fi
1999 if test "x$with_libaquaero5" = "xyes"
2000 then
2001         if test "x$LIBAQUAERO5_LDFLAGS" != "x"
2002         then
2003                 AC_MSG_NOTICE([libaquaero5 LDFLAGS: $LIBAQUAERO5_LDFLAGS])
2004         fi
2005         AC_CHECK_LIB(aquaero5, libaquaero5_poll,
2006         [with_libaquaero5="yes"],
2007         [with_libaquaero5="no (symbol 'libaquaero5_poll' not found)"])
2008 fi
2009
2010 CPPFLAGS="$SAVE_CPPFLAGS"
2011 LDFLAGS="$SAVE_LDFLAGS"
2012
2013 if test "x$with_libaquaero5" = "xyes"
2014 then
2015         BUILD_WITH_LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS"
2016         BUILD_WITH_LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS"
2017         AC_SUBST(BUILD_WITH_LIBAQUAERO5_CFLAGS)
2018         AC_SUBST(BUILD_WITH_LIBAQUAERO5_LDFLAGS)
2019 fi
2020 AM_CONDITIONAL(BUILD_WITH_LIBAQUAERO5, test "x$with_libaquaero5" = "xyes")
2021 # }}}
2022
2023 # --with-libhiredis {{{
2024 AC_ARG_WITH(libhiredis, [AS_HELP_STRING([--with-libhiredis@<:@=PREFIX@:>@],
2025       [Path to libhiredis.])],
2026 [
2027  if test "x$withval" = "xyes"
2028  then
2029          with_libhiredis="yes"
2030  else if test "x$withval" = "xno"
2031  then
2032          with_libhiredis="no"
2033  else
2034          with_libhiredis="yes"
2035          LIBHIREDIS_CPPFLAGS="$LIBHIREDIS_CPPFLAGS -I$withval/include"
2036          LIBHIREDIS_LDFLAGS="$LIBHIREDIS_LDFLAGS -L$withval/lib"
2037  fi; fi
2038 ],
2039 [with_libhiredis="yes"])
2040
2041 SAVE_CPPFLAGS="$CPPFLAGS"
2042 SAVE_LDFLAGS="$LDFLAGS"
2043
2044 CPPFLAGS="$CPPFLAGS $LIBHIREDIS_CPPFLAGS"
2045 LDFLAGS="$LDFLAGS $LIBHIREDIS_LDFLAGS"
2046
2047 if test "x$with_libhiredis" = "xyes"
2048 then
2049         if test "x$LIBHIREDIS_CPPFLAGS" != "x"
2050         then
2051                 AC_MSG_NOTICE([libhiredis CPPFLAGS: $LIBHIREDIS_CPPFLAGS])
2052         fi
2053         AC_CHECK_HEADERS(hiredis/hiredis.h,
2054         [with_libhiredis="yes"],
2055         [with_libhiredis="no (hiredis.h not found)"])
2056 fi
2057 if test "x$with_libhiredis" = "xyes"
2058 then
2059         if test "x$LIBHIREDIS_LDFLAGS" != "x"
2060         then
2061                 AC_MSG_NOTICE([libhiredis LDFLAGS: $LIBHIREDIS_LDFLAGS])
2062         fi
2063         AC_CHECK_LIB(hiredis, redisCommand,
2064         [with_libhiredis="yes"],
2065         [with_libhiredis="no (symbol 'redisCommand' not found)"])
2066
2067 fi
2068
2069 CPPFLAGS="$SAVE_CPPFLAGS"
2070 LDFLAGS="$SAVE_LDFLAGS"
2071
2072 if test "x$with_libhiredis" = "xyes"
2073 then
2074         BUILD_WITH_LIBHIREDIS_CPPFLAGS="$LIBHIREDIS_CPPFLAGS"
2075         BUILD_WITH_LIBHIREDIS_LDFLAGS="$LIBHIREDIS_LDFLAGS"
2076         AC_SUBST(BUILD_WITH_LIBHIREDIS_CPPFLAGS)
2077         AC_SUBST(BUILD_WITH_LIBHIREDIS_LDFLAGS)
2078 fi
2079 AM_CONDITIONAL(BUILD_WITH_LIBHIREDIS, test "x$with_libhiredis" = "xyes")
2080 # }}}
2081
2082 # --with-libcurl {{{
2083 with_curl_config="curl-config"
2084 with_curl_cflags=""
2085 with_curl_libs=""
2086 AC_ARG_WITH(libcurl, [AS_HELP_STRING([--with-libcurl@<:@=PREFIX@:>@], [Path to libcurl.])],
2087 [
2088         if test "x$withval" = "xno"
2089         then
2090                 with_libcurl="no"
2091         else if test "x$withval" = "xyes"
2092         then
2093                 with_libcurl="yes"
2094         else
2095                 if test -f "$withval" && test -x "$withval"
2096                 then
2097                         with_curl_config="$withval"
2098                         with_libcurl="yes"
2099                 else if test -x "$withval/bin/curl-config"
2100                 then
2101                         with_curl_config="$withval/bin/curl-config"
2102                         with_libcurl="yes"
2103                 fi; fi
2104                 with_libcurl="yes"
2105         fi; fi
2106 ],
2107 [
2108         with_libcurl="yes"
2109 ])
2110 if test "x$with_libcurl" = "xyes"
2111 then
2112         with_curl_cflags=`$with_curl_config --cflags 2>/dev/null`
2113         curl_config_status=$?
2114
2115         if test $curl_config_status -ne 0
2116         then
2117                 with_libcurl="no ($with_curl_config failed)"
2118         else
2119                 SAVE_CPPFLAGS="$CPPFLAGS"
2120                 CPPFLAGS="$CPPFLAGS $with_curl_cflags"
2121
2122                 AC_CHECK_HEADERS(curl/curl.h, [], [with_libcurl="no (curl/curl.h not found)"], [])
2123
2124                 CPPFLAGS="$SAVE_CPPFLAGS"
2125         fi
2126 fi
2127 if test "x$with_libcurl" = "xyes"
2128 then
2129         with_curl_libs=`$with_curl_config --libs 2>/dev/null`
2130         curl_config_status=$?
2131
2132         if test $curl_config_status -ne 0
2133         then
2134                 with_libcurl="no ($with_curl_config failed)"
2135         else
2136                 AC_CHECK_LIB(curl, curl_easy_init,
2137                  [with_libcurl="yes"],
2138                  [with_libcurl="no (symbol 'curl_easy_init' not found)"],
2139                  [$with_curl_libs])
2140                 AC_CHECK_DECL(CURLOPT_USERNAME,
2141                  [have_curlopt_username="yes"],
2142                  [have_curlopt_username="no"],
2143                  [[#include <curl/curl.h>]])
2144                 AC_CHECK_DECL(CURLOPT_TIMEOUT_MS,
2145                  [have_curlopt_timeout="yes"],
2146                  [have_curlopt_timeout="no"],
2147                  [[#include <curl/curl.h>]])
2148         fi
2149 fi
2150 if test "x$with_libcurl" = "xyes"
2151 then
2152         SAVE_CPPFLAGS="$CPPFLAGS"
2153         SAVE_LDFLAGS="$LDFLAGS"
2154         CPPFLAGS="$CPPFLAGS $with_curl_cflags"
2155         LDFLAGS="$LDFLAGS $with_curl_libs"
2156         AC_CACHE_CHECK([for CURLINFO_APPCONNECT_TIME],
2157                 [c_cv_have_curlinfo_appconnect_time],
2158                 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2159 [[
2160 #include <curl/curl.h>
2161 ]],
2162 [[
2163 int val = CURLINFO_APPCONNECT_TIME;
2164 return val;
2165 ]]
2166                         )],
2167                         [c_cv_have_curlinfo_appconnect_time="yes"],
2168                         [c_cv_have_curlinfo_appconnect_time="no"]
2169                 )
2170         )
2171         CPPFLAGS="$SAVE_CPPFLAGS"
2172         LDFLAGS="$SAVE_LDFLAGS"
2173 fi
2174 AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
2175 if test "x$c_cv_have_curlinfo_appconnect_time" = "xyes"
2176 then
2177         AC_DEFINE(HAVE_CURLINFO_APPCONNECT_TIME, 1, [Define if curl.h defines CURLINFO_APPCONNECT_TIME.])
2178 fi
2179
2180 if test "x$with_libcurl" = "xyes"
2181 then
2182         BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags"
2183         BUILD_WITH_LIBCURL_LIBS="$with_curl_libs"
2184         AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS)
2185         AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
2186
2187         if test "x$have_curlopt_username" = "xyes"
2188         then
2189                 AC_DEFINE(HAVE_CURLOPT_USERNAME, 1, [Define if libcurl supports CURLOPT_USERNAME option.])
2190         fi
2191
2192         if test "x$have_curlopt_timeout" = "xyes"
2193         then
2194                 AC_DEFINE(HAVE_CURLOPT_TIMEOUT_MS, 1, [Define if libcurl supports CURLOPT_TIMEOUT_MS option.])
2195         fi
2196 fi
2197 # }}}
2198
2199 # --with-libdbi {{{
2200 with_libdbi_cppflags=""
2201 with_libdbi_ldflags=""
2202 AC_ARG_WITH(libdbi, [AS_HELP_STRING([--with-libdbi@<:@=PREFIX@:>@], [Path to libdbi.])],
2203 [
2204         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2205         then
2206                 with_libdbi_cppflags="-I$withval/include"
2207                 with_libdbi_ldflags="-L$withval/lib"
2208                 with_libdbi="yes"
2209         else
2210                 with_libdbi="$withval"
2211         fi
2212 ],
2213 [
2214         with_libdbi="yes"
2215 ])
2216 if test "x$with_libdbi" = "xyes"
2217 then
2218         SAVE_CPPFLAGS="$CPPFLAGS"
2219         CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
2220
2221         AC_CHECK_HEADERS(dbi/dbi.h, [with_libdbi="yes"], [with_libdbi="no (dbi/dbi.h not found)"])
2222
2223         CPPFLAGS="$SAVE_CPPFLAGS"
2224 fi
2225 if test "x$with_libdbi" = "xyes"
2226 then
2227         SAVE_CPPFLAGS="$CPPFLAGS"
2228         SAVE_LDFLAGS="$LDFLAGS"
2229         CPPFLAGS="$CPPFLAGS $with_libdbi_cppflags"
2230         LDFLAGS="$LDFLAGS $with_libdbi_ldflags"
2231
2232         AC_CHECK_LIB(dbi, dbi_initialize, [with_libdbi="yes"], [with_libdbi="no (Symbol 'dbi_initialize' not found)"])
2233
2234         CPPFLAGS="$SAVE_CPPFLAGS"
2235         LDFLAGS="$SAVE_LDFLAGS"
2236 fi
2237 if test "x$with_libdbi" = "xyes"
2238 then
2239         BUILD_WITH_LIBDBI_CPPFLAGS="$with_libdbi_cppflags"
2240         BUILD_WITH_LIBDBI_LDFLAGS="$with_libdbi_ldflags"
2241         BUILD_WITH_LIBDBI_LIBS="-ldbi"
2242         AC_SUBST(BUILD_WITH_LIBDBI_CPPFLAGS)
2243         AC_SUBST(BUILD_WITH_LIBDBI_LDFLAGS)
2244         AC_SUBST(BUILD_WITH_LIBDBI_LIBS)
2245 fi
2246 AM_CONDITIONAL(BUILD_WITH_LIBDBI, test "x$with_libdbi" = "xyes")
2247 # }}}
2248
2249 # --with-libesmtp {{{
2250 AC_ARG_WITH(libesmtp, [AS_HELP_STRING([--with-libesmtp@<:@=PREFIX@:>@], [Path to libesmtp.])],
2251 [
2252         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2253         then
2254                 LDFLAGS="$LDFLAGS -L$withval/lib"
2255                 CPPFLAGS="$CPPFLAGS -I$withval/include -D_THREAD_SAFE"
2256                 with_libesmtp="yes"
2257         else
2258                 with_libesmtp="$withval"
2259         fi
2260 ],
2261 [
2262         with_libesmtp="yes"
2263 ])
2264 if test "x$with_libesmtp" = "xyes"
2265 then
2266         AC_CHECK_LIB(esmtp, smtp_create_session,
2267         [
2268                 AC_DEFINE(HAVE_LIBESMTP, 1, [Define to 1 if you have the esmtp library (-lesmtp).])
2269         ], [with_libesmtp="no (libesmtp not found)"])
2270 fi
2271 if test "x$with_libesmtp" = "xyes"
2272 then
2273         AC_CHECK_HEADERS(libesmtp.h,
2274         [
2275                 AC_DEFINE(HAVE_LIBESMTP_H, 1, [Define to 1 if you have the <libesmtp.h> header file.])
2276         ], [with_libesmtp="no (libesmtp.h not found)"])
2277 fi
2278 if test "x$with_libesmtp" = "xyes"
2279 then
2280         collect_libesmtp=1
2281 else
2282         collect_libesmtp=0
2283 fi
2284 AC_DEFINE_UNQUOTED(COLLECT_LIBESMTP, [$collect_libesmtp],
2285         [Wether or not to use the esmtp library])
2286 AM_CONDITIONAL(BUILD_WITH_LIBESMTP, test "x$with_libesmtp" = "xyes")
2287 # }}}
2288
2289 # --with-libganglia {{{
2290 AC_ARG_WITH(libganglia, [AS_HELP_STRING([--with-libganglia@<:@=PREFIX@:>@], [Path to libganglia.])],
2291 [
2292  if test -f "$withval" && test -x "$withval"
2293  then
2294          with_libganglia_config="$withval"
2295          with_libganglia="yes"
2296  else if test -f "$withval/bin/ganglia-config" && test -x "$withval/bin/ganglia-config"
2297  then
2298          with_libganglia_config="$withval/bin/ganglia-config"
2299          with_libganglia="yes"
2300  else if test -d "$withval"
2301  then
2302          GANGLIA_CPPFLAGS="-I$withval/include"
2303          GANGLIA_LDFLAGS="-L$withval/lib"
2304          with_libganglia="yes"
2305  else
2306          with_libganglia="$withval"
2307  fi; fi; fi
2308 ],
2309 [
2310  with_libganglia="yes"
2311 ])
2312
2313 if test "x$with_libganglia" = "xyes"
2314 then
2315         if test "x$with_libganglia_config" != "x"
2316         then
2317                 if test "x$GANGLIA_CPPFLAGS" = "x"
2318                 then
2319                         GANGLIA_CPPFLAGS=`"$with_libganglia_config" --cflags 2>/dev/null`
2320                 fi
2321
2322                 if test "x$GANGLIA_LDFLAGS" = "x"
2323                 then
2324                         GANGLIA_LDFLAGS=`"$with_libganglia_config" --ldflags 2>/dev/null`
2325                 fi
2326
2327                 if test "x$GANGLIA_LIBS" = "x"
2328                 then
2329                         GANGLIA_LIBS=`"$with_libganglia_config" --libs 2>/dev/null`
2330                 fi
2331         else
2332                 GANGLIA_LIBS="-lganglia"
2333         fi
2334 fi
2335
2336 SAVE_CPPFLAGS="$CPPFLAGS"
2337 SAVE_LDFLAGS="$LDFLAGS"
2338 CPPFLAGS="$CPPFLAGS $GANGLIA_CPPFLAGS"
2339 LDFLAGS="$LDFLAGS $GANGLIA_LDFLAGS"
2340
2341 if test "x$with_libganglia" = "xyes"
2342 then
2343         AC_CHECK_HEADERS(gm_protocol.h,
2344         [
2345                 AC_DEFINE(HAVE_GM_PROTOCOL_H, 1,
2346                           [Define to 1 if you have the <gm_protocol.h> header file.])
2347         ], [with_libganglia="no (gm_protocol.h not found)"])
2348 fi
2349
2350 if test "x$with_libganglia" = "xyes"
2351 then
2352         AC_CHECK_LIB(ganglia, xdr_Ganglia_value_msg,
2353         [
2354                 AC_DEFINE(HAVE_LIBGANGLIA, 1,
2355                           [Define to 1 if you have the ganglia library (-lganglia).])
2356         ], [with_libganglia="no (symbol xdr_Ganglia_value_msg not found)"])
2357 fi
2358
2359 CPPFLAGS="$SAVE_CPPFLAGS"
2360 LDFLAGS="$SAVE_LDFLAGS"
2361
2362 AC_SUBST(GANGLIA_CPPFLAGS)
2363 AC_SUBST(GANGLIA_LDFLAGS)
2364 AC_SUBST(GANGLIA_LIBS)
2365 AM_CONDITIONAL(BUILD_WITH_LIBGANGLIA, test "x$with_libganglia" = "xyes")
2366 # }}}
2367
2368 # --with-libgcrypt {{{
2369 GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS"
2370 GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS"
2371 GCRYPT_LIBS="$GCRYPT_LIBS"
2372 AC_ARG_WITH(libgcrypt, [AS_HELP_STRING([--with-libgcrypt@<:@=PREFIX@:>@], [Path to libgcrypt.])],
2373 [
2374  if test -f "$withval" && test -x "$withval"
2375  then
2376          with_libgcrypt_config="$withval"
2377          with_libgcrypt="yes"
2378  else if test -f "$withval/bin/gcrypt-config" && test -x "$withval/bin/gcrypt-config"
2379  then
2380          with_libgcrypt_config="$withval/bin/gcrypt-config"
2381          with_libgcrypt="yes"
2382  else if test -d "$withval"
2383  then
2384          GCRYPT_CPPFLAGS="$GCRYPT_CPPFLAGS -I$withval/include"
2385          GCRYPT_LDFLAGS="$GCRYPT_LDFLAGS -L$withval/lib"
2386          with_libgcrypt="yes"
2387  else
2388          with_libgcrypt_config="gcrypt-config"
2389          with_libgcrypt="$withval"
2390  fi; fi; fi
2391 ],
2392 [
2393  with_libgcrypt_config="libgcrypt-config"
2394  with_libgcrypt="yes"
2395 ])
2396
2397 if test "x$with_libgcrypt" = "xyes" && test "x$with_libgcrypt_config" != "x"
2398 then
2399         if test "x$GCRYPT_CPPFLAGS" = "x"
2400         then
2401                 GCRYPT_CPPFLAGS=`"$with_libgcrypt_config" --cflags 2>/dev/null`
2402         fi
2403
2404         if test "x$GCRYPT_LIBS" = "x"
2405         then
2406                 GCRYPT_LIBS=`"$with_libgcrypt_config" --libs 2>/dev/null`
2407         fi
2408 fi
2409
2410 SAVE_CPPFLAGS="$CPPFLAGS"
2411 SAVE_LDFLAGS="$LDFLAGS"
2412 SAVE_LIBS="$LIBS"
2413 CPPFLAGS="$CPPFLAGS $GCRYPT_CPPFLAGS"
2414 LDFLAGS="$LDFLAGS $GCRYPT_LDFLAGS"
2415 LIBS="$LIBS $GCRYPT_LIBS"
2416
2417 if test "x$with_libgcrypt" = "xyes"
2418 then
2419         if test "x$GCRYPT_CPPFLAGS" != "x"
2420         then
2421                 AC_MSG_NOTICE([gcrypt CPPFLAGS: $GCRYPT_CPPFLAGS])
2422         fi
2423         AC_CHECK_HEADERS(gcrypt.h,
2424                 [with_libgcrypt="yes"],
2425                 [with_libgcrypt="no (gcrypt.h not found)"])
2426 fi
2427
2428 if test "x$with_libgcrypt" = "xyes"
2429 then
2430         AC_CHECK_LIB(gcrypt, gcry_md_hash_buffer,
2431                 [with_libgcrypt="yes"],
2432                 [with_libgcrypt="no (symbol gcry_md_hash_buffer not found)"])
2433 fi
2434
2435 CPPFLAGS="$SAVE_CPPFLAGS"
2436 LDFLAGS="$SAVE_LDFLAGS"
2437 LIBS="$SAVE_LIBS"
2438
2439 if test "x$with_libgcrypt" = "xyes"
2440 then
2441         AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to 1 if you have the gcrypt library (-lgcrypt).])
2442 fi
2443
2444 AC_SUBST(GCRYPT_CPPFLAGS)
2445 AC_SUBST(GCRYPT_LDFLAGS)
2446 AC_SUBST(GCRYPT_LIBS)
2447 AM_CONDITIONAL(BUILD_WITH_LIBGCRYPT, test "x$with_libgcrypt" = "xyes")
2448 # }}}
2449
2450 # --with-libgps {{{
2451 with_libgps_cflags=""
2452 with_libgps_ldflags=""
2453 AC_ARG_WITH(libgps, [AS_HELP_STRING([--with-libgps@<:@=PREFIX@:>@], [Path to libgps.])],
2454 [
2455         if test "x$withval" != "xno" && test "x$withval" != "xyes"
2456         then
2457                 with_libgps_cflags="-I$withval/include"
2458                 with_libgps_ldflags="-L$withval/lib"
2459                 with_libgps="yes"
2460         else
2461                 with_libgps="$withval"
2462         fi
2463 ],
2464 [
2465         with_libgps="yes"
2466 ])
2467 if test "x$with_libgps" = "xyes"
2468 then
2469         SAVE_CFLAGS="$CFLAGS"
2470         CFLAGS="$CFLAGS $with_libgps_cflags"
2471
2472         AC_CHECK_HEADERS(gps.h, [with_libgps="yes"], [with_libgps="no (gps.h not found)"])
2473
2474         CFLAGS="$SAVE_CFLAGS"
2475 fi
2476 if test "x$with_libgps" = "xyes"
2477 then
2478         SAVE_CFLAGS="$CFLAGS"
2479         SAVE_LDFLAGS="$LDFLAGS"
2480         CFLAGS="$CFLAGS $with_libgps_cflags"
2481         LDFLAGS="$LDFLAGS $with_libgps_ldflags"
2482
2483         AC_CHECK_LIB(gps, gps_open, [with_libgps="yes"], [with_libgps="no (symbol gps_open not found)"])
2484
2485         CFLAGS="$SAVE_CFLAGS"
2486         LDFLAGS="$SAVE_LDFLAGS"
2487 fi
2488 if test "x$with_libgps" = "xyes"
2489 then
2490         BUILD_WITH_LIBGPS_CFLAGS="$with_libgps_cflags"
2491         BUILD_WITH_LIBGPS_LDFLAGS="$with_libgps_ldflags"
2492         BUILD_WITH_LIBGPS_LIBS="-lgps"
2493         AC_SUBST(BUILD_WITH_LIBGPS_CFLAGS)
2494         AC_SUBST(BUILD_WITH_LIBGPS_LDFLAGS)
2495         AC_SUBST(BUILD_WITH_LIBGPS_LIBS)
2496 fi
2497 AM_CONDITIONAL(BUILD_WITH_LIBGPS, test "x$with_libgps" = "xyes")
2498 # }}}
2499
2500 # --with-libgrpc++ {{{
2501 with_libgrpcpp_cppflags=""
2502 with_libgrpcpp_ldflags=""
2503 AC_ARG_WITH([libgrpc++], [AS_HELP_STRING([--with-libgrpc++@<:@=PREFIX@:>@], [Path to libgrpc++.])],
2504   [
2505     with_grpcpp="$withval"
2506     if test "x$withval" != "xno" && test "x$withval" != "xyes"
2507     then
2508       with_libgrpcpp_cppflags="-I$withval/include"
2509       with_libgrpcpp_ldflags="-L$withval/lib"
2510       with_libgrpcpp="yes"
2511     fi
2512     if test "x$withval" = "xno"
2513     then
2514       with_libgrpcpp="no (disabled on command line)"
2515     fi
2516   ],
2517   [withval="yes"]
2518 )
2519 if test "x$withval" = "xyes"
2520 then
2521 PKG_CHECK_MODULES([GRPCPP], [grpc++],
2522   [with_libgrpcpp="yes"],
2523   [with_libgrpcpp="no (pkg-config could not find libgrpc++)"]
2524 )
2525 fi
2526
2527 if test "x$withval" != "xno"
2528 then
2529   AC_MSG_CHECKING([whether $CXX accepts -std=c++11])
2530   if test_cxx_flags -std=c++11; then
2531     AC_MSG_RESULT([yes])
2532   else
2533     AC_MSG_RESULT([no])
2534     with_libgrpcpp="no (requires C++11 support)"
2535   fi
2536 fi
2537
2538 if test "x$with_libgrpcpp" = "xyes"
2539 then
2540   AC_LANG_PUSH(C++)
2541   SAVE_CPPFLAGS="$CPPFLAGS"
2542   CPPFLAGS="-std=c++11 $with_libgrpcpp_cppflags $GRPCPP_CFLAGS $CPPFLAGS"
2543   AC_CHECK_HEADERS([grpc++/grpc++.h], [],
2544     [with_libgrpcpp="no (<grpc++/grpc++.h> not found)"]
2545   )
2546   CPPFLAGS="$SAVE_CPPFLAGS"
2547   AC_LANG_POP(C++)
2548 fi
2549 if test "x$with_libgrpcpp" = "xyes"
2550 then
2551   AC_LANG_PUSH(C++)
2552   SAVE_CPPFLAGS="$CPPFLAGS"
2553   SAVE_LDFLAGS="$LDFLAGS"
2554   SAVE_LIBS="$LIBS"
2555   CPPFLAGS="-std=c++11 $with_libgrpcpp_cppflags $GRPCPP_CFLAGS $CPPFLAGS"
2556   LDFLAGS="$with_libgrpcpp_ldflags"
2557   if test "x$GRPCPP_LIBS" = "x"
2558   then
2559     LIBS="-lgrpc++"
2560   else
2561     LIBS="$GRPCPP_LIBS"
2562   fi
2563   AC_LINK_IFELSE(
2564     [AC_LANG_PROGRAM(
2565       [[#include <grpc++/grpc++.h>]],
2566       [[grpc::ServerBuilder sb;]]
2567     )],
2568     [
2569       with_libgrpcpp="yes"
2570       if test "x$GRPCPP_LIBS" = "x"
2571       then
2572         GRPCPP_LIBS="-lgrpc++"
2573       fi
2574     ],
2575     [with_libgrpcpp="no (libgrpc++ not found)"]
2576   )
2577   CPPFLAGS="$SAVE_CPPFLAGS"
2578   LDFLAGS="$SAVE_LDFLAGS"
2579   LIBS="$SAVE_LIBS"
2580   AC_LANG_POP(C++)
2581 fi
2582 BUILD_WITH_LIBGRPCPP_CPPFLAGS="-std=c++11 $with_libgrpcpp_cppflags $GRPCPP_CFLAGS"
2583 BUILD_WITH_LIBGRPCPP_LDFLAGS="$with_libgrpcpp_ldflags"
2584 BUILD_WITH_LIBGRPCPP_LIBS="$GRPCPP_LIBS"
2585 AC_SUBST([BUILD_WITH_LIBGRPCPP_CPPFLAGS])
2586 AC_SUBST([BUILD_WITH_LIBGRPCPP_LDFLAGS])
2587 AC_SUBST([BUILD_WITH_LIBGRPCPP_LIBS])
2588 # }}}
2589
2590 # --with-libiptc {{{
2591 AC_ARG_WITH(libiptc, [AS_HELP_STRING([--with-libiptc@<:@=PREFIX@:>@], [Path to libiptc.])],
2592 [
2593         if test "x$withval" = "xyes"
2594         then
2595                 with_libiptc="pkgconfig"
2596         else if test "x$withval" = "xno"
2597         then
2598                 with_libiptc="no"
2599         else
2600                 with_libiptc="yes"
2601                 with_libiptc_cflags="-I$withval/include"
2602                 with_libiptc_libs="-L$withval/lib"
2603         fi; fi
2604 ],
2605 [
2606         if test "x$ac_system" = "xLinux"
2607         then
2608                 with_libiptc="pkgconfig"
2609         else
2610                 with_libiptc="no (Linux only)"
2611         fi
2612 ])
2613
2614 if test "x$with_libiptc" = "xpkgconfig"
2615 then
2616         $PKG_CONFIG --exists 'libiptc' 2>/dev/null
2617         if test $? -ne 0
2618         then
2619                 with_libiptc="no (pkg-config doesn't know libiptc)"
2620         fi
2621 fi
2622 if test "x$with_libiptc" = "xpkgconfig"
2623 then
2624         with_libiptc_cflags="`$PKG_CONFIG --cflags 'libiptc'`"
2625         if test $? -ne 0
2626         then
2627                 with_libiptc="no ($PKG_CONFIG failed)"
2628         fi
2629         with_libiptc_libs="`$PKG_CONFIG --libs 'libiptc'`"
2630         if test $? -ne 0
2631         then
2632                 with_libiptc="no ($PKG_CONFIG failed)"
2633         fi
2634 fi
2635
2636 SAVE_CPPFLAGS="$CPPFLAGS"
2637 CPPFLAGS="$CPPFLAGS $with_libiptc_cflags"
2638
2639 # check whether the header file for libiptc is available.
2640 if test "x$with_libiptc" = "xpkgconfig"
2641 then
2642         AC_CHECK_HEADERS(libiptc/libiptc.h libiptc/libip6tc.h, ,
2643                         [with_libiptc="no (header file missing)"])
2644 fi
2645 # If the header file is available, check for the required type declaractions.
2646 # They may be missing in old versions of libiptc. In that case, they will be
2647 # declared in the iptables plugin.
2648 if test "x$with_libiptc" = "xpkgconfig"
2649 then
2650         AC_CHECK_TYPES([iptc_handle_t, ip6tc_handle_t], [], [])
2651 fi
2652 # Check for the iptc_init symbol in the library.
2653 # This could be in iptc or ip4tc
2654 if test "x$with_libiptc" = "xpkgconfig"
2655 then
2656         SAVE_LIBS="$LIBS"
2657         AC_SEARCH_LIBS(iptc_init, [iptc ip4tc],
2658                         [with_libiptc="pkgconfig"],
2659                         [with_libiptc="no"],
2660                         [$with_libiptc_libs])
2661         LIBS="$SAVE_LIBS"
2662 fi
2663 if test "x$with_libiptc" = "xpkgconfig"
2664 then
2665         with_libiptc="yes"
2666 fi
2667
2668 CPPFLAGS="$SAVE_CPPFLAGS"
2669
2670 AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")
2671 if test "x$with_libiptc" = "xyes"
2672 then
2673         BUILD_WITH_LIBIPTC_CPPFLAGS="$with_libiptc_cflags"
2674         BUILD_WITH_LIBIPTC_LDFLAGS="$with_libiptc_libs"
2675         AC_SUBST(BUILD_WITH_LIBIPTC_CPPFLAGS)
2676         AC_SUBST(BUILD_WITH_LIBIPTC_LDFLAGS)
2677 fi
2678 # }}}
2679
2680 # --with-libdpdk {{{
2681 AC_ARG_VAR([LIBDPDK_CPPFLAGS], [Preprocessor flags for libdpdk])
2682 AC_ARG_VAR([LIBDPDK_CFLAGS], [Compiler flags for libdpdk])
2683 AC_ARG_VAR([LIBDPDK_LDFLAGS], [Linker flags for libdpdk])
2684 AC_ARG_VAR([LIBDPDK_LIBS], [Libraries to link for libdpdk])
2685
2686 AC_ARG_WITH([libdpdk],
2687   [AS_HELP_STRING([--without-libdpdk], [Disable libdpdk.])],
2688   [with_libdpdk="$withval"],
2689   [with_libdpdk="yes"]
2690 )
2691
2692 if test "x$with_libdpdk" != "xno"; then
2693   PKG_CHECK_MODULES([DPDK], [libdpdk], [],
2694                     [AC_MSG_NOTICE([no DPDK pkg-config, using defaults])])
2695   if test "x$LIBDPDK_CPPFLAGS" = "x"; then
2696     LIBDPDK_CPPFLAGS="-I/usr/include/dpdk"
2697   fi
2698   if test "x$LIBDPDK_CFLAGS" = "x"; then
2699       LIBDPDK_CFLAGS="$DPDK_CFLAGS"
2700       LIBDPDK_CPPFLAGS="$LIBDPDK_CPPFLAGS $DPDK_CFLAGS"
2701   fi
2702   if test "x$LIBDPDK_LIBS" = "x"; then
2703       if test "x$DPDK_LIBS" != "x"; then
2704           LIBDPDK_LIBS="$DPDK_LIBS"
2705       else
2706           LIBDPDK_LIBS="-ldpdk"
2707       fi
2708   fi
2709   SAVE_CPPFLAGS="$CPPFLAGS"
2710   CPPFLAGS="$LIBDPDK_CPPFLAGS $CPPFLAGS"
2711   SAVE_CFLAGS="$CFLAGS"
2712   CFLAGS="$LIBDPDK_CFLAGS $CFLAGS"
2713   AC_CHECK_HEADERS([rte_config.h],
2714     [
2715       with_libdpdk="yes"
2716       AC_PREPROC_IFELSE(
2717         [
2718           AC_LANG_SOURCE(
2719             [[
2720               #include <rte_version.h>
2721               #if RTE_VERSION < RTE_VERSION_NUM(16,7,0,0)
2722               #error "required DPDK >= 16.07"
2723               #endif
2724             ]]
2725           )
2726         ],
2727         [dpdk_keepalive="yes"],
2728         [dpdk_keepalive="no (DPDK version < 16.07)"]
2729       )
2730     ],
2731     [with_libdpdk="no (rte_config.h not found)"]
2732   )
2733   CPPFLAGS="$SAVE_CPPFLAGS"
2734   CFLAGS="$SAVE_CFLAGS"
2735 fi
2736
2737 if test "x$with_libdpdk" = "xyes"; then
2738   SAVE_LDFLAGS="$LDFLAGS"
2739   LDFLAGS="$LIBDPDK_LDFLAGS $LDFLAGS"
2740   AC_CHECK_LIB([dpdk], [rte_eal_init],
2741     [with_libdpdk="yes"],
2742     [with_libdpdk="no (symbol 'rte_eal_init' not found)"]
2743   )
2744   LDFLAGS="$SAVE_LDFLAGS"
2745 fi
2746
2747 # }}}
2748
2749 # --with-java {{{
2750 with_java_home="$JAVA_HOME"
2751 if test "x$with_java_home" = "x"
2752 then
2753         with_java_home="/usr/lib/jvm"
2754 fi
2755 JAVAC="$JAVAC"
2756 JAR="$JAR"
2757 AC_ARG_WITH(java, [AS_HELP_STRING([--with-java@<:@=PREFIX@:>@], [Path to Java home.])],
2758 [
2759         if test "x$withval" = "xno"
2760         then
2761                 with_java="no"
2762         else if test "x$withval" = "xyes"
2763         then
2764                 with_java="yes"
2765         else
2766                 with_java_home="$withval"
2767                 with_java="yes"
2768         fi; fi
2769 ],
2770 [with_java="yes"])
2771 if test "x$with_java" = "xyes"
2772 then
2773         if test -d "$with_java_home"
2774         then
2775                 AC_MSG_CHECKING([for jni.h])
2776                 TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
2777                 if test "x$TMPVAR" != "x"
2778                 then
2779                         AC_MSG_RESULT([found in $TMPVAR])
2780                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2781                 else
2782                         AC_MSG_RESULT([not found])
2783                 fi
2784
2785                 AC_MSG_CHECKING([for jni_md.h])
2786                 TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
2787                 if test "x$TMPVAR" != "x"
2788                 then
2789                         AC_MSG_RESULT([found in $TMPVAR])
2790                         JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
2791                 else
2792                         AC_MSG_RESULT([not found])
2793                 fi
2794
2795                 AC_MSG_CHECKING([for libjvm.so])
2796                 TMPVAR=`find -L "$with_java_home" -type f \( -name libjvm.so -o -name libjvm.dylib \) -exec 'dirname' '{}' ';' 2>/dev/null | LC_ALL=C sort | head -n 1`
2797                 if test "x$TMPVAR" != "x"
2798                 then
2799                         AC_MSG_RESULT([found in $TMPVAR])
2800                         JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
2801                 else
2802                         AC_MSG_RESULT([not found])
2803                 fi
2804
2805                 if test "x$JAVAC" = "x"
2806                 then
2807                         AC_MSG_CHECKING([for javac])
2808                         TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | LC_ALL=C sort | head -n 1`
2809                         if test "x$TMPVAR" != "x"
2810                         then
2811                                 JAVAC="$TMPVAR"
2812                                 AC_MSG_RESULT([$JAVAC])
2813                         else
2814                                 AC_MSG_RESULT([not found])
2815                         fi
2816                 fi
2817                 if test "x$JAR" = "x"
2818                 then
2819                         AC_MSG_CHECKING([for jar])
2820                         TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | LC_ALL=C sort | head -n 1`
2821                         if test "x$TMPVAR" != "x"
2822                         then
2823                                 JAR="$TMPVAR"
2824                                 AC_MSG_RESULT([$JAR])
2825                         else
2826                                 AC_MSG_RESULT([not found])
2827                         fi
2828                 fi
2829         else if test "x$with_java_home" != "x"
2830         then
2831                 AC_MSG_WARN([JAVA_HOME: No such directory: $with_java_home])
2832         fi; fi
2833 fi
2834
2835 if test "x$JAVA_CPPFLAGS" != "x"
2836 then
2837         AC_MSG_NOTICE([Building with JAVA_CPPFLAGS set to: $JAVA_CPPFLAGS])
2838 fi
2839 if test "x$JAVA_CFLAGS" != "x"
2840 then
2841         AC_MSG_NOTICE([Building with JAVA_CFLAGS set to: $JAVA_CFLAGS])
2842 fi
2843 if test "x$JAVA_LDFLAGS" != "x"
2844 then
2845         AC_MSG_NOTICE([Building with JAVA_LDFLAGS set to: $JAVA_LDFLAGS])
2846 fi
2847 if test "x$JAVA_LIBS" != "x"
2848 then
2849         AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2850 fi
2851 if test "x$JAVAC" = "x"
2852 then
2853         with_javac_path="$PATH"
2854         if test "x$with_java_home" != "x"
2855         then
2856                 with_javac_path="$with_java_home:with_javac_path"
2857                 if test -d "$with_java_home/bin"
2858                 then
2859                         with_javac_path="$with_java_home/bin:with_javac_path"
2860                 fi
2861         fi
2862
2863         AC_PATH_PROG(JAVAC, javac, [], "$with_javac_path")
2864 fi
2865 if test "x$JAVAC" = "x"
2866 then
2867         with_java="no (javac not found)"
2868 fi
2869 if test "x$JAR" = "x"
2870 then
2871         with_jar_path="$PATH"
2872         if test "x$with_java_home" != "x"
2873         then
2874                 with_jar_path="$with_java_home:$with_jar_path"
2875                 if test -d "$with_java_home/bin"
2876                 then
2877                         with_jar_path="$with_java_home/bin:$with_jar_path"
2878                 fi
2879         fi
2880
2881         AC_PATH_PROG(JAR, jar, [], "$with_jar_path")
2882 fi
2883 if test "x$JAR" = "x"
2884 then
2885         with_java="no (jar not found)"
2886 fi
2887
2888 SAVE_CPPFLAGS="$CPPFLAGS"
2889 SAVE_CFLAGS="$CFLAGS"
2890 SAVE_LDFLAGS="$LDFLAGS"
2891 SAVE_LIBS="$LIBS"
2892 CPPFLAGS="$CPPFLAGS $JAVA_CPPFLAGS"
2893 CFLAGS="$CFLAGS $JAVA_CFLAGS"
2894 LDFLAGS="$LDFLAGS $JAVA_LDFLAGS"
2895 LIBS="$LIBS $JAVA_LIBS"
2896
2897 if test "x$with_java" = "xyes"
2898 then
2899         AC_CHECK_HEADERS(jni.h, [], [with_java="no (jni.h not found)"])
2900 fi
2901 if test "x$with_java" = "xyes"
2902 then
2903         AC_CHECK_LIB(jvm, JNI_CreateJavaVM,
2904         [with_java="yes"],
2905         [with_java="no (Symbol 'JNI_CreateJavaVM' not found)"],
2906         [$JAVA_LIBS $PTHREAD_LIBS])
2907 fi
2908 if test "x$with_java" = "xyes"
2909 then
2910         JAVA_LIBS="$JAVA_LIBS -ljvm"
2911         AC_MSG_NOTICE([Building with JAVA_LIBS set to: $JAVA_LIBS])
2912 fi
2913
2914 CPPFLAGS="$SAVE_CPPFLAGS"
2915 CFLAGS="$SAVE_CFLAGS"
2916 LDFLAGS="$SAVE_LDFLAGS"
2917 LIBS="$SAVE_LIBS"
2918
2919 AC_SUBST(JAVA_CPPFLAGS)
2920 AC_SUBST(JAVA_CFLAGS)
2921 AC_SUBST(JAVA_LDFLAGS)
2922 AC_SUBST(JAVA_LIBS)
2923 AM_CONDITIONAL(BUILD_WITH_JAVA, test "x$with_java" = "xyes")
2924 # }}}
2925
2926 # --with-libldap {{{
2927 AC_ARG_WITH(libldap, [AS_HELP_STRING([--with-libldap@<:@=PREFIX@:>@], [Path to libldap.])],
2928 [
2929  if test "x$withval" = "xyes"
2930  then
2931          with_libldap="yes"
2932  else if test "x$withval" = "xno"
2933  then
2934          with_libldap="no"
2935  else
2936          with_libldap="yes"
2937          LIBLDAP_CPPFLAGS="$LIBLDAP_CPPFLAGS -I$withval/include"
2938          LIBLDAP_LDFLAGS="$LIBLDAP_LDFLAGS -L$withval/lib"
2939  fi; fi
2940 ],
2941 [with_libldap="yes"])
2942
2943 SAVE_CPPFLAGS="$CPPFLAGS"
2944 SAVE_LDFLAGS="$LDFLAGS"
2945
2946 CPPFLAGS="$CPPFLAGS $LIBLDAP_CPPFLAGS"
2947 LDFLAGS="$LDFLAGS $LIBLDAP_LDFLAGS"
2948
2949 if test "x$with_libldap" = "xyes"
2950 then
2951         if test "x$LIBLDAP_CPPFLAGS" != "x"
2952         then
2953                 AC_MSG_NOTICE([libldap CPPFLAGS: $LIBLDAP_CPPFLAGS])
2954         fi
2955         AC_CHECK_HEADERS(ldap.h,
2956         [with_libldap="yes"],
2957         [with_libldap="no ('ldap.h' not found)"])
2958 fi
2959 if test "x$with_libldap" = "xyes"
2960 then
2961         if test "x$LIBLDAP_LDFLAGS" != "x"
2962         then
2963                 AC_MSG_NOTICE([libldap LDFLAGS: $LIBLDAP_LDFLAGS])
2964         fi
2965         AC_CHECK_LIB(ldap, ldap_initialize,
2966         [with_libldap="yes"],
2967         [with_libldap="no (symbol 'ldap_initialize' not found)"])
2968
2969 fi
2970
2971 CPPFLAGS="$SAVE_CPPFLAGS"
2972 LDFLAGS="$SAVE_LDFLAGS"
2973
2974 if test "x$with_libldap" = "xyes"
2975 then
2976         BUILD_WITH_LIBLDAP_CPPFLAGS="$LIBLDAP_CPPFLAGS"
2977         BUILD_WITH_LIBLDAP_LDFLAGS="$LIBLDAP_LDFLAGS"
2978         AC_SUBST(BUILD_WITH_LIBLDAP_CPPFLAGS)
2979         AC_SUBST(BUILD_WITH_LIBLDAP_LDFLAGS)
2980 fi
2981 AM_CONDITIONAL(BUILD_WITH_LIBLDAP, test "x$with_libldap" = "xyes")
2982 # }}}
2983
2984 # --with-liblua {{{
2985 AC_ARG_VAR([LIBLUA_PKG_CONFIG_NAME], [Name of liblua used by pkg-config])
2986 if test "x$LIBLUA_PKG_CONFIG_NAME" != "x"
2987 then
2988   PKG_CHECK_MODULES([LUA], [$LIBLUA_PKG_CONFIG_NAME],
2989     [with_liblua="yes"],
2990     [with_liblua="no"]
2991   )
2992 else
2993   PKG_CHECK_MODULES([LUA], [lua],
2994     [with_liblua="yes"],
2995     [
2996       PKG_CHECK_MODULES([LUA], [lua-5.3],
2997         [with_liblua="yes"],
2998         [
2999           PKG_CHECK_MODULES([LUA], [lua5.3],
3000             [with_liblua="yes"],
3001             [
3002               PKG_CHECK_MODULES([LUA], [lua-5.2],
3003                 [with_liblua="yes"],
3004                 [
3005                   PKG_CHECK_MODULES([LUA], [lua5.2],
3006                     [with_liblua="yes"],
3007                     [
3008                       PKG_CHECK_MODULES([LUA], [lua-5.1],
3009                         [with_liblua="yes"],
3010                         [
3011                           PKG_CHECK_MODULES([LUA], [lua5.1],
3012                             [with_liblua="yes"],
3013                             [with_liblua="no (pkg-config cannot find liblua)"]
3014                           )
3015                         ]
3016                       )
3017                     ]
3018                   )
3019                 ]
3020               )
3021             ]
3022           )
3023         ]
3024       )
3025     ]
3026   )
3027 fi
3028
3029 if test "x$with_liblua" = "xyes"
3030 then
3031   SAVE_CPPFLAGS="$CPPFLAGS"
3032   CPPFLAGS="$CPPFLAGS $LUA_CFLAGS"
3033
3034   AC_CHECK_HEADERS([lua.h lauxlib.h lualib.h],
3035     [with_liblua="yes"],
3036     [with_liblua="no (header not found)"]
3037   )
3038
3039   CPPFLAGS="$SAVE_CPPFLAGS"
3040 fi
3041
3042 if test "x$with_liblua" = "xyes"
3043 then
3044   SAVE_LIBS="$LIBS"
3045   LIBS="$LIBS $LUA_LIBS"
3046
3047   AC_CHECK_FUNC([lua_settop],
3048     [with_liblua="yes"],
3049     [with_liblua="no (symbol 'lua_settop' not found)"]
3050   )
3051
3052   LIBS="$SAVE_LIBS"
3053 fi
3054
3055 if test "x$with_liblua" = "xyes"
3056 then
3057     BUILD_WITH_LIBLUA_CFLAGS="$LUA_CFLAGS"
3058     BUILD_WITH_LIBLUA_LIBS="$LUA_LIBS"
3059 fi
3060 AC_SUBST(BUILD_WITH_LIBLUA_CFLAGS)
3061 AC_SUBST(BUILD_WITH_LIBLUA_LIBS)
3062 # }}}
3063
3064 # --with-liblvm2app {{{
3065 with_liblvm2app_cppflags=""
3066 with_liblvm2app_ldflags=""
3067 AC_ARG_WITH(liblvm2app, [AS_HELP_STRING([--with-liblvm2app@<:@=PREFIX@:>@], [Path to liblvm2app.])],
3068 [
3069         if test "x$withval" = "xno"
3070         then
3071                 with_liblvm2app="no"
3072         else
3073                 with_liblvm2app="yes"
3074                 if test "x$withval" != "xyes"
3075                 then
3076                         with_liblvm2app_cppflags="-I$withval/include"
3077                         with_liblvm2app_ldflags="-L$withval/lib"
3078                 fi
3079         fi
3080 ],
3081 [
3082         if test "x$ac_system" = "xLinux"
3083         then
3084                 with_liblvm2app="yes"
3085         else
3086                 with_liblvm2app="no (Linux only library)"
3087         fi
3088 ])
3089 if test "x$with_liblvm2app" = "xyes"
3090 then
3091         SAVE_CPPFLAGS="$CPPFLAGS"
3092         CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags"
3093
3094         AC_CHECK_HEADERS(lvm2app.h, [with_liblvm2app="yes"], [with_liblvm2app="no (lvm2app.h not found)"])
3095
3096         CPPFLAGS="$SAVE_CPPFLAGS"
3097 fi
3098
3099 if test "x$with_liblvm2app" = "xyes"
3100 then
3101         SAVE_CPPFLAGS="$CPPFLAGS"
3102         SAVE_LDFLAGS="$LDFLAGS"
3103         CPPFLAGS="$CPPFLAGS $with_liblvm2app_cppflags"
3104         LDFLAGS="$LDFLAGS $with_liblvm2app_ldflags"
3105
3106         AC_CHECK_LIB(lvm2app, lvm_lv_get_property, [with_liblvm2app="yes"], [with_liblvm2app="no (Symbol 'lvm_lv_get_property' not found)"])
3107
3108         CPPFLAGS="$SAVE_CPPFLAGS"
3109         LDFLAGS="$SAVE_LDFLAGS"
3110 fi
3111 if test "x$with_liblvm2app" = "xyes"
3112 then
3113         BUILD_WITH_LIBLVM2APP_CPPFLAGS="$with_liblvm2app_cppflags"
3114         BUILD_WITH_LIBLVM2APP_LDFLAGS="$with_liblvm2app_ldflags"
3115         BUILD_WITH_LIBLVM2APP_LIBS="-llvm2app"
3116         AC_SUBST(BUILD_WITH_LIBLVM2APP_CPPFLAGS)
3117         AC_SUBST(BUILD_WITH_LIBLVM2APP_LDFLAGS)
3118         AC_SUBST(BUILD_WITH_LIBLVM2APP_LIBS)
3119         AC_DEFINE(HAVE_LIBLVM2APP, 1, [Define if liblvm2app is present and usable.])
3120 fi
3121 AM_CONDITIONAL(BUILD_WITH_LIBLVM2APP, test "x$with_liblvm2app" = "xyes")
3122 # }}}
3123
3124 # --with-libmemcached {{{
3125 with_libmemcached_cppflags=""
3126 with_libmemcached_ldflags=""
3127 AC_ARG_WITH(libmemcached, [AS_HELP_STRING([--with-libmemcached@<:@=PREFIX@:>@], [Path to libmemcached.])],
3128 [
3129         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3130         then
3131                 with_libmemcached_cppflags="-I$withval/include"
3132                 with_libmemcached_ldflags="-L$withval/lib"
3133                 with_libmemcached="yes"
3134         else
3135                 with_libmemcached="$withval"
3136         fi
3137 ],
3138 [
3139         with_libmemcached="yes"
3140 ])
3141 if test "x$with_libmemcached" = "xyes"
3142 then
3143         SAVE_CPPFLAGS="$CPPFLAGS"
3144         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
3145
3146         AC_CHECK_HEADERS(libmemcached/memcached.h, [with_libmemcached="yes"], [with_libmemcached="no (libmemcached/memcached.h not found)"])
3147
3148         CPPFLAGS="$SAVE_CPPFLAGS"
3149 fi
3150 if test "x$with_libmemcached" = "xyes"
3151 then
3152         SAVE_CPPFLAGS="$CPPFLAGS"
3153         SAVE_LDFLAGS="$LDFLAGS"
3154         CPPFLAGS="$CPPFLAGS $with_libmemcached_cppflags"
3155         LDFLAGS="$LDFLAGS $with_libmemcached_ldflags"
3156
3157         AC_CHECK_LIB(memcached, memcached_create, [with_libmemcached="yes"], [with_libmemcached="no (Symbol 'memcached_create' not found)"])
3158
3159         CPPFLAGS="$SAVE_CPPFLAGS"
3160         LDFLAGS="$SAVE_LDFLAGS"
3161 fi
3162 if test "x$with_libmemcached" = "xyes"
3163 then
3164         BUILD_WITH_LIBMEMCACHED_CPPFLAGS="$with_libmemcached_cppflags"
3165         BUILD_WITH_LIBMEMCACHED_LDFLAGS="$with_libmemcached_ldflags"
3166         BUILD_WITH_LIBMEMCACHED_LIBS="-lmemcached"
3167         AC_SUBST(BUILD_WITH_LIBMEMCACHED_CPPFLAGS)
3168         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LDFLAGS)
3169         AC_SUBST(BUILD_WITH_LIBMEMCACHED_LIBS)
3170         AC_DEFINE(HAVE_LIBMEMCACHED, 1, [Define if libmemcached is present and usable.])
3171 fi
3172 AM_CONDITIONAL(BUILD_WITH_LIBMEMCACHED, test "x$with_libmemcached" = "xyes")
3173 # }}}
3174
3175 # --with-libmicrohttpd {{{
3176 with_libmicrohttpd_cppflags=""
3177 with_libmicrohttpd_ldflags=""
3178 AC_ARG_WITH([libmicrohttpd], [AS_HELP_STRING([--with-libmicrohttpd@<:@=PREFIX@:>@], [Path to libmicrohttpd.])],
3179   [
3180     if test "x$withval" != "xno" && test "x$withval" != "xyes"
3181     then
3182       with_libmicrohttpd_cppflags="-I$withval/include"
3183       with_libmicrohttpd_ldflags="-L$withval/lib"
3184       with_libmicrohttpd="yes"
3185     fi
3186     if test "x$withval" = "xno"
3187     then
3188       with_libmicrohttpd="no (disabled on command line)"
3189     fi
3190   ],
3191   [withval="yes"]
3192 )
3193 if test "x$withval" = "xyes"
3194 then
3195 PKG_CHECK_MODULES([MICROHTTPD], [libmicrohttpd],
3196   [with_libmicrohttpd="yes"],
3197   [with_libmicrohttpd="no (pkg-config could not find libmicrohttpd)"]
3198 )
3199 fi
3200
3201 if test "x$MICROHTTPD_LIBS" = "x"
3202 then
3203   MICROHTTPD_LIBS="-lmicrohttpd"
3204 fi
3205
3206 SAVE_CPPFLAGS="$CPPFLAGS"
3207 SAVE_LDFLAGS="$LDFLAGS"
3208 SAVE_LIBS="$LIBS"
3209 CPPFLAGS="$with_libmicrohttpd_cppflags $MICROHTTPD_CFLAGS"
3210 LDFLAGS="$with_libmicrohttpd_ldflags $LDFLAGS"
3211 LIBS="$LIBS $MICROHTTPD_LIBS"
3212
3213 if test "x$with_libmicrohttpd" = "xyes"
3214 then
3215   AC_CHECK_HEADERS([microhttpd.h],
3216                    [with_libmicrohttpd="yes"],
3217                    [with_libmicrohttpd="no (<microhttpd.h> not found)"])
3218 fi
3219
3220 if test "x$with_libmicrohttpd" = "xyes"
3221 then
3222   AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
3223                [with_libmicrohttpd="yes"],
3224                [with_libmicrohttpd="no (libmicrohttpd not found)"])
3225 fi
3226
3227 CPPFLAGS="$SAVE_CPPFLAGS"
3228 LDFLAGS="$SAVE_LDFLAGS"
3229 LIBS="$SAVE_LIBS"
3230
3231 BUILD_WITH_LIBMICROHTTPD_CPPFLAGS="$with_libmicrohttpd_cppflags $MICROHTTPD_CFLAGS"
3232 BUILD_WITH_LIBMICROHTTPD_LDFLAGS="$with_libmicrohttpd_ldflags"
3233 BUILD_WITH_LIBMICROHTTPD_LIBS="$MICROHTTPD_LIBS"
3234 AC_SUBST([BUILD_WITH_LIBMICROHTTPD_CPPFLAGS])
3235 AC_SUBST([BUILD_WITH_LIBMICROHTTPD_LDFLAGS])
3236 AC_SUBST([BUILD_WITH_LIBMICROHTTPD_LIBS])
3237 # }}}
3238
3239 # --with-libmodbus {{{
3240 with_libmodbus_config=""
3241 with_libmodbus_cflags=""
3242 with_libmodbus_libs=""
3243 AC_ARG_WITH(libmodbus, [AS_HELP_STRING([--with-libmodbus@<:@=PREFIX@:>@], [Path to the modbus library.])],
3244 [
3245         if test "x$withval" = "xno"
3246         then
3247                 with_libmodbus="no"
3248         else if test "x$withval" = "xyes"
3249         then
3250                 with_libmodbus="use_pkgconfig"
3251         else if test -d "$with_libmodbus/lib"
3252         then
3253                 AC_MSG_NOTICE([Not checking for libmodbus: Manually configured])
3254                 with_libmodbus_cflags="-I$withval/include"
3255                 with_libmodbus_libs="-L$withval/lib -lmodbus"
3256                 with_libmodbus="yes"
3257         fi; fi; fi
3258 ],
3259 [with_libmodbus="use_pkgconfig"])
3260
3261 # configure using pkg-config
3262 if test "x$with_libmodbus" = "xuse_pkgconfig"
3263 then
3264         AC_MSG_NOTICE([Checking for libmodbus using $PKG_CONFIG])
3265         $PKG_CONFIG --exists 'libmodbus' 2>/dev/null
3266         if test $? -ne 0
3267         then
3268                 with_libmodbus="no (pkg-config doesn't know libmodbus)"
3269         fi
3270 fi
3271 if test "x$with_libmodbus" = "xuse_pkgconfig"
3272 then
3273         with_libmodbus_cflags="`$PKG_CONFIG --cflags 'libmodbus'`"
3274         if test $? -ne 0
3275         then
3276                 with_libmodbus="no ($PKG_CONFIG failed)"
3277         fi
3278         with_libmodbus_libs="`$PKG_CONFIG --libs 'libmodbus'`"
3279         if test $? -ne 0
3280         then
3281                 with_libmodbus="no ($PKG_CONFIG failed)"
3282         fi
3283 fi
3284 if test "x$with_libmodbus" = "xuse_pkgconfig"
3285 then
3286         with_libmodbus="yes"
3287 fi
3288
3289 # with_libmodbus_cflags and with_libmodbus_libs are set up now, let's do
3290 # the actual checks.
3291 if test "x$with_libmodbus" = "xyes"
3292 then
3293         SAVE_CPPFLAGS="$CPPFLAGS"
3294         CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
3295
3296         AC_CHECK_HEADERS(modbus.h, [], [with_libmodbus="no (modbus.h not found)"])
3297
3298         CPPFLAGS="$SAVE_CPPFLAGS"
3299 fi
3300 if test "x$with_libmodbus" = "xyes"
3301 then
3302         SAVE_CPPFLAGS="$CPPFLAGS"
3303         SAVE_LDFLAGS="$LDFLAGS"
3304
3305         CPPFLAGS="$CPPFLAGS $with_libmodbus_cflags"
3306         LDFLAGS="$LDFLAGS $with_libmodbus_libs"
3307
3308         AC_CHECK_LIB(modbus, modbus_connect,
3309                      [with_libmodbus="yes"],
3310                      [with_libmodbus="no (symbol modbus_connect not found)"])
3311
3312         CPPFLAGS="$SAVE_CPPFLAGS"
3313         LDFLAGS="$SAVE_LDFLAGS"
3314 fi
3315 if test "x$with_libmodbus" = "xyes"
3316 then
3317         BUILD_WITH_LIBMODBUS_CFLAGS="$with_libmodbus_cflags"
3318         BUILD_WITH_LIBMODBUS_LIBS="$with_libmodbus_libs"
3319         AC_SUBST(BUILD_WITH_LIBMODBUS_CFLAGS)
3320         AC_SUBST(BUILD_WITH_LIBMODBUS_LIBS)
3321 fi
3322 # }}}
3323
3324 # --with-libmongoc {{{
3325 AC_ARG_WITH(libmongoc, [AS_HELP_STRING([--with-libmongoc@<:@=PREFIX@:>@], [Path to libmongoc.])],
3326 [
3327  if test "x$withval" = "xyes"
3328  then
3329          with_libmongoc="yes"
3330  else if test "x$withval" = "xno"
3331  then
3332          with_libmongoc="no"
3333  else
3334          with_libmongoc="yes"
3335          LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS -I$withval/include"
3336          LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS -L$withval/lib"
3337  fi; fi
3338 ],
3339 [with_libmongoc="yes"])
3340
3341 SAVE_CPPFLAGS="$CPPFLAGS"
3342 SAVE_LDFLAGS="$LDFLAGS"
3343
3344 CPPFLAGS="$CPPFLAGS $LIBMONGOC_CPPFLAGS"
3345 LDFLAGS="$LDFLAGS $LIBMONGOC_LDFLAGS"
3346
3347 if test "x$with_libmongoc" = "xyes"
3348 then
3349         if test "x$LIBMONGOC_CPPFLAGS" != "x"
3350         then
3351                 AC_MSG_NOTICE([libmongoc CPPFLAGS: $LIBMONGOC_CPPFLAGS])
3352         fi
3353         AC_CHECK_HEADERS(mongo.h,
3354         [with_libmongoc="yes"],
3355         [with_libmongoc="no ('mongo.h' not found)"],
3356 [#if HAVE_STDINT_H
3357 # define MONGO_HAVE_STDINT 1
3358 #else
3359 # define MONGO_USE_LONG_LONG_INT 1
3360 #endif
3361 ])
3362 fi
3363 if test "x$with_libmongoc" = "xyes"
3364 then
3365         if test "x$LIBMONGOC_LDFLAGS" != "x"
3366         then
3367                 AC_MSG_NOTICE([libmongoc LDFLAGS: $LIBMONGOC_LDFLAGS])
3368         fi
3369         AC_CHECK_LIB(mongoc, mongo_run_command,
3370         [with_libmongoc="yes"],
3371         [with_libmongoc="no (symbol 'mongo_run_command' not found)"])
3372 fi
3373
3374 CPPFLAGS="$SAVE_CPPFLAGS"
3375 LDFLAGS="$SAVE_LDFLAGS"
3376
3377 if test "x$with_libmongoc" = "xyes"
3378 then
3379         BUILD_WITH_LIBMONGOC_CPPFLAGS="$LIBMONGOC_CPPFLAGS"
3380         BUILD_WITH_LIBMONGOC_LDFLAGS="$LIBMONGOC_LDFLAGS"
3381         AC_SUBST(BUILD_WITH_LIBMONGOC_CPPFLAGS)
3382         AC_SUBST(BUILD_WITH_LIBMONGOC_LDFLAGS)
3383 fi
3384 AM_CONDITIONAL(BUILD_WITH_LIBMONGOC, test "x$with_libmongoc" = "xyes")
3385 # }}}
3386
3387 # --with-libmosquitto {{{
3388 with_libmosquitto_cppflags=""
3389 with_libmosquitto_ldflags=""
3390 AC_ARG_WITH(libmosquitto, [AS_HELP_STRING([--with-libmosquitto@<:@=PREFIX@:>@], [Path to libmosquitto.])],
3391 [
3392         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3393         then
3394                 with_libmosquitto_cppflags="-I$withval/include"
3395                 with_libmosquitto_ldflags="-L$withval/lib"
3396                 with_libmosquitto="yes"
3397         else
3398                 with_libmosquitto="$withval"
3399         fi
3400 ],
3401 [
3402         with_libmosquitto="yes"
3403 ])
3404 if test "x$with_libmosquitto" = "xyes"
3405 then
3406         SAVE_CPPFLAGS="$CPPFLAGS"
3407         CPPFLAGS="$CPPFLAGS $with_libmosquitto_cppflags"
3408
3409         AC_CHECK_HEADERS(mosquitto.h, [with_libmosquitto="yes"], [with_libmosquitto="no (mosquitto.h not found)"])
3410
3411         CPPFLAGS="$SAVE_CPPFLAGS"
3412 fi
3413 if test "x$with_libmosquitto" = "xyes"
3414 then
3415         SAVE_LDFLAGS="$LDFLAGS"
3416         SAVE_CPPFLAGS="$CPPFLAGS"
3417         LDFLAGS="$LDFLAGS $with_libmosquitto_ldflags"
3418         CPPFLAGS="$CPPFLAGS $with_libmosquitto_cppflags"
3419
3420         AC_CHECK_LIB(mosquitto, mosquitto_connect, [with_libmosquitto="yes"], [with_libmosquitto="no (libmosquitto not found)"])
3421
3422         LDFLAGS="$SAVE_LDFLAGS"
3423         CPPFLAGS="$SAVE_CPPFLAGS"
3424 fi
3425 if test "x$with_libmosquitto" = "xyes"
3426 then
3427         BUILD_WITH_LIBMOSQUITTO_CPPFLAGS="$with_libmosquitto_cppflags"
3428         BUILD_WITH_LIBMOSQUITTO_LDFLAGS="$with_libmosquitto_ldflags"
3429         BUILD_WITH_LIBMOSQUITTO_LIBS="-lmosquitto"
3430         AC_SUBST(BUILD_WITH_LIBMOSQUITTO_CPPFLAGS)
3431         AC_SUBST(BUILD_WITH_LIBMOSQUITTO_LDFLAGS)
3432         AC_SUBST(BUILD_WITH_LIBMOSQUITTO_LIBS)
3433 fi
3434 # }}}
3435
3436 # --with-libmysql {{{
3437 with_mysql_config="mysql_config"
3438 with_mysql_cflags=""
3439 with_mysql_libs=""
3440 AC_ARG_WITH(libmysql, [AS_HELP_STRING([--with-libmysql@<:@=PREFIX@:>@], [Path to libmysql.])],
3441 [
3442         if test "x$withval" = "xno"
3443         then
3444                 with_libmysql="no"
3445         else if test "x$withval" = "xyes"
3446         then
3447                 with_libmysql="yes"
3448         else
3449                 if test -f "$withval" && test -x "$withval";
3450                 then
3451                         with_mysql_config="$withval"
3452                 else if test -x "$withval/bin/mysql_config"
3453                 then
3454                         with_mysql_config="$withval/bin/mysql_config"
3455                 fi; fi
3456                 with_libmysql="yes"
3457         fi; fi
3458 ],
3459 [
3460         with_libmysql="yes"
3461 ])
3462 if test "x$with_libmysql" = "xyes"
3463 then
3464         with_mysql_cflags=`$with_mysql_config --include 2>/dev/null`
3465         mysql_config_status=$?
3466
3467         if test $mysql_config_status -ne 0
3468         then
3469                 with_libmysql="no ($with_mysql_config failed)"
3470         else
3471                 SAVE_CPPFLAGS="$CPPFLAGS"
3472                 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
3473
3474                 have_mysql_h="no"
3475                 have_mysql_mysql_h="no"
3476                 AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
3477
3478                 if test "x$have_mysql_h" = "xno"
3479                 then
3480                         AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
3481                 fi
3482
3483                 if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
3484                 then
3485                         with_libmysql="no (mysql.h not found)"
3486                 fi
3487
3488                 CPPFLAGS="$SAVE_CPPFLAGS"
3489         fi
3490 fi
3491 if test "x$with_libmysql" = "xyes"
3492 then
3493         with_mysql_libs=`$with_mysql_config --libs_r 2>/dev/null`
3494         mysql_config_status=$?
3495
3496         if test $mysql_config_status -ne 0
3497         then
3498                 with_libmysql="no ($with_mysql_config failed)"
3499         else
3500                 SAVE_CPPFLAGS="$CPPFLAGS"
3501                 CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
3502                 SAVE_LIBS="$LIBS"
3503                 LIBS="$with_mysql_libs"
3504                 AC_SEARCH_LIBS([mysql_get_server_version],
3505                  [],
3506                  [with_libmysql="yes"],
3507                  [with_libmysql="no (symbol 'mysql_get_server_version' not found)"],
3508                  [])
3509                 CPPFLAGS="$SAVE_CPPFLAGS"
3510                 LIBS="$SAVE_LIBS"
3511         fi
3512 fi
3513 if test "x$with_libmysql" = "xyes"
3514 then
3515         BUILD_WITH_LIBMYSQL_CFLAGS="$with_mysql_cflags"
3516         BUILD_WITH_LIBMYSQL_LIBS="$with_mysql_libs"
3517         AC_SUBST(BUILD_WITH_LIBMYSQL_CFLAGS)
3518         AC_SUBST(BUILD_WITH_LIBMYSQL_LIBS)
3519 fi
3520 AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
3521 # }}}
3522
3523 # --with-libmnl {{{
3524 with_libmnl_cflags=""
3525 with_libmnl_libs=""
3526 AC_ARG_WITH(libmnl, [AS_HELP_STRING([--with-libmnl@<:@=PREFIX@:>@], [Path to libmnl.])],
3527 [
3528  echo "libmnl: withval = $withval"
3529  if test "x$withval" = "xyes"
3530  then
3531          with_libmnl="yes"
3532  else if test "x$withval" = "xno"
3533  then
3534          with_libmnl="no"
3535  else
3536          if test -d "$withval/include"
3537          then
3538                  with_libmnl_cflags="-I$withval/include"
3539                  with_libmnl_libs="-L$withval/lib -lmnl"
3540                  with_libmnl="yes"
3541          else
3542                  AC_MSG_ERROR("no such directory: $withval/include")
3543          fi
3544  fi; fi
3545 ],
3546 [
3547  if test "x$ac_system" = "xLinux"
3548  then
3549          with_libmnl="yes"
3550  else
3551          with_libmnl="no (Linux only library)"
3552  fi
3553 ])
3554 if test "x$with_libmnl" = "xyes"
3555 then
3556         if $PKG_CONFIG --exists libmnl 2>/dev/null; then
3557           with_libmnl_cflags="$with_libmnl_ldflags `$PKG_CONFIG --cflags libmnl`"
3558           with_libmnl_libs="$with_libmnl_libs `$PKG_CONFIG --libs libmnl`"
3559         fi
3560
3561         AC_CHECK_HEADERS(libmnl.h libmnl/libmnl.h,
3562         [
3563          with_libmnl="yes"
3564          break
3565         ], [],
3566 [#include <stdio.h>
3567 #include <sys/types.h>
3568 #include <asm/types.h>
3569 #include <sys/socket.h>
3570 #include <linux/netlink.h>
3571 #include <linux/rtnetlink.h>])
3572         AC_CHECK_HEADERS(linux/gen_stats.h linux/pkt_sched.h, [], [],
3573 [#include <stdio.h>
3574 #include <sys/types.h>
3575 #include <asm/types.h>
3576 #include <sys/socket.h>])
3577
3578         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
3579 [[
3580 #include <stdio.h>
3581 #include <sys/types.h>
3582 #include <asm/types.h>
3583 #include <sys/socket.h>
3584 #include <linux/netlink.h>
3585 #include <linux/rtnetlink.h>
3586 ]],
3587 [[
3588 int retval = TCA_STATS2;
3589 return (retval);
3590 ]]
3591         )],
3592         [AC_DEFINE([HAVE_TCA_STATS2], [1], [True if the enum-member TCA_STATS2 exists])])
3593
3594         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
3595 [[
3596 #include <stdio.h>
3597 #include <sys/types.h>
3598 #include <asm/types.h>
3599 #include <sys/socket.h>
3600 #include <linux/netlink.h>
3601 #include <linux/rtnetlink.h>
3602 ]],
3603 [[
3604 int retval = TCA_STATS;
3605 return (retval);
3606 ]]
3607         )],
3608         [AC_DEFINE([HAVE_TCA_STATS], 1, [True if the enum-member TCA_STATS exists])])
3609 fi
3610 if test "x$with_libmnl" = "xyes"
3611 then
3612         AC_CHECK_MEMBERS([struct rtnl_link_stats64.tx_window_errors],
3613         [AC_DEFINE(HAVE_RTNL_LINK_STATS64, 1, [Define if struct rtnl_link_stats64 exists and is usable.])],
3614         [],
3615         [
3616         #include <linux/if_link.h>
3617         ])
3618 fi
3619 if test "x$with_libmnl" = "xyes"
3620 then
3621         AC_CHECK_LIB(mnl, mnl_nlmsg_get_payload,
3622                      [with_libmnl="yes"],
3623                      [with_libmnl="no (symbol 'mnl_nlmsg_get_payload' not found)"],
3624                      [$with_libmnl_libs])
3625 fi
3626 if test "x$with_libmnl" = "xyes"
3627 then
3628         AC_DEFINE(HAVE_LIBMNL, 1, [Define if libmnl is present and usable.])
3629         BUILD_WITH_LIBMNL_CFLAGS="$with_libmnl_cflags"
3630         BUILD_WITH_LIBMNL_LIBS="$with_libmnl_libs"
3631         AC_SUBST(BUILD_WITH_LIBMNL_CFLAGS)
3632         AC_SUBST(BUILD_WITH_LIBMNL_LIBS)
3633 fi
3634 AM_CONDITIONAL(BUILD_WITH_LIBMNL, test "x$with_libmnl" = "xyes")
3635 # }}}
3636
3637 # --with-libnetapp {{{
3638 AC_ARG_VAR([LIBNETAPP_CPPFLAGS], [C preprocessor flags required to build with libnetapp])
3639 AC_ARG_VAR([LIBNETAPP_LDFLAGS],  [Linker flags required to build with libnetapp])
3640 AC_ARG_VAR([LIBNETAPP_LIBS],     [Other libraries required to link against libnetapp])
3641 LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS"
3642 LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS"
3643 LIBNETAPP_LIBS="$LIBNETAPP_LIBS"
3644 AC_ARG_WITH(libnetapp, [AS_HELP_STRING([--with-libnetapp@<:@=PREFIX@:>@], [Path to libnetapp.])],
3645 [
3646  if test -d "$withval"
3647  then
3648          LIBNETAPP_CPPFLAGS="$LIBNETAPP_CPPFLAGS -I$withval/include"
3649          LIBNETAPP_LDFLAGS="$LIBNETAPP_LDFLAGS -L$withval/lib"
3650          with_libnetapp="yes"
3651  else
3652          with_libnetapp="$withval"
3653  fi
3654 ],
3655 [
3656  with_libnetapp="yes"
3657 ])
3658
3659 SAVE_CPPFLAGS="$CPPFLAGS"
3660 SAVE_LDFLAGS="$LDFLAGS"
3661 CPPFLAGS="$CPPFLAGS $LIBNETAPP_CPPFLAGS"
3662 LDFLAGS="$LDFLAGS $LIBNETAPP_LDFLAGS"
3663
3664 if test "x$with_libnetapp" = "xyes"
3665 then
3666         if test "x$LIBNETAPP_CPPFLAGS" != "x"
3667         then
3668                 AC_MSG_NOTICE([netapp CPPFLAGS: $LIBNETAPP_CPPFLAGS])
3669         fi
3670         AC_CHECK_HEADERS(netapp_api.h,
3671                 [with_libnetapp="yes"],
3672                 [with_libnetapp="no (netapp_api.h not found)"])
3673 fi
3674
3675 if test "x$with_libnetapp" = "xyes"
3676 then
3677         if test "x$LIBNETAPP_LDFLAGS" != "x"
3678         then
3679                 AC_MSG_NOTICE([netapp LDFLAGS: $LIBNETAPP_LDFLAGS])
3680         fi
3681
3682         if test "x$LIBNETAPP_LIBS" = "x"
3683         then
3684                 LIBNETAPP_LIBS="$PTHREAD_LIBS -lxml -ladt -lssl -lm -lcrypto -lz"
3685         fi
3686         AC_MSG_NOTICE([netapp LIBS: $LIBNETAPP_LIBS])
3687
3688         AC_CHECK_LIB(netapp, na_server_invoke_elem,
3689                 [with_libnetapp="yes"],
3690                 [with_libnetapp="no (symbol na_server_invoke_elem not found)"],
3691                 [$LIBNETAPP_LIBS])
3692         LIBNETAPP_LIBS="-lnetapp $LIBNETAPP_LIBS"
3693 fi
3694
3695 CPPFLAGS="$SAVE_CPPFLAGS"
3696 LDFLAGS="$SAVE_LDFLAGS"
3697
3698 if test "x$with_libnetapp" = "xyes"
3699 then
3700         AC_DEFINE(HAVE_LIBNETAPP, 1, [Define to 1 if you have the netapp library (-lnetapp).])
3701 fi
3702
3703 AC_SUBST(LIBNETAPP_CPPFLAGS)
3704 AC_SUBST(LIBNETAPP_LDFLAGS)
3705 AC_SUBST(LIBNETAPP_LIBS)
3706 AM_CONDITIONAL(BUILD_WITH_LIBNETAPP, test "x$with_libnetapp" = "xyes")
3707 # }}}
3708
3709 # --with-libnetsnmp {{{
3710 AC_ARG_WITH(libnetsnmp, [AS_HELP_STRING([--with-libnetsnmp@<:@=PREFIX@:>@], [Path to the Net-SNMPD library.])],
3711 [
3712         if test "x$withval" = "xno"
3713         then
3714                 with_libnetsnmp="no"
3715         else if test "x$withval" = "xyes"
3716         then
3717                 with_libnetsnmp="yes"
3718         else
3719                 with_libnetsnmp_cppflags="-I$withval/include"
3720                 with_libnetsnmp_ldflags="-I$withval/lib"
3721                 with_libnetsnmp="yes"
3722         fi; fi
3723 ],
3724 [with_libnetsnmp="yes"])
3725 if test "x$with_libnetsnmp" = "xyes"
3726 then
3727         SAVE_CPPFLAGS="$CPPFLAGS"
3728         CPPFLAGS="$CPPFLAGS $with_libnetsnmp_cppflags"
3729
3730         AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [], [with_libnetsnmp="no (net-snmp/net-snmp-config.h not found)"])
3731
3732         CPPFLAGS="$SAVE_CPPFLAGS"
3733 fi
3734 if test "x$with_libnetsnmp" = "xyes"
3735 then
3736         SAVE_LDFLAGS="$LDFLAGS"
3737         LDFLAGS="$LDFLAGS $with_libnetsnmp_ldflags"
3738
3739         AC_CHECK_LIB(netsnmp, init_snmp,
3740                 [with_libnetsnmp="yes"],
3741                 [with_libnetsnmp="no (libnetsnmp not found)"],
3742                 [$with_snmp_libs])
3743
3744         LDFLAGS="$SAVE_LDFLAGS"
3745 fi
3746 if test "x$with_libnetsnmp" = "xyes"
3747 then
3748         BUILD_WITH_LIBNETSNMP_CPPFLAGS="$with_libnetsnmp_cppflags"
3749         BUILD_WITH_LIBNETSNMP_LDFLAGS="$with_libnetsnmp_ldflags"
3750         BUILD_WITH_LIBNETSNMP_LIBS="-lnetsnmp"
3751 fi
3752 AC_SUBST(BUILD_WITH_LIBNETSNMP_CPPFLAGS)
3753 AC_SUBST(BUILD_WITH_LIBNETSNMP_LDFLAGS)
3754 AC_SUBST(BUILD_WITH_LIBNETSNMP_LIBS)
3755 # }}}
3756
3757 # --with-liboconfig {{{
3758 with_own_liboconfig="no"
3759 liboconfig_LDFLAGS="$LDFLAGS"
3760 liboconfig_CPPFLAGS="$CPPFLAGS"
3761 AC_ARG_WITH(liboconfig, [AS_HELP_STRING([--with-liboconfig@<:@=PREFIX@:>@], [Path to liboconfig.])],
3762 [
3763         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3764         then
3765                 if test -d "$withval/lib"
3766                 then
3767                         liboconfig_LDFLAGS="$LDFLAGS -L$withval/lib"
3768                 fi
3769                 if test -d "$withval/include"
3770                 then
3771                         liboconfig_CPPFLAGS="$CPPFLAGS -I$withval/include"
3772                 fi
3773         fi
3774         if test "x$withval" = "xno"
3775         then
3776                 AC_MSG_ERROR("liboconfig is required")
3777         fi
3778 ],
3779 [
3780         with_liboconfig="yes"
3781 ])
3782
3783 save_LDFLAGS="$LDFLAGS"
3784 save_CPPFLAGS="$CPPFLAGS"
3785 LDFLAGS="$liboconfig_LDFLAGS"
3786 CPPFLAGS="$liboconfig_CPPFLAGS"
3787 AC_CHECK_LIB(oconfig, oconfig_parse_file,
3788 [
3789         with_liboconfig="yes"
3790         with_own_liboconfig="no"
3791 ],
3792 [
3793         with_liboconfig="yes"
3794         with_own_liboconfig="yes"
3795         LDFLAGS="$save_LDFLAGS"
3796         CPPFLAGS="$save_CPPFLAGS"
3797 ])
3798
3799 AM_CONDITIONAL(BUILD_WITH_OWN_LIBOCONFIG, test "x$with_own_liboconfig" = "xyes")
3800 if test "x$with_own_liboconfig" = "xyes"
3801 then
3802         with_liboconfig="yes (shipped version)"
3803 fi
3804 # }}}
3805
3806 # --with-liboping {{{
3807 AC_ARG_WITH(liboping, [AS_HELP_STRING([--with-liboping@<:@=PREFIX@:>@], [Path to liboping.])],
3808 [
3809  if test "x$withval" = "xyes"
3810  then
3811          with_liboping="yes"
3812  else if test "x$withval" = "xno"
3813  then
3814          with_liboping="no"
3815  else
3816          with_liboping="yes"
3817          LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS -I$withval/include"
3818          LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS -L$withval/lib"
3819  fi; fi
3820 ],
3821 [with_liboping="yes"])
3822
3823 SAVE_CPPFLAGS="$CPPFLAGS"
3824 SAVE_LDFLAGS="$LDFLAGS"
3825
3826 CPPFLAGS="$CPPFLAGS $LIBOPING_CPPFLAGS"
3827 LDFLAGS="$LDFLAGS $LIBOPING_LDFLAGS"
3828
3829 if test "x$with_liboping" = "xyes"
3830 then
3831         if test "x$LIBOPING_CPPFLAGS" != "x"
3832         then
3833                 AC_MSG_NOTICE([liboping CPPFLAGS: $LIBOPING_CPPFLAGS])
3834         fi
3835         AC_CHECK_HEADERS(oping.h,
3836         [with_liboping="yes"],
3837         [with_liboping="no (oping.h not found)"])
3838 fi
3839 if test "x$with_liboping" = "xyes"
3840 then
3841         if test "x$LIBOPING_LDFLAGS" != "x"
3842         then
3843                 AC_MSG_NOTICE([liboping LDFLAGS: $LIBOPING_LDFLAGS])
3844         fi
3845         AC_CHECK_LIB(oping, ping_construct,
3846         [with_liboping="yes"],
3847         [with_liboping="no (symbol 'ping_construct' not found)"])
3848 fi
3849
3850 CPPFLAGS="$SAVE_CPPFLAGS"
3851 LDFLAGS="$SAVE_LDFLAGS"
3852
3853 if test "x$with_liboping" = "xyes"
3854 then
3855         BUILD_WITH_LIBOPING_CPPFLAGS="$LIBOPING_CPPFLAGS"
3856         BUILD_WITH_LIBOPING_LDFLAGS="$LIBOPING_LDFLAGS"
3857         AC_SUBST(BUILD_WITH_LIBOPING_CPPFLAGS)
3858         AC_SUBST(BUILD_WITH_LIBOPING_LDFLAGS)
3859 fi
3860 AM_CONDITIONAL(BUILD_WITH_LIBOPING, test "x$with_liboping" = "xyes")
3861 # }}}
3862
3863 # --with-oracle {{{
3864 with_oracle_cppflags=""
3865 with_oracle_libs=""
3866 AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path to Oracle.])],
3867 [
3868         if test "x$withval" = "xyes"
3869         then
3870                 if test "x$ORACLE_HOME" = "x"
3871                 then
3872                         AC_MSG_WARN([Use of the Oracle library has been forced, but the environment variable ORACLE_HOME is not set.])
3873                 fi
3874                 with_oracle="yes"
3875         else if test "x$withval" = "xno"
3876         then
3877                 with_oracle="no"
3878         else
3879                 with_oracle="yes"
3880                 ORACLE_HOME="$withval"
3881         fi; fi
3882 ],
3883 [
3884         if test "x$ORACLE_HOME" = "x"
3885         then
3886                 with_oracle="no (ORACLE_HOME is not set)"
3887         else
3888                 with_oracle="yes"
3889         fi
3890 ])
3891 if test "x$ORACLE_HOME" != "x"
3892 then
3893         with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public"
3894
3895         if test -e "$ORACLE_HOME/lib/ldflags"
3896         then
3897                 with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"`
3898         fi
3899         #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh"
3900         with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh"
3901 fi
3902 if test "x$with_oracle" = "xyes"
3903 then
3904         SAVE_CPPFLAGS="$CPPFLAGS"
3905         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
3906
3907         AC_CHECK_HEADERS(oci.h, [with_oracle="yes"], [with_oracle="no (oci.h not found)"])
3908
3909         CPPFLAGS="$SAVE_CPPFLAGS"
3910 fi
3911 if test "x$with_oracle" = "xyes"
3912 then
3913         SAVE_CPPFLAGS="$CPPFLAGS"
3914         SAVE_LIBS="$LIBS"
3915         CPPFLAGS="$CPPFLAGS $with_oracle_cppflags"
3916         LIBS="$LIBS $with_oracle_libs"
3917
3918         AC_CHECK_FUNC(OCIEnvCreate, [with_oracle="yes"], [with_oracle="no (Symbol 'OCIEnvCreate' not found)"])
3919
3920         CPPFLAGS="$SAVE_CPPFLAGS"
3921         LIBS="$SAVE_LIBS"
3922 fi
3923 if test "x$with_oracle" = "xyes"
3924 then
3925         BUILD_WITH_ORACLE_CPPFLAGS="$with_oracle_cppflags"
3926         BUILD_WITH_ORACLE_LIBS="$with_oracle_libs"
3927         AC_SUBST(BUILD_WITH_ORACLE_CPPFLAGS)
3928         AC_SUBST(BUILD_WITH_ORACLE_LIBS)
3929 fi
3930 # }}}
3931
3932 # --with-libowcapi {{{
3933 with_libowcapi_cppflags=""
3934 with_libowcapi_ldflags=""
3935 AC_ARG_WITH(libowcapi, [AS_HELP_STRING([--with-libowcapi@<:@=PREFIX@:>@], [Path to libowcapi.])],
3936 [
3937         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3938         then
3939                 with_libowcapi_cppflags="-I$withval/include"
3940                 with_libowcapi_ldflags="-L$withval/lib"
3941                 with_libowcapi="yes"
3942         else
3943                 with_libowcapi="$withval"
3944         fi
3945 ],
3946 [
3947         with_libowcapi="yes"
3948 ])
3949 if test "x$with_libowcapi" = "xyes"
3950 then
3951         SAVE_CPPFLAGS="$CPPFLAGS"
3952         CPPFLAGS="$CPPFLAGS $with_libowcapi_cppflags"
3953
3954         AC_CHECK_HEADERS(owcapi.h, [with_libowcapi="yes"], [with_libowcapi="no (owcapi.h not found)"])
3955
3956         CPPFLAGS="$SAVE_CPPFLAGS"
3957 fi
3958 if test "x$with_libowcapi" = "xyes"
3959 then
3960         SAVE_LDFLAGS="$LDFLAGS"
3961         SAVE_CPPFLAGS="$CPPFLAGS"
3962         LDFLAGS="$LDFLAGS $with_libowcapi_ldflags"
3963         CPPFLAGS="$with_libowcapi_cppflags"
3964
3965         AC_CHECK_LIB(owcapi, OW_get, [with_libowcapi="yes"], [with_libowcapi="no (libowcapi not found)"])
3966
3967         LDFLAGS="$SAVE_LDFLAGS"
3968         CPPFLAGS="$SAVE_CPPFLAGS"
3969 fi
3970 if test "x$with_libowcapi" = "xyes"
3971 then
3972         BUILD_WITH_LIBOWCAPI_CPPFLAGS="$with_libowcapi_cppflags"
3973         BUILD_WITH_LIBOWCAPI_LDFLAGS="$with_libowcapi_ldflags"
3974         BUILD_WITH_LIBOWCAPI_LIBS="-lowcapi"
3975         AC_SUBST(BUILD_WITH_LIBOWCAPI_CPPFLAGS)
3976         AC_SUBST(BUILD_WITH_LIBOWCAPI_LDFLAGS)
3977         AC_SUBST(BUILD_WITH_LIBOWCAPI_LIBS)
3978 fi
3979 # }}}
3980
3981 # --with-libpcap {{{
3982 AC_ARG_WITH(libpcap, [AS_HELP_STRING([--with-libpcap@<:@=PREFIX@:>@], [Path to libpcap.])],
3983 [
3984         if test "x$withval" != "xno" && test "x$withval" != "xyes"
3985         then
3986                 LDFLAGS="$LDFLAGS -L$withval/lib"
3987                 CPPFLAGS="$CPPFLAGS -I$withval/include"
3988                 with_libpcap="yes"
3989         else
3990                 with_libpcap="$withval"
3991         fi
3992 ],
3993 [
3994         with_libpcap="yes"
3995 ])
3996 if test "x$with_libpcap" = "xyes"
3997 then
3998         AC_CHECK_LIB(pcap, pcap_open_live,
3999         [
4000                 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to 1 if you have the pcap library (-lpcap).])
4001         ], [with_libpcap="no (libpcap not found)"])
4002 fi
4003 if test "x$with_libpcap" = "xyes"
4004 then
4005         AC_CHECK_HEADERS(pcap.h,,
4006                          [with_libpcap="no (pcap.h not found)"])
4007 fi
4008 if test "x$with_libpcap" = "xyes"
4009 then
4010         AC_CACHE_CHECK([whether libpcap has PCAP_ERROR_IFACE_NOT_UP],
4011                        [c_cv_libpcap_have_pcap_error_iface_not_up],
4012                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
4013 [[[
4014 #include <pcap.h>
4015 ]]],
4016 [[[
4017   int val = PCAP_ERROR_IFACE_NOT_UP;
4018   return(val);
4019 ]]]
4020                        )],
4021                        [c_cv_libpcap_have_pcap_error_iface_not_up="yes"],
4022                        [c_cv_libpcap_have_pcap_error_iface_not_up="no"]))
4023 fi
4024 if test "x$c_cv_libpcap_have_pcap_error_iface_not_up" != "xyes"
4025 then
4026                 with_libpcap="no (pcap.h misses PCAP_ERROR_IFACE_NOT_UP)"
4027 fi
4028 AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
4029 # }}}
4030
4031 # --with-libperl {{{
4032 perl_interpreter="perl"
4033 AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
4034 [
4035         if test -f "$withval" && test -x "$withval"
4036         then
4037                 perl_interpreter="$withval"
4038                 with_libperl="yes"
4039         else if test "x$withval" != "xno" && test "x$withval" != "xyes"
4040         then
4041                 LDFLAGS="$LDFLAGS -L$withval/lib"
4042                 CPPFLAGS="$CPPFLAGS -I$withval/include"
4043                 perl_interpreter="$withval/bin/perl"
4044                 with_libperl="yes"
4045         else
4046                 with_libperl="$withval"
4047         fi; fi
4048 ],
4049 [
4050         with_libperl="yes"
4051 ])
4052
4053 AC_MSG_CHECKING([for perl])
4054 perl_interpreter=`which "$perl_interpreter" 2> /dev/null`
4055 if test -x "$perl_interpreter"
4056 then
4057         AC_MSG_RESULT([yes ($perl_interpreter)])
4058 else
4059         perl_interpreter=""
4060         AC_MSG_RESULT([no])
4061 fi
4062
4063 AC_SUBST(PERL, "$perl_interpreter")
4064
4065 if test "x$with_libperl" = "xyes" \
4066         && test -n "$perl_interpreter"
4067 then
4068   SAVE_CFLAGS="$CFLAGS"
4069   SAVE_LIBS="$LIBS"
4070 dnl ARCHFLAGS="" -> disable multi -arch on OSX (see Config_heavy.pl:fetch_string)
4071   PERL_CFLAGS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e perl_inc`
4072   PERL_LIBS=`ARCHFLAGS="" $perl_interpreter -MExtUtils::Embed -e ldopts`
4073   CFLAGS="$CFLAGS $PERL_CFLAGS"
4074   LIBS="$LIBS $PERL_LIBS"
4075
4076   AC_CACHE_CHECK([for libperl],
4077     [c_cv_have_libperl],
4078     AC_LINK_IFELSE([AC_LANG_PROGRAM(
4079 [[[
4080 #define PERL_NO_GET_CONTEXT
4081 #include <EXTERN.h>
4082 #include <perl.h>
4083 #include <XSUB.h>
4084 ]]],
4085 [[[
4086        dTHX;
4087        load_module (PERL_LOADMOD_NOIMPORT,
4088                          newSVpv ("Collectd::Plugin::FooBar", 24),
4089                          Nullsv);
4090 ]]]
4091       )],
4092       [c_cv_have_libperl="yes"],
4093       [c_cv_have_libperl="no"]
4094     )
4095   )
4096
4097   if test "x$c_cv_have_libperl" = "xyes"
4098   then
4099           AC_DEFINE(HAVE_LIBPERL, 1, [Define if libperl is present and usable.])
4100           AC_SUBST(PERL_CFLAGS)
4101           AC_SUBST(PERL_LIBS)
4102   else
4103           with_libperl="no"
4104   fi
4105
4106   CFLAGS="$SAVE_CFLAGS"
4107   LIBS="$SAVE_LIBS"
4108 else if test -z "$perl_interpreter"; then
4109   with_libperl="no (no perl interpreter found)"
4110   c_cv_have_libperl="no"
4111 fi; fi
4112 AM_CONDITIONAL(BUILD_WITH_LIBPERL, test "x$with_libperl" = "xyes")
4113
4114 if test "x$with_libperl" = "xyes"
4115 then
4116         SAVE_CFLAGS="$CFLAGS"
4117         SAVE_LIBS="$LIBS"
4118         CFLAGS="$CFLAGS $PERL_CFLAGS"
4119         LIBS="$LIBS $PERL_LIBS"
4120
4121         AC_CACHE_CHECK([if perl supports ithreads],
4122                 [c_cv_have_perl_ithreads],
4123                 AC_LINK_IFELSE([AC_LANG_PROGRAM(
4124 [[[
4125 #include <EXTERN.h>
4126 #include <perl.h>
4127 #include <XSUB.h>
4128
4129 #if !defined(USE_ITHREADS)
4130 # error "Perl does not support ithreads!"
4131 #endif /* !defined(USE_ITHREADS) */
4132 ]]],
4133 [[[ ]]]
4134                         )],
4135                         [c_cv_have_perl_ithreads="yes"],
4136                         [c_cv_have_perl_ithreads="no"]
4137                 )
4138         )
4139
4140         if test "x$c_cv_have_perl_ithreads" = "xyes"
4141         then
4142                 AC_DEFINE(HAVE_PERL_ITHREADS, 1, [Define if Perl supports ithreads.])
4143         fi
4144
4145         CFLAGS="$SAVE_CFLAGS"
4146         LIBS="$SAVE_LIBS"
4147 fi
4148
4149 if test "x$with_libperl" = "xyes"
4150 then
4151         SAVE_CFLAGS="$CFLAGS"
4152         SAVE_LIBS="$LIBS"
4153         # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3)
4154         # (see issues #41 and #42)
4155         CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror"
4156         LIBS="$LIBS $PERL_LIBS"
4157
4158         AC_CACHE_CHECK([for broken Perl_load_module()],
4159                 [c_cv_have_broken_perl_load_module],
4160                 AC_LINK_IFELSE([AC_LANG_PROGRAM(
4161 [[[
4162 #define PERL_NO_GET_CONTEXT
4163 #include <EXTERN.h>
4164 #include <perl.h>
4165 #include <XSUB.h>
4166 ]]],
4167 [[[
4168                          dTHX;
4169                          load_module (PERL_LOADMOD_NOIMPORT,
4170                              newSVpv ("Collectd::Plugin::FooBar", 24),
4171                              Nullsv);
4172 ]]]
4173                         )],
4174                         [c_cv_have_broken_perl_load_module="no"],
4175                         [c_cv_have_broken_perl_load_module="yes"]
4176                 )
4177         )
4178
4179         CFLAGS="$SAVE_CFLAGS"
4180         LIBS="$SAVE_LIBS"
4181 fi
4182 AM_CONDITIONAL(HAVE_BROKEN_PERL_LOAD_MODULE,
4183                 test "x$c_cv_have_broken_perl_load_module" = "xyes")
4184
4185 if test "x$with_libperl" = "xyes"
4186 then
4187         SAVE_CFLAGS="$CFLAGS"
4188         SAVE_LIBS="$LIBS"
4189         CFLAGS="$CFLAGS $PERL_CFLAGS"
4190         LIBS="$LIBS $PERL_LIBS"
4191
4192         AC_CHECK_MEMBER(
4193                 [struct mgvtbl.svt_local],
4194                 [have_struct_mgvtbl_svt_local="yes"],
4195                 [have_struct_mgvtbl_svt_local="no"],
4196                 [
4197 #include <EXTERN.h>
4198 #include <perl.h>
4199 #include <XSUB.h>
4200                 ])
4201
4202         if test "x$have_struct_mgvtbl_svt_local" = "xyes"
4203         then
4204                 AC_DEFINE(HAVE_PERL_STRUCT_MGVTBL_SVT_LOCAL, 1,
4205                                   [Define if Perl's struct mgvtbl has member svt_local.])
4206         fi
4207
4208         CFLAGS="$SAVE_CFLAGS"
4209         LIBS="$SAVE_LIBS"
4210 fi
4211 # }}}
4212
4213 # --with-libpq {{{
4214 with_pg_config="pg_config"
4215 with_libpq_includedir=""
4216 with_libpq_libdir=""
4217 with_libpq_cppflags=""
4218 with_libpq_ldflags=""
4219 AC_ARG_WITH(libpq, [AS_HELP_STRING([--with-libpq@<:@=PREFIX@:>@],
4220         [Path to libpq.])],
4221 [
4222         if test "x$withval" = "xno"
4223         then
4224                 with_libpq="no"
4225         else if test "x$withval" = "xyes"
4226         then
4227                 with_libpq="yes"
4228         else
4229                 if test -f "$withval" && test -x "$withval";
4230                 then
4231                         with_pg_config="$withval"
4232                 else if test -x "$withval/bin/pg_config"
4233                 then
4234                         with_pg_config="$withval/bin/pg_config"
4235                 fi; fi
4236                 with_libpq="yes"
4237         fi; fi
4238 ],
4239 [
4240         with_libpq="yes"
4241 ])
4242 if test "x$with_libpq" = "xyes"
4243 then
4244         with_libpq_includedir=`$with_pg_config --includedir 2> /dev/null`
4245         pg_config_status=$?
4246
4247         if test $pg_config_status -eq 0
4248         then
4249                 if test -n "$with_libpq_includedir"; then
4250                         for dir in $with_libpq_includedir; do
4251                                 with_libpq_cppflags="$with_libpq_cppflags -I$dir"
4252                         done
4253                 fi
4254         else
4255                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
4256         fi
4257
4258         SAVE_CPPFLAGS="$CPPFLAGS"
4259         CPPFLAGS="$CPPFLAGS $with_libpq_cppflags"
4260
4261         AC_CHECK_HEADERS(libpq-fe.h, [],
4262                 [with_libpq="no (libpq-fe.h not found)"], [])
4263
4264         CPPFLAGS="$SAVE_CPPFLAGS"
4265 fi
4266 if test "x$with_libpq" = "xyes"
4267 then
4268         with_libpq_libdir=`$with_pg_config --libdir 2> /dev/null`
4269         pg_config_status=$?
4270
4271         if test $pg_config_status -eq 0
4272         then
4273                 if test -n "$with_libpq_libdir"; then
4274                         for dir in $with_libpq_libdir; do
4275                                 with_libpq_ldflags="$with_libpq_ldflags -L$dir"
4276                         done
4277                 fi
4278         else
4279                 AC_MSG_WARN([$with_pg_config returned with status $pg_config_status])
4280         fi
4281
4282         SAVE_LDFLAGS="$LDFLAGS"
4283         LDFLAGS="$LDFLAGS $with_libpq_ldflags"
4284
4285         AC_CHECK_LIB(pq, PQconnectdb,
4286                 [with_libpq="yes"],
4287                 [with_libpq="no (symbol 'PQconnectdb' not found)"])
4288
4289         AC_CHECK_LIB(pq, PQserverVersion,
4290                 [with_libpq="yes"],
4291                 [with_libpq="no (symbol 'PQserverVersion' not found)"])
4292
4293         LDFLAGS="$SAVE_LDFLAGS"
4294 fi
4295 if test "x$with_libpq" = "xyes"
4296 then
4297         BUILD_WITH_LIBPQ_CPPFLAGS="$with_libpq_cppflags"
4298         BUILD_WITH_LIBPQ_LDFLAGS="$with_libpq_ldflags"
4299         AC_SUBST(BUILD_WITH_LIBPQ_CPPFLAGS)
4300         AC_SUBST(BUILD_WITH_LIBPQ_LDFLAGS)
4301 fi
4302 AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
4303 # }}}
4304
4305 # --with-libpqos {{{
4306 with_libpqos_cppflags=""
4307 with_libpqos_ldflags=""
4308 AC_ARG_WITH(libpqos, [AS_HELP_STRING([--with-libpqos@<:@=PREFIX@:>@], [Path to libpqos.])],
4309 [
4310         if test "x$withval" != "xno" && test "x$withval" != "xyes"
4311         then
4312                 with_libpqos_cppflags="-I$withval/include"
4313                 with_libpqos_ldflags="-L$withval/lib"
4314                 with_libpqos="yes"
4315         else
4316                 with_libpqos="$withval"
4317         fi
4318 ],
4319 [
4320         with_libpqos="yes"
4321 ])
4322 if test "x$with_libpqos" = "xyes"
4323 then
4324         SAVE_CPPFLAGS="$CPPFLAGS"
4325         CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
4326
4327         AC_CHECK_HEADERS(pqos.h, [with_libpqos="yes"], [with_libpqos="no (pqos.h not found)"])
4328
4329         CPPFLAGS="$SAVE_CPPFLAGS"
4330 fi
4331 if test "x$with_libpqos" = "xyes"
4332 then
4333         SAVE_CPPFLAGS="$CPPFLAGS"
4334         SAVE_LDFLAGS="$LDFLAGS"
4335         CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
4336         LDFLAGS="$LDFLAGS $with_libpqos_ldflags"
4337
4338         AC_CHECK_LIB(pqos, pqos_init, [with_libpqos="yes"], [with_libpqos="no (Can't find libpqos)"])
4339
4340         CPPFLAGS="$SAVE_CPPFLAGS"
4341         LDFLAGS="$SAVE_LDFLAGS"
4342 fi
4343 if test "x$with_libpqos" = "xyes"
4344 then
4345   SAVE_CPPFLAGS="$CPPFLAGS"
4346   CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
4347   AC_RUN_IFELSE([AC_LANG_PROGRAM(
4348     [[#include <pqos.h>]],
4349     [[return !(PQOS_VERSION >= 106)]])],
4350     [with_libpqos="yes"], [with_libpqos="no (pqos library version 1.06 or higher is required)"])
4351   CPPFLAGS="$SAVE_CPPFLAGS"
4352 fi
4353 if test "x$with_libpqos" = "xyes"
4354 then
4355         BUILD_WITH_LIBPQOS_CPPFLAGS="$with_libpqos_cppflags"
4356         BUILD_WITH_LIBPQOS_LDFLAGS="$with_libpqos_ldflags"
4357         BUILD_WITH_LIBPQOS_LIBS="-lpqos"
4358         AC_SUBST(BUILD_WITH_LIBPQOS_CPPFLAGS)
4359         AC_SUBST(BUILD_WITH_LIBPQOS_LDFLAGS)
4360         AC_SUBST(BUILD_WITH_LIBPQOS_LIBS)
4361 fi
4362 # }}}
4363
4364 # --with-libprotobuf {{{
4365 with_libprotobuf_cppflags=""
4366 with_libprotobuf_ldflags=""
4367 AC_ARG_WITH([libprotobuf], [AS_HELP_STRING([--with-libprotobuf@<:@=PREFIX@:>@], [Path to libprotobuf.])],
4368   [
4369     if test "x$withval" != "xno" && test "x$withval" != "xyes"
4370     then
4371       with_libprotobuf_cppflags="-I$withval/include"
4372       with_libprotobuf_ldflags="-L$withval/lib"
4373       with_libprotobuf="yes"
4374     fi
4375     if test "x$withval" = "xno"
4376     then
4377       with_libprotobuf="no (disabled on command line)"
4378     fi
4379   ],
4380   [withval="yes"]
4381 )
4382 if test "x$withval" = "xyes"
4383 then
4384 PKG_CHECK_MODULES([PROTOBUF], [protobuf],
4385   [with_libprotobuf="yes"],
4386   [with_libprotobuf="no (pkg-config could not find libprotobuf)"]
4387 )
4388 fi
4389
4390 if test "x$withval" != "xno"
4391 then
4392   SAVE_LDFLAGS="$LDFLAGS"
4393   SAVE_LIBS="$LIBS"
4394   LDFLAGS="$with_libprotobuf_ldflags"
4395   LIBS="$PROTOBUF_LIBS $LIBS"
4396   AC_LANG_PUSH([C++])
4397   AC_CHECK_LIB([protobuf], [main],
4398     [
4399       SAVE_CPPFLAGS="$CPPFLAGS"
4400       CPPFLAGS="$with_libprotobuf_cppflags $PROTOBUF_CFLAGS"
4401       if test "x$PROTOBUF_LIBS" = "x"
4402       then
4403         PROTOBUF_LIBS="-lprotobuf"
4404       fi
4405       AC_CHECK_HEADERS([google/protobuf/util/time_util.h],
4406         [with_libprotobuf="yes"],
4407         [with_libprotobuf="no (<google/protobuf/util/time_util.h> not found)"]
4408       )
4409       CPPFLAGS="$SAVE_CPPFLAGS"
4410     ],
4411     [with_libprotobuf="no (libprotobuf not found)"]
4412   )
4413   AC_LANG_POP([C++])
4414   LDFLAGS="$SAVE_LDFLAGS"
4415   LIBS="$SAVE_LIBS"
4416 fi
4417 BUILD_WITH_LIBPROTOBUF_CPPFLAGS="$with_libprotobuf_cppflags $PROTOBUF_CFLAGS"
4418 BUILD_WITH_LIBPROTOBUF_LDFLAGS="$with_libprotobuf_ldflags"
4419 BUILD_WITH_LIBPROTOBUF_LIBS="$PROTOBUF_LIBS"
4420 AC_SUBST([BUILD_WITH_LIBPROTOBUF_CPPFLAGS])
4421 AC_SUBST([BUILD_WITH_LIBPROTOBUF_LDFLAGS])
4422 AC_SUBST([BUILD_WITH_LIBPROTOBUF_LIBS])
4423 # }}}
4424
4425 # --with-libprotobuf-c {{{
4426 with_libprotobuf_c_cppflags=""
4427 with_libprotobuf_c_ldflags=""
4428 AC_ARG_WITH([libprotobuf-c], [AS_HELP_STRING([--with-libprotobuf-c@<:@=PREFIX@:>@], [Path to libprotobuf-c.])],
4429   [
4430     if test "x$withval" != "xno" && test "x$withval" != "xyes"
4431     then
4432       with_libprotobuf_c_cppflags="-I$withval/include"
4433       with_libprotobuf_c_ldflags="-L$withval/lib"
4434       with_libprotobuf_c="yes"
4435     fi
4436     if test "x$withval" = "xno"
4437     then
4438       with_libprotobuf_c="no (disabled on command line)"
4439     fi
4440   ],
4441   [withval="yes"]
4442 )
4443 if test "x$withval" = "xyes"
4444 then
4445 PKG_CHECK_MODULES([PROTOBUF_C], [libprotobuf-c],
4446   [with_libprotobuf_c="yes"],
4447   [with_libprotobuf_c="no (pkg-config could not find libprotobuf-c)"]
4448 )
4449 fi
4450
4451 if test "x$withval" != "xno"
4452 then
4453   SAVE_LDFLAGS="$LDFLAGS"
4454   SAVE_LIBS="$LIBS"
4455   LDFLAGS="$with_libprotobuf_c_ldflags"
4456   LIBS="$PROTOBUF_C_LIBS $LIBS"
4457   AC_CHECK_LIB([protobuf-c], [protobuf_c_message_pack],
4458     [
4459       SAVE_CPPFLAGS="$CPPFLAGS"
4460       CPPFLAGS="$with_libprotobuf_c_cppflags $PROTOBUF_C_CFLAGS"
4461       if test "x$PROTOBUF_C_LIBS" = "x"
4462       then
4463         PROTOBUF_C_LIBS="-lprotobuf-c"
4464       fi
4465       AC_CHECK_HEADERS([protobuf-c/protobuf-c.h google/protobuf-c/protobuf-c.h],
4466         [
4467           with_libprotobuf_c="yes"
4468           break
4469         ],
4470         [with_libprotobuf_c="no (<protobuf-c.h> not found)"]
4471       )
4472       CPPFLAGS="$SAVE_CPPFLAGS"
4473     ],
4474     [with_libprotobuf_c="no (libprotobuf-c not found)"]
4475   )
4476   LDFLAGS="$SAVE_LDFLAGS"
4477   LIBS="$SAVE_LIBS"
4478 fi
4479 BUILD_WITH_LIBPROTOBUF_C_CPPFLAGS="$with_libprotobuf_c_cppflags $PROTOBUF_C_CFLAGS"
4480 BUILD_WITH_LIBPROTOBUF_C_LDFLAGS="$with_libprotobuf_c_ldflags"
4481 BUILD_WITH_LIBPROTOBUF_C_LIBS="$PROTOBUF_C_LIBS"
4482 AC_SUBST([BUILD_WITH_LIBPROTOBUF_C_CPPFLAGS])
4483 AC_SUBST([BUILD_WITH_LIBPROTOBUF_C_LDFLAGS])
4484 AC_SUBST([BUILD_WITH_LIBPROTOBUF_C_LIBS])
4485 # }}}
4486
4487 # --with-libpython {{{
4488 AC_ARG_VAR([LIBPYTHON_CPPFLAGS], [Preprocessor flags for libpython])
4489 AC_ARG_VAR([LIBPYTHON_LDFLAGS], [Linker flags for libpython])
4490 AC_ARG_VAR([LIBPYTHON_LIBS], [Libraries for libpython])
4491
4492 AC_ARG_WITH([libpython],
4493   [AS_HELP_STRING([--with-libpython],
4494     [if we should build with libpython @<:@default=yes@:>@])
4495   ],
4496   [with_libpython="$withval"],
4497   [with_libpython="check"]
4498 )
4499 if test "$with_libpython" != "no"; then
4500   if test "$LIBPYTHON_CPPFLAGS" = "" && test "$LIBPYTHON_LDFLAGS" = ""; then
4501     AC_ARG_VAR([PYTHON_CONFIG], [path to python-config])
4502     AC_PATH_PROGS([PYTHON_CONFIG],
4503       [python3-config python2-config python-config]
4504     )
4505     if test "$PYTHON_CONFIG" = ""; then
4506       if test "$with_libpython" = "yes"; then
4507         AC_MSG_ERROR([Unable to find python-config])
4508       fi
4509       with_libpython="no"
4510     fi
4511   fi
4512 fi
4513
4514 if test "$PYTHON_CONFIG" != ""; then
4515   LIBPYTHON_CPPFLAGS="`${PYTHON_CONFIG} --includes`"
4516   if test $? -ne 0; then
4517     with_libpython="no"
4518   fi
4519   LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags`"
4520   if test $? -ne 0; then
4521     with_libpython="no"
4522   fi
4523   LIBPYTHON_LIBS="`${PYTHON_CONFIG} --libs`"
4524   if test $? -ne 0; then
4525     with_libpython="no"
4526   fi
4527 fi
4528
4529 if test "$with_libpython" != "xno"; then
4530   SAVE_CPPFLAGS="$CPPFLAGS"
4531   SAVE_LDFLAGS="$LDFLAGS"
4532   SAVE_LIBS="$LIBS"
4533   CPPFLAGS="$LIBPYTHON_CPPFLAGS $CPPFLAGS"
4534   LDFLAGS="$LIBPYTHON_LDFLAGS $LDFLAGS"
4535   LIBS="$LIBPYTHON_LIBS $LIBS"
4536   AC_CHECK_HEADERS([Python.h],
4537     [
4538       AC_MSG_CHECKING([for libpython])
4539       AC_LINK_IFELSE([AC_LANG_PROGRAM(
4540           [[#include <Python.h>]],
4541           [[Py_Initialize();]])
4542         ],
4543         [with_libpython="yes"],
4544         [with_libpython="no"]
4545       )
4546       AC_MSG_RESULT([$with_libpython])
4547     ],
4548     [with_libpython="no"]
4549   )
4550   CPPFLAGS="$SAVE_CPPFLAGS"
4551   LDFLAGS="$SAVE_LDFLAGS"
4552   LIBS="$SAVE_LIBS"
4553 fi
4554 # }}} --with-libpython
4555
4556 # --with-librabbitmq {{{
4557 with_librabbitmq_cppflags=""
4558 with_librabbitmq_ldflags=""
4559 AC_ARG_WITH(librabbitmq, [AS_HELP_STRING([--with-librabbitmq@<:@=PREFIX@:>@], [Path to librabbitmq.])],
4560 [
4561         if test "x$withval" != "xno" && test "x$withval" != "xyes"
4562         then
4563                 with_librabbitmq_cppflags="-I$withval/include"
4564                 with_librabbitmq_ldflags="-L$withval/lib"
4565                 with_librabbitmq="yes"
4566         else
4567                 with_librabbitmq="$withval"
4568         fi
4569 ],
4570 [
4571         with_librabbitmq="yes"
4572 ])
4573 SAVE_CPPFLAGS="$CPPFLAGS"
4574 SAVE_LDFLAGS="$LDFLAGS"
4575 CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
4576 LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
4577 if test "x$with_librabbitmq" = "xyes"
4578 then
4579         AC_CHECK_HEADERS(amqp.h, [with_librabbitmq="yes"], [with_librabbitmq="no (amqp.h not found)"])
4580 fi
4581 if test "x$with_librabbitmq" = "xyes"
4582 then
4583         # librabbitmq up to version 0.9.1 provides "library_errno", later
4584         # versions use "library_error". The library does not provide a version
4585         # macro :( Use "AC_CHECK_MEMBERS" (plural) for automatic defines.
4586         AC_CHECK_MEMBERS([amqp_rpc_reply_t.library_errno],,,
4587                          [
4588 #if HAVE_STDLIB_H
4589 # include <stdlib.h>
4590 #endif
4591 #if HAVE_STDIO_H
4592 # include <stdio.h>
4593 #endif
4594 #if HAVE_STDINT_H
4595 # include <stdint.h>
4596 #endif
4597 #if HAVE_INTTYPES_H
4598 # include <inttypes.h>
4599 #endif
4600 #include <amqp.h>
4601                          ])
4602 fi
4603 if test "x$with_librabbitmq" = "xyes"
4604 then
4605         AC_CHECK_LIB(rabbitmq, amqp_basic_publish, [with_librabbitmq="yes"], [with_librabbitmq="no (Symbol 'amqp_basic_publish' not found)"])
4606 fi
4607 if test "x$with_librabbitmq" = "xyes"
4608 then
4609         BUILD_WITH_LIBRABBITMQ_CPPFLAGS="$with_librabbitmq_cppflags"
4610         BUILD_WITH_LIBRABBITMQ_LDFLAGS="$with_librabbitmq_ldflags"
4611         BUILD_WITH_LIBRABBITMQ_LIBS="-lrabbitmq"
4612         AC_SUBST(BUILD_WITH_LIBRABBITMQ_CPPFLAGS)
4613         AC_SUBST(BUILD_WITH_LIBRABBITMQ_LDFLAGS)
4614         AC_SUBST(BUILD_WITH_LIBRABBITMQ_LIBS)
4615         AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define if librabbitmq is present and usable.])
4616 fi
4617 CPPFLAGS="$SAVE_CPPFLAGS"
4618 LDFLAGS="$SAVE_LDFLAGS"
4619 AM_CONDITIONAL(BUILD_WITH_LIBRABBITMQ, test "x$with_librabbitmq" = "xyes")
4620
4621 with_amqp_tcp_socket="no"
4622 if test "x$with_librabbitmq" = "xyes"
4623 then
4624         SAVE_CPPFLAGS="$CPPFLAGS"
4625         SAVE_LDFLAGS="$LDFLAGS"
4626         SAVE_LIBS="$LIBS"
4627         CPPFLAGS="$CPPFLAGS $with_librabbitmq_cppflags"
4628         LDFLAGS="$LDFLAGS $with_librabbitmq_ldflags"
4629         LIBS="-lrabbitmq"
4630
4631         AC_CHECK_HEADERS(amqp_tcp_socket.h amqp_socket.h)
4632         AC_CHECK_FUNC(amqp_tcp_socket_new, [with_amqp_tcp_socket="yes"], [with_amqp_tcp_socket="no"])
4633         if test "x$with_amqp_tcp_socket" = "xyes"
4634         then
4635                 AC_DEFINE(HAVE_AMQP_TCP_SOCKET, 1,
4636                                 [Define if librabbitmq provides the new TCP socket interface.])
4637         fi
4638
4639         AC_CHECK_DECLS(amqp_socket_close,
4640                                 [amqp_socket_close_decl="yes"], [amqp_socket_close_decl="no"],
4641                                 [[
4642 #include <amqp.h>
4643 #ifdef HAVE_AMQP_TCP_SOCKET_H
4644 # include <amqp_tcp_socket.h>
4645 #endif
4646 #ifdef HAVE_AMQP_SOCKET_H
4647 # include <amqp_socket.h>
4648 #endif
4649                                 ]])
4650
4651         CPPFLAGS="$SAVE_CPPFLAGS"
4652         LDFLAGS="$SAVE_LDFLAGS"
4653         LIBS="$SAVE_LIBS"
4654 fi
4655 # }}}
4656
4657 # --with-librdkafka {{{
4658 AC_ARG_WITH(librdkafka, [AS_HELP_STRING([--with-librdkafka@<:@=PREFIX@:>@], [Path to librdkafka.])],
4659 [
4660   if test "x$withval" != "xno" && test "x$withval" != "xyes"
4661   then
4662     with_librdkafka_cppflags="-I$withval/include"
4663     with_librdkafka_ldflags="-L$withval/lib"
4664     with_librdkafka_rpath="$withval/lib"
4665     with_librdkafka="yes"
4666   else
4667     with_librdkafka="$withval"
4668   fi
4669 ],
4670 [
4671   with_librdkafka="yes"
4672 ])
4673 SAVE_CPPFLAGS="$CPPFLAGS"
4674 SAVE_LDFLAGS="$LDFLAGS"
4675
4676 CPPFLAGS="$CPPFLAGS $with_librdkafka_cppflags"
4677 LDFLAGS="$LDFLAGS $with_librdkafka_ldflags"
4678
4679 if test "x$with_librdkafka" = "xyes"
4680 then
4681         AC_CHECK_HEADERS(librdkafka/rdkafka.h, [with_librdkafka="yes"], [with_librdkafka="no (librdkafka/rdkafka.h not found)"])
4682 fi
4683
4684 if test "x$with_librdkafka" = "xyes"
4685 then
4686         AC_CHECK_LIB(rdkafka, rd_kafka_new, [with_librdkafka="yes"], [with_librdkafka="no (Symbol 'rd_kafka_new' not found)"])
4687   AC_CHECK_LIB(rdkafka, rd_kafka_conf_set_log_cb, [with_librdkafka_log_cb="yes"], [with_librdkafka_log_cb="no"])
4688   AC_CHECK_LIB(rdkafka, rd_kafka_set_logger, [with_librdkafka_logger="yes"], [with_librdkafka_logger="no"])
4689 fi
4690 if test "x$with_librdkafka" = "xyes"
4691 then
4692         BUILD_WITH_LIBRDKAFKA_CPPFLAGS="$with_librdkafka_cppflags"
4693         BUILD_WITH_LIBRDKAFKA_LDFLAGS="$with_librdkafka_ldflags"
4694         if test "x$with_librdkafka_rpath" != "x"
4695         then
4696                 BUILD_WITH_LIBRDKAFKA_LIBS="-Wl,-rpath,$with_librdkafka_rpath -lrdkafka"
4697         else
4698                 BUILD_WITH_LIBRDKAFKA_LIBS="-lrdkafka"
4699         fi
4700         AC_SUBST(BUILD_WITH_LIBRDKAFKA_CPPFLAGS)
4701         AC_SUBST(BUILD_WITH_LIBRDKAFKA_LDFLAGS)
4702         AC_SUBST(BUILD_WITH_LIBRDKAFKA_LIBS)
4703         AC_DEFINE(HAVE_LIBRDKAFKA, 1, [Define if librdkafka is present and usable.])
4704   if test "x$with_librdkafka_log_cb" = "xyes"
4705   then
4706         AC_DEFINE(HAVE_LIBRDKAFKA_LOG_CB, 1, [Define if librdkafka log facility is present and usable.])
4707   else if test "x$with_librdkafka_logger" = "xyes"
4708   then
4709         AC_DEFINE(HAVE_LIBRDKAFKA_LOGGER, 1, [Define if librdkafka log facility is present and usable.])
4710   fi; fi
4711 fi
4712 CPPFLAGS="$SAVE_CPPFLAGS"
4713 LDFLAGS="$SAVE_LDFLAGS"
4714 AM_CONDITIONAL(BUILD_WITH_LIBRDKAFKA, test "x$with_librdkafka" = "xyes")
4715
4716 # }}}
4717
4718 # --with-librouteros {{{
4719 AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])],
4720 [
4721  if test "x$withval" = "xyes"
4722  then
4723          with_librouteros="yes"
4724  else if test "x$withval" = "xno"
4725  then
4726          with_librouteros="no"
4727  else
4728          with_librouteros="yes"
4729          LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include"
4730          LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib"
4731  fi; fi
4732 ],
4733 [with_librouteros="yes"])
4734
4735 SAVE_CPPFLAGS="$CPPFLAGS"
4736 SAVE_LDFLAGS="$LDFLAGS"
4737
4738 CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS"
4739 LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS"
4740
4741 if test "x$with_librouteros" = "xyes"
4742 then
4743         if test "x$LIBROUTEROS_CPPFLAGS" != "x"
4744         then
4745                 AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS])
4746         fi
4747         AC_CHECK_HEADERS(routeros_api.h,
4748         [with_librouteros="yes"],
4749         [with_librouteros="no (routeros_api.h not found)"])
4750 fi
4751 if test "x$with_librouteros" = "xyes"
4752 then
4753         if test "x$LIBROUTEROS_LDFLAGS" != "x"
4754         then
4755                 AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS])
4756         fi
4757         AC_CHECK_LIB(routeros, ros_interface,
4758         [with_librouteros="yes"],
4759         [with_librouteros="no (symbol 'ros_interface' not found)"])
4760 fi
4761
4762 CPPFLAGS="$SAVE_CPPFLAGS"
4763 LDFLAGS="$SAVE_LDFLAGS"
4764
4765 if test "x$with_librouteros" = "xyes"
4766 then
4767         BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS"
4768         BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS"
4769         AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS)
4770         AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS)
4771 fi
4772 AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes")
4773 # }}}
4774
4775 # --with-librrd {{{
4776 librrd_cflags=""
4777 librrd_ldflags=""
4778 librrd_threadsafe="no"
4779 librrd_rrdc_update="no"
4780 AC_ARG_WITH(librrd,
4781   [AS_HELP_STRING([--with-librrd@<:@=PREFIX@:>@], [Path to rrdtool.])],
4782   [
4783     if test "x$withval" != "xno" && test "x$withval" != "xyes"
4784     then
4785       librrd_cflags="-I$withval/include"
4786       librrd_ldflags="-L$withval/lib"
4787       with_librrd="yes"
4788     else
4789       with_librrd="$withval"
4790     fi
4791   ],
4792   [with_librrd="yes"]
4793 )
4794
4795 if test "x$with_librrd" = "xyes"
4796 then
4797   SAVE_LDFLAGS="$LDFLAGS"
4798   LDFLAGS="$LDFLAGS $librrd_ldflags"
4799   PKG_CHECK_MODULES([RRD], [librrd >= 1.6.0],
4800     [
4801       AC_CHECK_LIB([rrd], [rrd_update_r],
4802         [librrd_threadsafe="yes"],
4803         [:]
4804       )
4805       AC_CHECK_LIB([rrd], [rrdc_update],
4806         [librrd_rrdc_update="yes"],
4807         [:]
4808       )
4809     ],[:]
4810   )
4811   LDFLAGS="$SAVE_LDFLAGS"
4812
4813   SAVE_CPPFLAGS="$CPPFLAGS"
4814   CPPFLAGS="$CPPFLAGS $RRD_CFLAGS $librrd_cflags"
4815
4816   AC_CHECK_HEADERS([rrd.h],, [with_librrd="no (rrd.h not found)"])
4817
4818   CPPFLAGS="$SAVE_CPPFLAGS"
4819 fi
4820
4821 if test "x$with_librrd" = "xyes" && test "x$librrd_threadsafe" = "xno"
4822 then
4823   SAVE_LDFLAGS="$LDFLAGS"
4824   LDFLAGS="$LDFLAGS $librrd_ldflags"
4825
4826   AC_CHECK_LIB([rrd_th], [rrd_update_r],
4827     [
4828       librrd_ldflags="$librrd_ldflags -lrrd_th"
4829       librrd_threadsafe="yes"
4830       AC_CHECK_LIB([rrd_th], [rrdc_update],
4831         [librrd_rrdc_update="yes"],
4832         [:],
4833       )
4834     ],
4835     [:]
4836   )
4837   LDFLAGS="$SAVE_LDFLAGS"
4838 fi
4839
4840 if test "x$with_librrd" = "xyes" && test "x$librrd_threadsafe" = "xno"
4841 then
4842   SAVE_LDFLAGS="$LDFLAGS"
4843   LDFLAGS="$LDFLAGS $librrd_ldflags"
4844
4845   AC_CHECK_LIB([rrd], [rrd_update],
4846     [
4847       librrd_ldflags="$librrd_ldflags -lrrd"
4848       AC_CHECK_LIB([rrd], [rrdc_update],
4849         [librrd_rrdc_update="yes"],
4850         [:]
4851       )
4852     ],
4853     [with_librrd="no (symbol 'rrd_update' not found)"]
4854   )
4855   LDFLAGS="$SAVE_LDFLAGS"
4856 fi
4857
4858 if test "x$with_librrd" = "xyes"
4859 then
4860   BUILD_WITH_LIBRRD_CFLAGS="$RRD_CFLAGS $librrd_cflags"
4861   BUILD_WITH_LIBRRD_LDFLAGS="$librrd_ldflags"
4862   BUILD_WITH_LIBRRD_LIBS="$RRD_LIBS"
4863   AC_SUBST(BUILD_WITH_LIBRRD_CFLAGS)
4864   AC_SUBST(BUILD_WITH_LIBRRD_LDFLAGS)
4865   AC_SUBST(BUILD_WITH_LIBRRD_LIBS)
4866 fi
4867 if test "x$librrd_threadsafe" = "xyes"
4868 then
4869   AC_DEFINE([HAVE_THREADSAFE_LIBRRD], [1],
4870     [Define to 1 if the rrd library is thread-safe]
4871   )
4872 fi
4873 # }}}
4874
4875 # --with-libsensors {{{
4876 with_sensors_cflags=""
4877 with_sensors_ldflags=""
4878 AC_ARG_WITH(libsensors, [AS_HELP_STRING([--with-libsensors@<:@=PREFIX@:>@], [Path to lm_sensors.])],
4879 [
4880         if test "x$withval" = "xno"
4881         then
4882                 with_libsensors="no"
4883         else
4884                 with_libsensors="yes"
4885                 if test "x$withval" != "xyes"
4886                 then
4887                         with_sensors_cflags="-I$withval/include"
4888                         with_sensors_ldflags="-L$withval/lib"
4889                         with_libsensors="yes"
4890                 fi
4891         fi
4892 ],
4893 [
4894         if test "x$ac_system" = "xLinux"
4895         then
4896                 with_libsensors="yes"
4897         else
4898                 with_libsensors="no (Linux only library)"
4899         fi
4900 ])
4901 if test "x$with_libsensors" = "xyes"
4902 then
4903         SAVE_CPPFLAGS="$CPPFLAGS"
4904         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
4905
4906         AC_CHECK_HEADERS(sensors/sensors.h, [], [with_libsensors="no (sensors/sensors.h not found)"])
4907
4908         CPPFLAGS="$SAVE_CPPFLAGS"
4909 fi
4910 if test "x$with_libsensors" = "xyes"
4911 then
4912         SAVE_CPPFLAGS="$CPPFLAGS"
4913         SAVE_LDFLAGS="$LDFLAGS"
4914         CPPFLAGS="$CPPFLAGS $with_sensors_cflags"
4915         LDFLAGS="$LDFLAGS $with_sensors_ldflags"
4916
4917         AC_CHECK_LIB(sensors, sensors_init,
4918         [
4919                 AC_DEFINE(HAVE_LIBSENSORS, 1, [Define to 1 if you have the sensors library (-lsensors).])
4920         ],
4921         [with_libsensors="no (libsensors not found)"])
4922
4923         CPPFLAGS="$SAVE_CPPFLAGS"
4924         LDFLAGS="$SAVE_LDFLAGS"
4925 fi
4926 if test "x$with_libsensors" = "xyes"
4927 then
4928         BUILD_WITH_LIBSENSORS_CFLAGS="$with_sensors_cflags"
4929         BUILD_WITH_LIBSENSORS_LDFLAGS="$with_sensors_ldflags"
4930         AC_SUBST(BUILD_WITH_LIBSENSORS_CFLAGS)
4931         AC_SUBST(BUILD_WITH_LIBSENSORS_LDFLAGS)
4932 fi
4933 AM_CONDITIONAL(BUILD_WITH_LM_SENSORS, test "x$with_libsensors" = "xyes")
4934 # }}}
4935
4936 # libsigrok {{{
4937 AC_SUBST([LIBSIGROK_CFLAGS])
4938 AC_SUBST([LIBSIGROK_LIBS])
4939 PKG_CHECK_MODULES([LIBSIGROK], [libsigrok < 0.4],
4940   [with_libsigrok="yes"],
4941   [with_libsigrok="no (pkg-config could not find libsigrok)"]
4942 )
4943 # }}}
4944
4945 # --with-libstatgrab {{{
4946 with_libstatgrab_cflags=""
4947 with_libstatgrab_ldflags=""
4948 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
4949 [
4950  if test "x$withval" != "xno" \
4951    && test "x$withval" != "xyes"
4952  then
4953    with_libstatgrab_cflags="-I$withval/include"
4954    with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
4955    with_libstatgrab="yes"
4956    with_libstatgrab_pkg_config="no"
4957  else
4958    with_libstatgrab="$withval"
4959    with_libstatgrab_pkg_config="yes"
4960  fi
4961  ],
4962 [
4963  with_libstatgrab="yes"
4964  with_libstatgrab_pkg_config="yes"
4965 ])
4966
4967 if test "x$with_libstatgrab" = "xyes" \
4968   && test "x$with_libstatgrab_pkg_config" = "xyes"
4969 then
4970   AC_MSG_CHECKING([pkg-config for libstatgrab])
4971   temp_result="found"
4972   $PKG_CONFIG --exists libstatgrab 2>/dev/null
4973   if test "$?" != "0"
4974   then
4975     with_libstatgrab_pkg_config="no"
4976     with_libstatgrab="no (pkg-config doesn't know libstatgrab)"
4977     temp_result="not found"
4978   fi
4979   AC_MSG_RESULT([$temp_result])
4980 fi
4981
4982 if test "x$with_libstatgrab" = "xyes" \
4983   && test "x$with_libstatgrab_pkg_config" = "xyes" \
4984   && test "x$with_libstatgrab_cflags" = "x"
4985 then
4986   AC_MSG_CHECKING([for libstatgrab CFLAGS])
4987   temp_result="`$PKG_CONFIG --cflags libstatgrab`"
4988   if test "$?" = "0"
4989   then
4990     with_libstatgrab_cflags="$temp_result"
4991   else
4992     with_libstatgrab="no ($PKG_CONFIG --cflags libstatgrab failed)"
4993     temp_result="$PKG_CONFIG --cflags libstatgrab failed"
4994   fi
4995   AC_MSG_RESULT([$temp_result])
4996 fi
4997
4998 if test "x$with_libstatgrab" = "xyes" \
4999   && test "x$with_libstatgrab_pkg_config" = "xyes" \
5000   && test "x$with_libstatgrab_ldflags" = "x"
5001 then
5002   AC_MSG_CHECKING([for libstatgrab LDFLAGS])
5003   temp_result="`$PKG_CONFIG --libs libstatgrab`"
5004   if test "$?" = "0"
5005   then
5006     with_libstatgrab_ldflags="$temp_result"
5007   else
5008     with_libstatgrab="no ($PKG_CONFIG --libs libstatgrab failed)"
5009     temp_result="$PKG_CONFIG --libs libstatgrab failed"
5010   fi
5011   AC_MSG_RESULT([$temp_result])
5012 fi
5013
5014 if test "x$with_libstatgrab" = "xyes"
5015 then
5016   SAVE_CPPFLAGS="$CPPFLAGS"
5017   CPPFLAGS="$CPPFLAGS $with_libstatgrab_cflags"
5018
5019   AC_CHECK_HEADERS(statgrab.h,
5020                    [with_libstatgrab="yes"],
5021                    [with_libstatgrab="no (statgrab.h not found)"])
5022
5023   CPPFLAGS="$SAVE_CPPFLAGS"
5024 fi
5025
5026 if test "x$with_libstatgrab" = "xyes"
5027 then
5028   SAVE_CFLAGS="$CFLAGS"
5029   SAVE_LDFLAGS="$LDFLAGS"
5030
5031   CFLAGS="$CFLAGS $with_libstatgrab_cflags"
5032   LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
5033
5034   AC_CHECK_LIB(statgrab, sg_init,
5035                [with_libstatgrab="yes"],
5036                [with_libstatgrab="no (symbol sg_init not found)"])
5037
5038   CFLAGS="$SAVE_CFLAGS"
5039   LDFLAGS="$SAVE_LDFLAGS"
5040 fi
5041
5042 if test "x$with_libstatgrab" = "xyes"
5043 then
5044   SAVE_CFLAGS="$CFLAGS"
5045   SAVE_LDFLAGS="$LDFLAGS"
5046   SAVE_LIBS="$LIBS"
5047
5048   CFLAGS="$CFLAGS $with_libstatgrab_cflags"
5049   LDFLAGS="$LDFLAGS $with_libstatgrab_ldflags"
5050   LIBS="-lstatgrab $LIBS"
5051
5052   AC_CACHE_CHECK([if libstatgrab >= 0.90],
5053           [c_cv_have_libstatgrab_0_90],
5054           AC_LINK_IFELSE([AC_LANG_PROGRAM(
5055 [[[
5056 #include <stdio.h>
5057 #include <statgrab.h>
5058 ]]],
5059 [[[
5060       if (sg_init()) return 0;
5061 ]]]
5062     )],
5063     [c_cv_have_libstatgrab_0_90="no"],
5064     [c_cv_have_libstatgrab_0_90="yes"]
5065           )
5066   )
5067
5068   CFLAGS="$SAVE_CFLAGS"
5069   LDFLAGS="$SAVE_LDFLAGS"
5070   LIBS="$SAVE_LIBS"
5071 fi
5072
5073 AM_CONDITIONAL(BUILD_WITH_LIBSTATGRAB, test "x$with_libstatgrab" = "xyes")
5074 if test "x$with_libstatgrab" = "xyes"
5075 then
5076   AC_DEFINE(HAVE_LIBSTATGRAB, 1, [Define to 1 if you have the 'statgrab' library (-lstatgrab)])
5077   BUILD_WITH_LIBSTATGRAB_CFLAGS="$with_libstatgrab_cflags"
5078   BUILD_WITH_LIBSTATGRAB_LDFLAGS="$with_libstatgrab_ldflags"
5079   AC_SUBST(BUILD_WITH_LIBSTATGRAB_CFLAGS)
5080   AC_SUBST(BUILD_WITH_LIBSTATGRAB_LDFLAGS)
5081   if test "x$c_cv_have_libstatgrab_0_90" = "xyes"
5082   then
5083         AC_DEFINE(HAVE_LIBSTATGRAB_0_90, 1, [Define to 1 if libstatgrab version >= 0.90])
5084   fi
5085 fi
5086 # }}}
5087
5088 # --with-libtokyotyrant {{{
5089 with_libtokyotyrant_cppflags=""
5090 with_libtokyotyrant_ldflags=""
5091 with_libtokyotyrant_libs=""
5092 AC_ARG_WITH(libtokyotyrant, [AS_HELP_STRING([--with-libtokyotyrant@<:@=PREFIX@:>@], [Path to libtokyotyrant.])],
5093 [
5094   if test "x$withval" = "xno"
5095   then
5096     with_libtokyotyrant="no"
5097   else if test "x$withval" = "xyes"
5098   then
5099     with_libtokyotyrant="yes"
5100   else
5101     with_libtokyotyrant_cppflags="-I$withval/include"
5102     with_libtokyotyrant_ldflags="-L$withval/include"
5103     with_libtokyotyrant_libs="-ltokyotyrant"
5104     with_libtokyotyrant="yes"
5105   fi; fi
5106 ],
5107 [
5108   with_libtokyotyrant="yes"
5109 ])
5110
5111 if test "x$with_libtokyotyrant" = "xyes"
5112 then
5113   if $PKG_CONFIG --exists tokyotyrant
5114   then
5115     with_libtokyotyrant_cppflags="$with_libtokyotyrant_cppflags `$PKG_CONFIG --cflags tokyotyrant`"
5116     with_libtokyotyrant_ldflags="$with_libtokyotyrant_ldflags `$PKG_CONFIG --libs-only-L tokyotyrant`"
5117     with_libtokyotyrant_libs="$with_libtokyotyrant_libs `$PKG_CONFIG --libs-only-l tokyotyrant`"
5118   fi
5119 fi
5120
5121 SAVE_CPPFLAGS="$CPPFLAGS"
5122 SAVE_LDFLAGS="$LDFLAGS"
5123 CPPFLAGS="$CPPFLAGS $with_libtokyotyrant_cppflags"
5124 LDFLAGS="$LDFLAGS $with_libtokyotyrant_ldflags"
5125
5126 if test "x$with_libtokyotyrant" = "xyes"
5127 then
5128   AC_CHECK_HEADERS(tcrdb.h,
5129   [
5130           AC_DEFINE(HAVE_TCRDB_H, 1,
5131                     [Define to 1 if you have the <tcrdb.h> header file.])
5132   ], [with_libtokyotyrant="no (tcrdb.h not found)"])
5133 fi
5134
5135 if test "x$with_libtokyotyrant" = "xyes"
5136 then
5137   AC_CHECK_LIB(tokyotyrant, tcrdbrnum,
5138   [
5139           AC_DEFINE(HAVE_LIBTOKYOTYRANT, 1,
5140                     [Define to 1 if you have the tokyotyrant library (-ltokyotyrant).])
5141   ],
5142   [with_libtokyotyrant="no (symbol tcrdbrnum not found)"],
5143   [$with_libtokyotyrant_libs])
5144 fi
5145
5146 CPPFLAGS="$SAVE_CPPFLAGS"
5147 LDFLAGS="$SAVE_LDFLAGS"
5148
5149 if test "x$with_libtokyotyrant" = "xyes"
5150 then
5151   BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS="$with_libtokyotyrant_cppflags"
5152   BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS="$with_libtokyotyrant_ldflags"
5153   BUILD_WITH_LIBTOKYOTYRANT_LIBS="$with_libtokyotyrant_libs"
5154   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_CPPFLAGS)
5155   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LDFLAGS)
5156   AC_SUBST(BUILD_WITH_LIBTOKYOTYRANT_LIBS)
5157 fi
5158 AM_CONDITIONAL(BUILD_WITH_LIBTOKYOTYRANT, test "x$with_libtokyotyrant" = "xyes")
5159 # }}}
5160
5161 # --with-libudev {{{
5162 with_libudev_cflags=""
5163 with_libudev_ldflags=""
5164 AC_ARG_WITH(libudev, [AS_HELP_STRING([--with-libudev@<:@=PREFIX@:>@], [Path to libudev.])],
5165 [
5166         if test "x$withval" = "xno"
5167         then
5168                 with_libudev="no"
5169         else
5170                 with_libudev="yes"
5171                 if test "x$withval" != "xyes"
5172                 then
5173                         with_libudev_cflags="-I$withval/include"
5174                         with_libudev_ldflags="-L$withval/lib"
5175                         with_libudev="yes"
5176                 fi
5177         fi
5178 ],
5179 [
5180         if test "x$ac_system" = "xLinux"
5181         then
5182                 with_libudev="yes"
5183         else
5184                 with_libudev="no (Linux only library)"
5185         fi
5186 ])
5187 if test "x$with_libudev" = "xyes"
5188 then
5189         SAVE_CPPFLAGS="$CPPFLAGS"
5190         CPPFLAGS="$CPPFLAGS $with_libudev_cflags"
5191
5192         AC_CHECK_HEADERS(libudev.h, [], [with_libudev="no (libudev.h not found)"])
5193
5194         CPPFLAGS="$SAVE_CPPFLAGS"
5195 fi
5196 if test "x$with_libudev" = "xyes"
5197 then
5198         SAVE_CPPFLAGS="$CPPFLAGS"
5199         SAVE_LDFLAGS="$LDFLAGS"
5200         CPPFLAGS="$CPPFLAGS $with_libudev_cflags"
5201         LDFLAGS="$LDFLAGS $with_libudev_ldflags"
5202
5203         AC_CHECK_LIB(udev, udev_new,
5204         [
5205                 AC_DEFINE(HAVE_LIBUDEV, 1, [Define to 1 if you have the udev library (-ludev).])
5206         ],
5207         [with_libudev="no (libudev not found)"])
5208
5209         CPPFLAGS="$SAVE_CPPFLAGS"
5210         LDFLAGS="$SAVE_LDFLAGS"
5211 fi
5212 if test "x$with_libudev" = "xyes"
5213 then
5214         BUILD_WITH_LIBUDEV_CFLAGS="$with_libudev_cflags"
5215         BUILD_WITH_LIBUDEV_LDFLAGS="$with_libudev_ldflags"
5216         BUILD_WITH_LIBUDEV_LIBS="-ludev"
5217         AC_SUBST(BUILD_WITH_LIBUDEV_CFLAGS)
5218         AC_SUBST(BUILD_WITH_LIBUDEV_LDFLAGS)
5219         AC_SUBST(BUILD_WITH_LIBUDEV_LIBS)
5220 fi
5221 AM_CONDITIONAL(BUILD_WITH_LIBUDEV, test "x$with_libudev" = "xyes")
5222 # }}}
5223
5224 # --with-libupsclient {{{
5225 with_libupsclient_config=""
5226 with_libupsclient_cflags=""
5227 with_libupsclient_libs=""
5228 AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to the upsclient library.])],
5229 [
5230         if test "x$withval" = "xno"
5231         then
5232                 with_libupsclient="no"
5233         else if test "x$withval" = "xyes"
5234         then
5235                 with_libupsclient="use_pkgconfig"
5236         else
5237                 if test -x "$withval"
5238                 then
5239                         with_libupsclient_config="$withval"
5240                         with_libupsclient="use_libupsclient_config"
5241                 else if test -x "$withval/bin/libupsclient-config"
5242                 then
5243                         with_libupsclient_config="$withval/bin/libupsclient-config"
5244                         with_libupsclient="use_libupsclient_config"
5245                 else
5246                         AC_MSG_NOTICE([Not checking for libupsclient: Manually configured])
5247                         with_libupsclient_cflags="-I$withval/include"
5248                         with_libupsclient_libs="-L$withval/lib -lupsclient"
5249                         with_libupsclient="yes"
5250                 fi; fi
5251         fi; fi
5252 ],
5253 [with_libupsclient="use_pkgconfig"])
5254
5255 # configure using libupsclient-config
5256 if test "x$with_libupsclient" = "xuse_libupsclient_config"
5257 then
5258         AC_MSG_NOTICE([Checking for libupsclient using $with_libupsclient_config])
5259         with_libupsclient_cflags="`$with_libupsclient_config --cflags`"
5260         if test $? -ne 0
5261         then
5262                 with_libupsclient="no ($with_libupsclient_config failed)"
5263         fi
5264         with_libupsclient_libs="`$with_libupsclient_config --libs`"
5265         if test $? -ne 0
5266         then
5267                 with_libupsclient="no ($with_libupsclient_config failed)"
5268         fi
5269 fi
5270 if test "x$with_libupsclient" = "xuse_libupsclient_config"
5271 then
5272         with_libupsclient="yes"
5273 fi
5274
5275 # configure using pkg-config
5276 if test "x$with_libupsclient" = "xuse_pkgconfig"
5277 then
5278         AC_MSG_NOTICE([Checking for libupsclient using $PKG_CONFIG])
5279         $PKG_CONFIG --exists 'libupsclient' 2>/dev/null
5280         if test $? -ne 0
5281         then
5282                 with_libupsclient="no (pkg-config doesn't know libupsclient)"
5283         fi
5284 fi
5285 if test "x$with_libupsclient" = "xuse_pkgconfig"
5286 then
5287         with_libupsclient_cflags="`$PKG_CONFIG --cflags 'libupsclient'`"
5288         if test $? -ne 0
5289         then
5290                 with_libupsclient="no ($PKG_CONFIG failed)"
5291         fi
5292         with_libupsclient_libs="`$PKG_CONFIG --libs 'libupsclient'`"
5293         if test $? -ne 0
5294         then
5295                 with_libupsclient="no ($PKG_CONFIG failed)"
5296         fi
5297 fi
5298 if test "x$with_libupsclient" = "xuse_pkgconfig"
5299 then
5300         with_libupsclient="yes"
5301 fi
5302
5303 # with_libupsclient_cflags and with_libupsclient_libs are set up now, let's do
5304 # the actual checks.
5305 if test "x$with_libupsclient" = "xyes"
5306 then
5307         SAVE_CPPFLAGS="$CPPFLAGS"
5308         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
5309
5310         AC_CHECK_HEADERS(upsclient.h, [], [with_libupsclient="no (upsclient.h not found)"])
5311
5312         CPPFLAGS="$SAVE_CPPFLAGS"
5313 fi
5314 if test "x$with_libupsclient" = "xyes"
5315 then
5316         SAVE_CPPFLAGS="$CPPFLAGS"
5317         SAVE_LDFLAGS="$LDFLAGS"
5318
5319         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
5320         LDFLAGS="$LDFLAGS $with_libupsclient_libs"
5321
5322         AC_CHECK_LIB(upsclient, upscli_connect,
5323                      [with_libupsclient="yes"],
5324                      [with_libupsclient="no (symbol upscli_connect not found)"])
5325
5326         CPPFLAGS="$SAVE_CPPFLAGS"
5327         LDFLAGS="$SAVE_LDFLAGS"
5328 fi
5329 if test "x$with_libupsclient" = "xyes"
5330 then
5331         SAVE_CPPFLAGS="$CPPFLAGS"
5332         CPPFLAGS="$CPPFLAGS $with_libupsclient_cflags"
5333
5334         AC_CHECK_TYPES([UPSCONN_t, UPSCONN], [], [],
5335 [#include <stdlib.h>
5336 #include <stdio.h>
5337 #include <upsclient.h>])
5338
5339         CPPFLAGS="$SAVE_CPPFLAGS"
5340 fi
5341 if test "x$with_libupsclient" = "xyes"
5342 then
5343         BUILD_WITH_LIBUPSCLIENT_CFLAGS="$with_libupsclient_cflags"
5344         BUILD_WITH_LIBUPSCLIENT_LIBS="$with_libupsclient_libs"
5345         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_CFLAGS)
5346         AC_SUBST(BUILD_WITH_LIBUPSCLIENT_LIBS)
5347 fi
5348 # }}}
5349
5350 # --with-libxenctrl {{{
5351 with_libxenctrl_cppflags=""
5352 with_libxenctrl_ldflags=""
5353 AC_ARG_WITH(libxenctrl, [AS_HELP_STRING([--with-libxenctrl@<:@=PREFIX@:>@], [Path to libxenctrl.])],
5354 [
5355         if test "x$withval" != "xno" && test "x$withval" != "xyes"
5356         then
5357                 with_libxenctrl_cppflags="-I$withval/include"
5358                 with_libxenctrl_ldflags="-L$withval/lib"
5359                 with_libxenctrl="yes"
5360         else
5361                 with_libxenctrl="$withval"
5362         fi
5363 ],
5364 [
5365         with_libxenctrl="yes"
5366 ])
5367 if test "x$with_libxenctrl" = "xyes"
5368 then
5369         SAVE_CPPFLAGS="$CPPFLAGS"
5370         CPPFLAGS="$CPPFLAGS $with_libxenctrl_cppflags"
5371
5372         AC_CHECK_HEADERS(xenctrl.h, [with_libxenctrl="yes"], [with_libxenctrl="no (xenctrl.h not found)"])
5373
5374         CPPFLAGS="$SAVE_CPPFLAGS"
5375 fi
5376 if test "x$with_libxenctrl" = "xyes"
5377 then
5378         SAVE_CPPFLAGS="$CPPFLAGS"
5379         SAVE_LDFLAGS="$LDFLAGS"
5380         CPPFLAGS="$CPPFLAGS $with_libxenctrl_cppflags"
5381         LDFLAGS="$LDFLAGS $with_libxenctrl_ldflags"
5382
5383         #Xen versions older than 3.4 has no xc_getcpuinfo()
5384         AC_CHECK_LIB(xenctrl, xc_getcpuinfo, [with_libxenctrl="yes"], [with_libxenctrl="no (symbol 'xc_getcpuinfo' not found)"], [])
5385
5386         CPPFLAGS="$SAVE_CPPFLAGS"
5387         LDFLAGS="$SAVE_LDFLAGS"
5388         LIBXENCTL_CPPFLAGS="$with_libxenctl_cppflags"
5389         LIBXENCTL_LDFLAGS="$with_libxenctl_ldflags"
5390         AC_SUBST(LIBXENCTL_CPPFLAGS)
5391         AC_SUBST(LIBXENCTL_LDFLAGS)
5392 fi
5393 # }}}
5394
5395 # --with-libxmms {{{
5396 with_xmms_config="xmms-config"
5397 with_xmms_cflags=""
5398 with_xmms_libs=""
5399 AC_ARG_WITH(libxmms, [AS_HELP_STRING([--with-libxmms@<:@=PREFIX@:>@], [Path to libxmms.])],
5400 [
5401         if test "x$withval" != "xno" \
5402                 && test "x$withval" != "xyes"
5403         then
5404                 if test -f "$withval" && test -x "$withval";
5405                 then
5406                         with_xmms_config="$withval"
5407                 else if test -x "$withval/bin/xmms-config"
5408                 then
5409                         with_xmms_config="$withval/bin/xmms-config"
5410                 fi; fi
5411                 with_libxmms="yes"
5412         else if test "x$withval" = "xno"
5413         then
5414                 with_libxmms="no"
5415         else
5416                 with_libxmms="yes"
5417         fi; fi
5418 ],
5419 [
5420         with_libxmms="yes"
5421 ])
5422 if test "x$with_libxmms" = "xyes"
5423 then
5424         with_xmms_cflags=`$with_xmms_config --cflags 2>/dev/null`
5425         xmms_config_status=$?
5426
5427         if test $xmms_config_status -ne 0
5428         then
5429                 with_libxmms="no"
5430         fi
5431 fi
5432 if test "x$with_libxmms" = "xyes"
5433 then
5434         with_xmms_libs=`$with_xmms_config --libs 2>/dev/null`
5435         xmms_config_status=$?
5436
5437         if test $xmms_config_status -ne 0
5438         then
5439                 with_libxmms="no"
5440         fi
5441 fi
5442 if test "x$with_libxmms" = "xyes"
5443 then
5444         AC_CHECK_LIB(xmms, xmms_remote_get_info,
5445         [
5446                 BUILD_WITH_LIBXMMS_CFLAGS="$with_xmms_cflags"
5447                 BUILD_WITH_LIBXMMS_LIBS="$with_xmms_libs"
5448                 AC_SUBST(BUILD_WITH_LIBXMMS_CFLAGS)
5449                 AC_SUBST(BUILD_WITH_LIBXMMS_LIBS)
5450         ],
5451         [
5452                 with_libxmms="no"
5453         ],
5454         [$with_xmms_libs])
5455 fi
5456 with_libxmms_numeric=0
5457 if test "x$with_libxmms" = "xyes"
5458 then
5459         with_libxmms_numeric=1
5460 fi
5461 AC_DEFINE_UNQUOTED(HAVE_LIBXMMS, [$with_libxmms_numeric], [Define to 1 if you have the 'xmms' library (-lxmms).])
5462 AM_CONDITIONAL(BUILD_WITH_LIBXMMS, test "x$with_libxmms" = "xyes")
5463 # }}}
5464
5465 # --with-libyajl {{{
5466 with_libyajl_cppflags=""
5467 with_libyajl_ldflags=""
5468 AC_ARG_WITH(libyajl, [AS_HELP_STRING([--with-libyajl@<:@=PREFIX@:>@], [Path to libyajl.])],
5469 [
5470         if test "x$withval" != "xno" && test "x$withval" != "xyes"
5471         then
5472                 with_libyajl_cppflags="-I$withval/include"
5473                 with_libyajl_ldflags="-L$withval/lib"
5474                 with_libyajl="yes"
5475         else
5476                 with_libyajl="$withval"
5477         fi
5478 ],
5479 [
5480         with_libyajl="yes"
5481 ])
5482 if test "x$with_libyajl" = "xyes"
5483 then
5484         SAVE_CPPFLAGS="$CPPFLAGS"
5485         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
5486
5487         AC_CHECK_HEADERS(yajl/yajl_parse.h, [with_libyajl="yes"], [with_libyajl="no (yajl/yajl_parse.h not found)"])
5488         AC_CHECK_HEADERS(yajl/yajl_version.h)
5489
5490         CPPFLAGS="$SAVE_CPPFLAGS"
5491 fi
5492 if test "x$with_libyajl" = "xyes"
5493 then
5494         SAVE_CPPFLAGS="$CPPFLAGS"
5495         SAVE_LDFLAGS="$LDFLAGS"
5496         CPPFLAGS="$CPPFLAGS $with_libyajl_cppflags"
5497         LDFLAGS="$LDFLAGS $with_libyajl_ldflags"
5498
5499         AC_CHECK_LIB(yajl, yajl_alloc, [with_libyajl="yes"], [with_libyajl="no (Symbol 'yajl_alloc' not found)"])
5500
5501         CPPFLAGS="$SAVE_CPPFLAGS"
5502         LDFLAGS="$SAVE_LDFLAGS"
5503 fi
5504 if test "x$with_libyajl" = "xyes"
5505 then
5506         BUILD_WITH_LIBYAJL_CPPFLAGS="$with_libyajl_cppflags"
5507         BUILD_WITH_LIBYAJL_LDFLAGS="$with_libyajl_ldflags"
5508         BUILD_WITH_LIBYAJL_LIBS="-lyajl"
5509         AC_SUBST(BUILD_WITH_LIBYAJL_CPPFLAGS)
5510         AC_SUBST(BUILD_WITH_LIBYAJL_LDFLAGS)
5511         AC_SUBST(BUILD_WITH_LIBYAJL_LIBS)
5512         AC_DEFINE(HAVE_LIBYAJL, 1, [Define if libyajl is present and usable.])
5513 fi
5514 AM_CONDITIONAL(BUILD_WITH_LIBYAJL, test "x$with_libyajl" = "xyes")
5515 # }}}
5516
5517 # --with-mic {{{
5518 with_mic_cflags="-I/opt/intel/mic/sysmgmt/sdk/include"
5519 with_mic_ldpath="-L/opt/intel/mic/sysmgmt/sdk/lib/Linux"
5520 with_mic_libs=""
5521 AC_ARG_WITH(mic,[AS_HELP_STRING([--with-mic@<:@=PREFIX@:>@], [Path to Intel MIC Access API.])],
5522 [
5523         if test "x$withval" = "xno"
5524         then
5525                 with_mic="no"
5526         else if test "x$withval" = "xyes"
5527         then
5528                 with_mic="yes"
5529         else if test -d "$with_mic/lib"
5530         then
5531                 AC_MSG_NOTICE([Not checking for Intel Mic: Manually configured])
5532                 with_mic_cflags="-I$withval/include"
5533                 with_mic_ldpath="-L$withval/lib/Linux"
5534                 with_mic_libs="$PTHREAD_LIBS -lMicAccessSDK -lscif"
5535                 with_mic="yes"
5536         fi; fi; fi
5537 ],
5538 [with_mic="yes"])
5539 if test "x$with_mic" = "xyes"
5540 then
5541         SAVE_CPPFLAGS="$CPPFLAGS"
5542         CPPFLAGS="$CPPFLAGS $with_mic_cflags"
5543         AC_CHECK_HEADERS(MicAccessApi.h,[],[with_mic="no (MicAccessApi not found)"])
5544         CPPFLAGS="$SAVE_CPPFLAGS"
5545 fi
5546 if test "x$with_mic" = "xyes"
5547 then
5548         SAVE_CPPFLAGS="$CPPFLAGS"
5549         SAVE_LDFLAGS="$LDFLAGS"
5550
5551         CPPFLAGS="$CPPFLAGS $with_mic_cflags"
5552         LDFLAGS="$LDFLAGS $with_mic_ldpath"
5553
5554         AC_CHECK_LIB(MicAccessSDK, MicInitAPI,
5555                         [with_mic_ldpath="$with_mic_ldpath"
5556                         with_mic_libs="$PTHREAD_LIBS -lMicAccessSDK -lscif"],
5557                         [with_mic="no (symbol MicInitAPI not found)"],[$PTHREAD_LIBS -lscif])
5558
5559         CPPFLAGS="$SAVE_CPPFLAGS"
5560         LDFLAGS="$SAVE_LDFLAGS"
5561 fi
5562
5563 if test "x$with_mic" = "xyes"
5564 then
5565         BUILD_WITH_MIC_CPPFLAGS="$with_mic_cflags"
5566         BUILD_WITH_MIC_LIBPATH="$with_mic_ldpath"
5567         BUILD_WITH_MIC_LDADD="$with_mic_libs"
5568         AC_SUBST(BUILD_WITH_MIC_CPPFLAGS)
5569         AC_SUBST(BUILD_WITH_MIC_LIBPATH)
5570         AC_SUBST(BUILD_WITH_MIC_LDADD)
5571 fi
5572 #}}}
5573
5574 # --with-libvarnish {{{
5575 with_libvarnish_cppflags=""
5576 with_libvarnish_cflags=""
5577 with_libvarnish_libs=""
5578 AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
5579 [
5580         if test "x$withval" = "xno"
5581         then
5582                 with_libvarnish="no"
5583         else if test "x$withval" = "xyes"
5584         then
5585                 with_libvarnish="use_pkgconfig"
5586         else if test -d "$with_libvarnish/lib"
5587         then
5588                 AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
5589                 with_libvarnish_cflags="-I$withval/include"
5590                 with_libvarnish_libs="-L$withval/lib -lvarnishapi"
5591                 with_libvarnish="yes"
5592         fi; fi; fi
5593 ],
5594 [with_libvarnish="use_pkgconfig"])
5595
5596 # configure using pkg-config
5597 if test "x$with_libvarnish" = "xuse_pkgconfig"
5598 then
5599         AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
5600         $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
5601         if test $? -ne 0
5602         then
5603                 with_libvarnish="no (pkg-config doesn't know varnishapi)"
5604         fi
5605 fi
5606 if test "x$with_libvarnish" = "xuse_pkgconfig"
5607 then
5608         with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
5609         if test $? -ne 0
5610         then
5611                 with_libvarnish="no ($PKG_CONFIG failed)"
5612         fi
5613         with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
5614         if test $? -ne 0
5615         then
5616                 with_libvarnish="no ($PKG_CONFIG failed)"
5617         fi
5618 fi
5619 if test "x$with_libvarnish" = "xuse_pkgconfig"
5620 then
5621         with_libvarnish="yes"
5622 fi
5623
5624 # with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
5625 # the actual checks.
5626 if test "x$with_libvarnish" = "xyes"
5627 then
5628         SAVE_CPPFLAGS="$CPPFLAGS"
5629
5630         CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
5631
5632         AC_CHECK_HEADERS(vapi/vsc.h,
5633                 [AC_DEFINE([HAVE_VARNISH_V4], [1], [Varnish 4 API support])],
5634                 [AC_CHECK_HEADERS(vsc.h,
5635                         [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])],
5636                         [AC_CHECK_HEADERS(varnishapi.h,
5637                                 [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])],
5638                                 [with_libvarnish="no (found none of the varnish header files)"])])])
5639
5640         CPPFLAGS="$SAVE_CPPFLAGS"
5641 fi
5642 if test "x$with_libvarnish" = "xyes"
5643 then
5644         BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
5645         BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
5646         AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
5647         AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
5648 fi
5649 # }}}
5650
5651 # pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
5652 with_libxml2="no (pkg-config isn't available)"
5653 with_libxml2_cflags=""
5654 with_libxml2_ldflags=""
5655 with_libvirt="no (pkg-config isn't available)"
5656 with_libvirt_cflags=""
5657 with_libvirt_ldflags=""
5658 $PKG_CONFIG --exists 'libxml-2.0' 2>/dev/null
5659 if test "$?" = "0"
5660 then
5661         with_libxml2="yes"
5662 else
5663         with_libxml2="no (pkg-config doesn't know libxml-2.0)"
5664 fi
5665
5666 $PKG_CONFIG --exists libvirt 2>/dev/null
5667 if test "$?" = "0"
5668 then
5669         with_libvirt="yes"
5670 else
5671         with_libvirt="no (pkg-config doesn't know libvirt)"
5672 fi
5673 if test "x$with_libxml2" = "xyes"
5674 then
5675         with_libxml2_cflags="`$PKG_CONFIG --cflags libxml-2.0`"
5676         if test $? -ne 0
5677         then
5678                 with_libxml2="no"
5679         fi
5680         with_libxml2_ldflags="`$PKG_CONFIG --libs libxml-2.0`"
5681         if test $? -ne 0
5682         then
5683                 with_libxml2="no"
5684         fi
5685 fi
5686 if test "x$with_libxml2" = "xyes"
5687 then
5688         SAVE_CPPFLAGS="$CPPFLAGS"
5689         CPPFLAGS="$CPPFLAGS $with_libxml2_cflags"
5690
5691         AC_CHECK_HEADERS(libxml/parser.h, [],
5692                       [with_libxml2="no (libxml/parser.h not found)"])
5693
5694         CPPFLAGS="$SAVE_CPPFLAGS"
5695 fi
5696 if test "x$with_libxml2" = "xyes"
5697 then
5698         SAVE_CFLAGS="$CFLAGS"
5699         SAVE_LDFLAGS="$LDFLAGS"
5700
5701         CFLAGS="$CFLAGS $with_libxml2_cflags"
5702         LDFLAGS="$LDFLAGS $with_libxml2_ldflags"
5703
5704         AC_CHECK_LIB(xml2, xmlXPathEval,
5705                      [with_libxml2="yes"],
5706                      [with_libxml2="no (symbol xmlXPathEval not found)"])
5707
5708         CFLAGS="$SAVE_CFLAGS"
5709         LDFLAGS="$SAVE_LDFLAGS"
5710 fi
5711 dnl Add the right compiler flags and libraries.
5712 if test "x$with_libxml2" = "xyes"; then
5713         BUILD_WITH_LIBXML2_CFLAGS="$with_libxml2_cflags"
5714         BUILD_WITH_LIBXML2_LIBS="$with_libxml2_ldflags"
5715         AC_SUBST(BUILD_WITH_LIBXML2_CFLAGS)
5716         AC_SUBST(BUILD_WITH_LIBXML2_LIBS)
5717 fi
5718 if test "x$with_libvirt" = "xyes"
5719 then
5720         with_libvirt_cflags="`$PKG_CONFIG --cflags libvirt`"
5721         if test $? -ne 0
5722         then
5723                 with_libvirt="no"
5724         fi
5725         with_libvirt_ldflags="`$PKG_CONFIG --libs libvirt`"
5726         if test $? -ne 0
5727         then
5728                 with_libvirt="no"
5729         fi
5730 fi
5731 if test "x$with_libvirt" = "xyes"
5732 then
5733         SAVE_CPPFLAGS="$CPPFLAGS"
5734         CPPFLAGS="$CPPFLAGS $with_libvirt_cflags"
5735
5736         AC_CHECK_HEADERS(libvirt/libvirt.h, [],
5737                       [with_libvirt="no (libvirt/libvirt.h not found)"])
5738
5739         CPPFLAGS="$SAVE_CPPFLAGS"
5740 fi
5741 if test "x$with_libvirt" = "xyes"
5742 then
5743         SAVE_CFLAGS="$CFLAGS"
5744         SAVE_LDFLAGS="$LDFLAGS"
5745
5746         CFLAGS="$CFLAGS $with_libvirt_cflags"
5747         LDFLAGS="$LDFLAGS $with_libvirt_ldflags"
5748
5749         AC_CHECK_LIB(virt, virDomainBlockStats,
5750                      [with_libvirt="yes"],
5751                      [with_libvirt="no (symbol virDomainBlockStats not found)"])
5752
5753         CFLAGS="$SAVE_CFLAGS"
5754         LDFLAGS="$SAVE_LDFLAGS"
5755 fi
5756 dnl Add the right compiler flags and libraries.
5757 if test "x$with_libvirt" = "xyes"; then
5758         BUILD_WITH_LIBVIRT_CFLAGS="$with_libvirt_cflags"
5759         BUILD_WITH_LIBVIRT_LIBS="$with_libvirt_ldflags"
5760         AC_SUBST(BUILD_WITH_LIBVIRT_CFLAGS)
5761         AC_SUBST(BUILD_WITH_LIBVIRT_LIBS)
5762 fi
5763 # }}}
5764
5765 # $PKG_CONFIG --exists OpenIPMIpthread {{{
5766 with_libopenipmipthread="yes"
5767 with_libopenipmipthread_cflags=""
5768 with_libopenipmipthread_libs=""
5769
5770 if test "x$with_libopenipmipthread" = "xyes"
5771 then
5772         AC_MSG_CHECKING([for libOpenIPMIpthread])
5773         $PKG_CONFIG --exists OpenIPMIpthread 2>/dev/null
5774         if test "$?" != "0"
5775         then
5776                 with_libopenipmipthread="no (pkg-config doesn't know OpenIPMIpthread)"
5777         fi
5778         AC_MSG_RESULT([$with_libopenipmipthread])
5779 fi
5780
5781 if test "x$with_libopenipmipthread" = "xyes"
5782 then
5783         AC_MSG_CHECKING([for libOpenIPMIpthread CFLAGS])
5784         temp_result="`$PKG_CONFIG --cflags OpenIPMIpthread`"
5785         if test "$?" = "0"
5786         then
5787                 with_libopenipmipthread_cflags="$temp_result"
5788         else
5789                 with_libopenipmipthread="no ($PKG_CONFIG --cflags OpenIPMIpthread failed)"
5790                 temp_result="$PKG_CONFIG --cflags OpenIPMIpthread failed"
5791         fi
5792         AC_MSG_RESULT([$temp_result])
5793 fi
5794
5795 if test "x$with_libopenipmipthread" = "xyes"
5796 then
5797         AC_MSG_CHECKING([for libOpenIPMIpthread LDFLAGS])
5798         temp_result="`$PKG_CONFIG --libs OpenIPMIpthread`"
5799         if test "$?" = "0"
5800         then
5801                 with_libopenipmipthread_ldflags="$temp_result"
5802         else
5803                 with_libopenipmipthread="no ($PKG_CONFIG --libs OpenIPMIpthread failed)"
5804                 temp_result="$PKG_CONFIG --libs OpenIPMIpthread failed"
5805         fi
5806         AC_MSG_RESULT([$temp_result])
5807 fi
5808
5809 if test "x$with_libopenipmipthread" = "xyes"
5810 then
5811         SAVE_CPPFLAGS="$CPPFLAGS"
5812         CPPFLAGS="$CPPFLAGS $with_libopenipmipthread_cflags"
5813
5814         AC_CHECK_HEADERS(OpenIPMI/ipmi_smi.h,
5815                          [with_libopenipmipthread="yes"],
5816                          [with_libopenipmipthread="no (OpenIPMI/ipmi_smi.h not found)"],
5817 [#include <OpenIPMI/ipmiif.h>
5818 #include <OpenIPMI/ipmi_err.h>
5819 #include <OpenIPMI/ipmi_posix.h>
5820 #include <OpenIPMI/ipmi_conn.h>
5821 ])
5822
5823         CPPFLAGS="$SAVE_CPPFLAGS"
5824 fi
5825
5826 if test "x$with_libopenipmipthread" = "xyes"
5827 then
5828         BUILD_WITH_OPENIPMI_CFLAGS="$with_libopenipmipthread_cflags"
5829         BUILD_WITH_OPENIPMI_LIBS="$with_libopenipmipthread_ldflags"
5830         AC_SUBST(BUILD_WITH_OPENIPMI_CFLAGS)
5831         AC_SUBST(BUILD_WITH_OPENIPMI_LIBS)
5832 fi
5833 # }}}
5834
5835 # --with-libatasmart {{{
5836 with_libatasmart_cppflags=""
5837 with_libatasmart_ldflags=""
5838 AC_ARG_WITH(libatasmart, [AS_HELP_STRING([--with-libatasmart@<:@=PREFIX@:>@], [Path to libatasmart.])],
5839 [
5840         if test "x$withval" != "xno" && test "x$withval" != "xyes"
5841         then
5842                 with_libatasmart_cppflags="-I$withval/include"
5843                 with_libatasmart_ldflags="-L$withval/lib"
5844                 with_libatasmart="yes"
5845         else
5846                 with_libatasmart="$withval"
5847         fi
5848 ],
5849 [
5850         if test "x$ac_system" = "xLinux"
5851         then
5852                 with_libatasmart="yes"
5853         else
5854                 with_libatasmart="no (Linux only library)"
5855         fi
5856 ])
5857 if test "x$with_libatasmart" = "xyes"
5858 then
5859         SAVE_CPPFLAGS="$CPPFLAGS"
5860         CPPFLAGS="$CPPFLAGS $with_libatasmart_cppflags"
5861
5862         AC_CHECK_HEADERS(atasmart.h, [with_libatasmart="yes"], [with_libatasmart="no (atasmart.h not found)"])
5863
5864         CPPFLAGS="$SAVE_CPPFLAGS"
5865 fi
5866 if test "x$with_libatasmart" = "xyes"
5867 then
5868         SAVE_CPPFLAGS="$CPPFLAGS"
5869         SAVE_LDFLAGS="$LDFLAGS"
5870         CPPFLAGS="$CPPFLAGS $with_libatasmart_cppflags"
5871         LDFLAGS="$LDFLAGS $with_libatasmart_ldflags"
5872
5873         AC_CHECK_LIB(atasmart, sk_disk_open, [with_libatasmart="yes"], [with_libatasmart="no (Symbol 'sk_disk_open' not found)"])
5874
5875         CPPFLAGS="$SAVE_CPPFLAGS"
5876         LDFLAGS="$SAVE_LDFLAGS"
5877 fi
5878 if test "x$with_libatasmart" = "xyes"
5879 then
5880         BUILD_WITH_LIBATASMART_CPPFLAGS="$with_libatasmart_cppflags"
5881         BUILD_WITH_LIBATASMART_LDFLAGS="$with_libatasmart_ldflags"
5882         BUILD_WITH_LIBATASMART_LIBS="-latasmart"
5883         AC_SUBST(BUILD_WITH_LIBATASMART_CPPFLAGS)
5884         AC_SUBST(BUILD_WITH_LIBATASMART_LDFLAGS)
5885         AC_SUBST(BUILD_WITH_LIBATASMART_LIBS)
5886         AC_DEFINE(HAVE_LIBATASMART, 1, [Define if libatasmart is present and usable.])
5887 fi
5888 AM_CONDITIONAL(BUILD_WITH_LIBATASMART, test "x$with_libatasmart" = "xyes")
5889 # }}}
5890
5891 PKG_CHECK_MODULES([LIBNOTIFY], [libnotify],
5892                 [with_libnotify="yes"],
5893                 [with_libnotify="no (pkg-config doesn't know libnotify)"]
5894 )
5895
5896 PKG_CHECK_MODULES([LIBRIEMANN_CLIENT], [riemann-client >= 1.6.0],
5897  [with_libriemann_client="yes"],
5898  [with_libriemann_client="no (pkg-config doesn't know libriemann-client)"])
5899
5900 # Check for enabled/disabled features
5901 #
5902
5903 # AC_COLLECTD(name, enable/disable, info-text, feature/module)
5904 # ------------------------------------------------------------
5905 dnl
5906 m4_define([my_toupper], [m4_translit([$1], m4_defn([m4_cr_letters]), m4_defn([m4_cr_LETTERS]))])
5907 dnl
5908 AC_DEFUN(
5909         [AC_COLLECTD],
5910         [
5911         m4_if([$1], [], [AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 1st argument must not be empty])])dnl
5912         m4_if(
5913                 [$2],
5914                 [enable],
5915                 [dnl
5916                 m4_define([EnDis],[disabled])dnl
5917                 m4_define([YesNo],[no])dnl
5918                 ],dnl
5919                 [m4_if(
5920                         [$2],
5921                         [disable],
5922                         [dnl
5923                         m4_define([EnDis],[enabled])dnl
5924                         m4_define([YesNo],[yes])dnl
5925                         ],
5926                         [dnl
5927                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 2nd argument must be either enable or disable])dnl
5928                         ]dnl
5929                 )]dnl
5930         )dnl
5931         m4_if([$3], [feature], [],
5932                 [m4_if(
5933                         [$3], [module], [],
5934                         [dnl
5935                         AC_FATAL([AC_COLLECTD([$1], [$2], [$3], [$4]): 3rd argument must be either feature or disable])dnl
5936                         ]dnl
5937                 )]dnl
5938         )dnl
5939         AC_ARG_ENABLE(
5940                 [$1],
5941                 AS_HELP_STRING([--$2-$1], [$2 $4 (EnDis by def)]),
5942                 [],
5943                 enable_$1='[YesNo]'dnl
5944         )# AC_ARG_ENABLE
5945 if test "x$enable_$1" = "xno"
5946 then
5947         collectd_$1=0
5948 else
5949         if test "x$enable_$1" = "xyes"
5950         then
5951                 collectd_$1=1
5952         else
5953                 AC_MSG_NOTICE([please specify either --enable-$1 or --disable-$1; enabling $1.])
5954                 collectd_$1=1
5955                 enable_$1='yes'
5956         fi
5957 fi
5958         AC_DEFINE_UNQUOTED([COLLECT_]my_toupper([$1]), [$collectd_$1], [wether or not to enable $3 $4])
5959         AM_CONDITIONAL([BUILD_]my_toupper([$3])[_]my_toupper([$1]), [test "x$enable_$1" = "xyes"])dnl
5960         ]dnl
5961 )# AC_COLLECTD(name, enable/disable, info-text, feature/module)
5962
5963 # AC_PLUGIN(name, default, info)
5964 # ------------------------------------------------------------
5965 dnl
5966 AC_DEFUN(
5967   [AC_PLUGIN],
5968   [
5969     enable_plugin="no"
5970     force="no"
5971     AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1],[$3]),
5972     [
5973      if test "x$enableval" = "xyes"
5974      then
5975              enable_plugin="yes"
5976      else if test "x$enableval" = "xforce"
5977      then
5978              enable_plugin="yes"
5979              force="yes"
5980      else
5981              enable_plugin="no (disabled on command line)"
5982      fi; fi
5983     ],
5984     [
5985          if test "x$enable_all_plugins" = "xauto"
5986          then
5987              if test "x$2" = "xyes"
5988              then
5989                      enable_plugin="yes"
5990              else
5991                      enable_plugin="$2"
5992              fi
5993          else
5994              enable_plugin="$enable_all_plugins"
5995          fi
5996     ])
5997     if test "x$enable_plugin" = "xyes"
5998     then
5999             if test "x$2" = "xyes" || test "x$force" = "xyes"
6000             then
6001                     AC_DEFINE([HAVE_PLUGIN_]my_toupper([$1]), 1, [Define to 1 if the $1 plugin is enabled.])
6002                     if test "x$2" != "xyes"
6003                     then
6004                             dependency_warning="yes"
6005                     fi
6006             else # User passed "yes" but dependency checking yielded "no" => Dependency problem.
6007                     dependency_error="yes"
6008                     enable_plugin="$2 (dependency error)"
6009             fi
6010     fi
6011     AM_CONDITIONAL([BUILD_PLUGIN_]my_toupper([$1]), test "x$enable_plugin" = "xyes")
6012     enable_$1="$enable_plugin"
6013   ]
6014 )# AC_PLUGIN(name, default, info)
6015
6016 m4_divert_once([HELP_ENABLE], [
6017 collectd features:])
6018 # FIXME: Remove these calls to `AC_COLLECTD' and then remove that macro.
6019 AC_COLLECTD([debug],     [enable],  [feature], [debugging])
6020 AC_COLLECTD([daemon],    [disable], [feature], [daemon mode])
6021 AC_COLLECTD([getifaddrs],[enable],  [feature], [getifaddrs under Linux])
6022 AC_COLLECTD([werror],    [disable], [feature], [building with -Werror])
6023
6024 dependency_warning="no"
6025 dependency_error="no"
6026
6027 plugin_ascent="no"
6028 plugin_barometer="no"
6029 plugin_battery="no"
6030 plugin_bind="no"
6031 plugin_ceph="no"
6032 plugin_cgroups="no"
6033 plugin_conntrack="no"
6034 plugin_contextswitch="no"
6035 plugin_cpu="no"
6036 plugin_cpufreq="no"
6037 plugin_cpusleep="no"
6038 plugin_curl_json="no"
6039 plugin_curl_xml="no"
6040 plugin_df="no"
6041 plugin_disk="no"
6042 plugin_drbd="no"
6043 plugin_dpdkstat="no"
6044 plugin_entropy="no"
6045 plugin_ethstat="no"
6046 plugin_fhcount="no"
6047 plugin_fscache="no"
6048 plugin_gps="no"
6049 plugin_grpc="no"
6050 plugin_hugepages="no"
6051 plugin_intel_rdt="no"
6052 plugin_interface="no"
6053 plugin_ipmi="no"
6054 plugin_ipvs="no"
6055 plugin_irq="no"
6056 plugin_load="no"
6057 plugin_log_logstash="no"
6058 plugin_memory="no"
6059 plugin_multimeter="no"
6060 plugin_nfs="no"
6061 plugin_numa="no"
6062 plugin_perl="no"
6063 plugin_pinba="no"
6064 plugin_processes="no"
6065 plugin_protocols="no"
6066 plugin_python="no"
6067 plugin_serial="no"
6068 plugin_smart="no"
6069 plugin_swap="no"
6070 plugin_tape="no"
6071 plugin_tcpconns="no"
6072 plugin_ted="no"
6073 plugin_thermal="no"
6074 plugin_turbostat="no"
6075 plugin_uptime="no"
6076 plugin_users="no"
6077 plugin_virt="no"
6078 plugin_vmem="no"
6079 plugin_vserver="no"
6080 plugin_wireless="no"
6081 plugin_write_prometheus="no"
6082 plugin_xencpu="no"
6083 plugin_zfs_arc="no"
6084 plugin_zone="no"
6085 plugin_zookeeper="no"
6086
6087 # Linux
6088 if test "x$ac_system" = "xLinux"
6089 then
6090         plugin_battery="yes"
6091         plugin_cgroups="yes"
6092         plugin_conntrack="yes"
6093         plugin_contextswitch="yes"
6094         plugin_cpu="yes"
6095         plugin_cpufreq="yes"
6096         plugin_disk="yes"
6097         plugin_drbd="yes"
6098         plugin_entropy="yes"
6099         plugin_fhcount="yes"
6100         plugin_fscache="yes"
6101         plugin_hugepages="yes"
6102         plugin_interface="yes"
6103         plugin_ipc="yes"
6104         plugin_irq="yes"
6105         plugin_load="yes"
6106         plugin_lvm="yes"
6107         plugin_memory="yes"
6108         plugin_nfs="yes"
6109         plugin_numa="yes"
6110         plugin_processes="yes"
6111         plugin_protocols="yes"
6112         plugin_serial="yes"
6113         plugin_swap="yes"
6114         plugin_tcpconns="yes"
6115         plugin_thermal="yes"
6116         plugin_uptime="yes"
6117         plugin_vmem="yes"
6118         plugin_vserver="yes"
6119         plugin_wireless="yes"
6120         plugin_zfs_arc="yes"
6121
6122         if test "x$have_linux_ip_vs_h" = "xyes" || test "x$have_net_ip_vs_h" = "xyes" || test "x$have_ip_vs_h" = "xyes"
6123         then
6124                 plugin_ipvs="yes"
6125         fi
6126         if test "x$have_cpuid_h" = "xyes"; then
6127                 plugin_turbostat="yes"
6128         fi
6129         
6130         if test "x$c_cv_have_clock_boottime_monotonic" = "xyes"
6131         then
6132                 plugin_cpusleep="yes"
6133         fi
6134 fi
6135
6136 if test "x$ac_system" = "xOpenBSD"
6137 then
6138         plugin_tcpconns="yes"
6139 fi
6140
6141 if test "x$ac_system" = "xNetBSD"
6142 then
6143         plugin_disk="yes"
6144         plugin_entropy="yes"
6145         plugin_irq="yes"
6146         plugin_processes="yes"
6147 fi
6148
6149 # Mac OS X devices
6150 if test "x$with_libiokit" = "xyes"
6151 then
6152         plugin_battery="yes"
6153         plugin_disk="yes"
6154 fi
6155
6156 # AIX
6157
6158 if test "x$ac_system" = "xAIX"
6159 then
6160         plugin_ipc="yes"
6161         plugin_tcpconns="yes"
6162 fi
6163
6164 # FreeBSD
6165
6166 if test "x$ac_system" = "xFreeBSD"
6167 then
6168         plugin_disk="yes"
6169         plugin_zfs_arc="yes"
6170 fi
6171
6172
6173 if test "x$with_perfstat" = "xyes"
6174 then
6175         plugin_contextswitch="yes"
6176         plugin_cpu="yes"
6177         plugin_disk="yes"
6178         plugin_interface="yes"
6179         plugin_load="yes"
6180         plugin_memory="yes"
6181         plugin_swap="yes"
6182         plugin_uptime="yes"
6183 fi
6184
6185 if test "x$with_procinfo" = "xyes"
6186 then
6187         plugin_processes="yes"
6188 fi
6189
6190 # Solaris
6191 if test "x$with_kstat" = "xyes"
6192 then
6193         plugin_nfs="yes"
6194         plugin_processes="yes"
6195         plugin_uptime="yes"
6196         plugin_zfs_arc="yes"
6197         plugin_zone="yes"
6198 fi
6199
6200 if test "x$with_devinfo$with_kstat" = "xyesyes"
6201 then
6202         plugin_cpu="yes"
6203         plugin_disk="yes"
6204         plugin_interface="yes"
6205         plugin_memory="yes"
6206         plugin_tape="yes"
6207 fi
6208
6209 # libi2c-dev
6210 if test "x$ac_system" = "xLinux"
6211 then
6212 AC_CHECK_DECL(i2c_smbus_read_i2c_block_data,
6213         [with_libi2c="yes"],
6214         [with_libi2c="no (symbol i2c_smbus_read_i2c_block_data not found - have you installed libi2c-dev ?)"],
6215         [[#include <stdlib.h>
6216         #include <linux/i2c-dev.h>]])
6217 else
6218         with_libi2c="no (Linux only)"
6219 fi
6220
6221 if test "x$with_libi2c" = "xyes"
6222 then
6223         plugin_barometer="yes"
6224 fi
6225
6226
6227 # libstatgrab
6228 if test "x$with_libstatgrab" = "xyes"
6229 then
6230         plugin_cpu="yes"
6231         plugin_disk="yes"
6232         plugin_interface="yes"
6233         plugin_load="yes"
6234         plugin_memory="yes"
6235         plugin_swap="yes"
6236         plugin_users="yes"
6237 fi
6238
6239 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
6240 then
6241         plugin_ascent="yes"
6242         if test "x$have_strptime" = "xyes"
6243         then
6244                 plugin_bind="yes"
6245         fi
6246 fi
6247
6248 if test "x$with_libopenipmipthread" = "xyes"
6249 then
6250         plugin_ipmi="yes"
6251 fi
6252
6253 if test "x$with_libcurl" = "xyes" && test "x$with_libyajl" = "xyes"
6254 then
6255         plugin_curl_json="yes"
6256 fi
6257
6258 if test "x$with_libcurl" = "xyes" && test "x$with_libxml2" = "xyes"
6259 then
6260         plugin_curl_xml="yes"
6261 fi
6262
6263 if test "x$with_libyajl" = "xyes"
6264 then
6265         plugin_ceph="yes"
6266 fi
6267
6268 if test "x$have_processor_info" = "xyes"
6269 then
6270         plugin_cpu="yes"
6271 fi
6272 if test "x$have_sysctl" = "xyes"
6273 then
6274         plugin_cpu="yes"
6275         plugin_memory="yes"
6276         plugin_uptime="yes"
6277         if test "x$ac_system" = "xDarwin"
6278         then
6279                 plugin_swap="yes"
6280         fi
6281 fi
6282 if test "x$have_sysctlbyname" = "xyes"
6283 then
6284         plugin_contextswitch="yes"
6285         plugin_cpu="yes"
6286         plugin_memory="yes"
6287         plugin_tcpconns="yes"
6288 fi
6289
6290 # Df plugin: Check if we know how to determine mount points first.
6291 #if test "x$have_listmntent" = "xyes"; then
6292 #       plugin_df="yes"
6293 #fi
6294 if test "x$have_getvfsstat" = "xyes" || test "x$have_getfsstat" = "xyes"
6295 then
6296         plugin_df="yes"
6297 fi
6298 if test "x$c_cv_have_two_getmntent" = "xyes" || test "x$have_getmntent" = "xgen" || test "x$have_getmntent" = "xsun"
6299 then
6300         plugin_df="yes"
6301 fi
6302 #if test "x$have_getmntent" = "xseq"
6303 #then
6304 #       plugin_df="yes"
6305 #fi
6306 if test "x$c_cv_have_one_getmntent" = "xyes"
6307 then
6308         plugin_df="yes"
6309 fi
6310
6311 if test "x$have_getmntent_r" = "xyes"
6312 then
6313         plugin_df="yes"
6314 fi
6315
6316 # Df plugin: Check if we have either `statfs' or `statvfs' second.
6317 if test "x$plugin_df" = "xyes"
6318 then
6319         plugin_df="no"
6320         if test "x$have_statfs" = "xyes"
6321         then
6322                 plugin_df="yes"
6323         fi
6324         if test "x$have_statvfs" = "xyes"
6325         then
6326                 plugin_df="yes"
6327         fi
6328 fi
6329
6330 if test "x$have_linux_sockios_h$have_linux_ethtool_h" = "xyesyes"
6331 then
6332         plugin_ethstat="yes"
6333 fi
6334
6335 if test "x$with_libgrpcpp" = "xyes" && test "x$with_libprotobuf" = "xyes" && test "x$have_protoc3" = "xyes" && test "x$GRPC_CPP_PLUGIN" != "x"
6336 then
6337         plugin_grpc="yes"
6338 fi
6339
6340 if test "x$have_getifaddrs" = "xyes"
6341 then
6342         plugin_interface="yes"
6343 fi
6344
6345 if test "x$with_libgps" = "xyes"
6346 then
6347         plugin_gps="yes"
6348 fi
6349
6350 if test "x$have_getloadavg" = "xyes"
6351 then
6352         plugin_load="yes"
6353 fi
6354
6355 if test "x$with_libyajl" = "xyes"
6356 then
6357         plugin_log_logstash="yes"
6358 fi
6359
6360 if test "x$c_cv_have_libperl$c_cv_have_perl_ithreads" = "xyesyes"
6361 then
6362         plugin_perl="yes"
6363 fi
6364
6365 if test "x$have_protoc_c" = "xyes" && test "x$with_libprotobuf_c" = "xyes"
6366 then
6367         plugin_pinba="yes"
6368         if test "x$with_libmicrohttpd" = "xyes"
6369         then
6370                 plugin_write_prometheus="yes"
6371         fi
6372 fi
6373
6374 # Mac OS X memory interface
6375 if test "x$have_host_statistics" = "xyes"
6376 then
6377         plugin_memory="yes"
6378 fi
6379
6380 if test "x$have_termios_h" = "xyes"
6381 then
6382         if test "x$ac_system" != "xAIX"
6383         then
6384                 plugin_multimeter="yes"
6385         fi
6386         plugin_ted="yes"
6387 fi
6388
6389 if test "x$have_thread_info" = "xyes"
6390 then
6391         plugin_processes="yes"
6392 fi
6393
6394 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_freebsd" = "xyes"
6395 then
6396         plugin_processes="yes"
6397 fi
6398
6399 if test "x$with_kvm_getprocs" = "xyes" && test "x$have_struct_kinfo_proc_openbsd" = "xyes"
6400 then
6401         plugin_processes="yes"
6402 fi
6403
6404 if test "x$with_libpython" != "xno"
6405 then
6406         plugin_python="yes"
6407 fi
6408
6409 if test "x$with_libatasmart" = "xyes" && test "x$with_libudev" = "xyes"
6410 then
6411         plugin_smart="yes"
6412 fi
6413
6414 if test "x$with_kvm_getswapinfo" = "xyes"
6415 then
6416         plugin_swap="yes"
6417 fi
6418
6419 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_two_args" = "xyes"
6420 then
6421         plugin_swap="yes"
6422 fi
6423
6424 if test "x$have_swapctl" = "xyes" && test "x$c_cv_have_swapctl_three_args" = "xyes"
6425 then
6426         plugin_swap="yes"
6427 fi
6428
6429 if test "x$with_kvm_openfiles$with_kvm_nlist" = "xyesyes"
6430 then
6431         plugin_tcpconns="yes"
6432 fi
6433
6434 if test "x$have_getutent" = "xyes"
6435 then
6436         plugin_users="yes"
6437 fi
6438 if test "x$have_getutxent" = "xyes"
6439 then
6440         plugin_users="yes"
6441 fi
6442
6443 if test "x$with_libxml2" = "xyes" && test "x$with_libvirt" = "xyes"
6444 then
6445         plugin_virt="yes"
6446 fi
6447
6448 if test "x$with_libxenctrl" = "xyes"
6449 then
6450   plugin_xencpu="yes"
6451 fi
6452
6453 if test "x$with_libdpdk" = "xyes"
6454 then
6455   plugin_dpdkstat="yes"
6456 fi
6457
6458 m4_divert_once([HELP_ENABLE], [
6459 collectd plugins:])
6460
6461 AC_ARG_ENABLE([all-plugins],
6462                 AS_HELP_STRING([--enable-all-plugins],[enable all plugins (auto by def)]),
6463                 [
6464                  if test "x$enableval" = "xyes"
6465                  then
6466                          enable_all_plugins="yes"
6467                  else if test "x$enableval" = "xauto"
6468                  then
6469                          enable_all_plugins="auto"
6470                  else
6471                          enable_all_plugins="no"
6472                  fi; fi
6473                 ],
6474                 [enable_all_plugins="auto"])
6475
6476 m4_divert_once([HELP_ENABLE], [])
6477
6478 AC_PLUGIN([aggregation],         [yes],                     [Aggregation plugin])
6479 AC_PLUGIN([amqp],                [$with_librabbitmq],       [AMQP output plugin])
6480 AC_PLUGIN([apache],              [$with_libcurl],           [Apache httpd statistics])
6481 AC_PLUGIN([apcups],              [yes],                     [Statistics of UPSes by APC])
6482 AC_PLUGIN([apple_sensors],       [$with_libiokit],          [Apple hardware sensors])
6483 AC_PLUGIN([aquaero],             [$with_libaquaero5],       [Aquaero hardware sensors])
6484 AC_PLUGIN([ascent],              [$plugin_ascent],          [AscentEmu player statistics])
6485 AC_PLUGIN([barometer],           [$plugin_barometer],       [Barometer sensor on I2C])
6486 AC_PLUGIN([battery],             [$plugin_battery],         [Battery statistics])
6487 AC_PLUGIN([bind],                [$plugin_bind],            [ISC Bind nameserver statistics])
6488 AC_PLUGIN([ceph],                [$plugin_ceph],            [Ceph daemon statistics])
6489 AC_PLUGIN([cgroups],             [$plugin_cgroups],         [CGroups CPU usage accounting])
6490 AC_PLUGIN([chrony],              [yes],                     [Chrony statistics])
6491 AC_PLUGIN([conntrack],           [$plugin_conntrack],       [nf_conntrack statistics])
6492 AC_PLUGIN([contextswitch],       [$plugin_contextswitch],   [context switch statistics])
6493 AC_PLUGIN([cpu],                 [$plugin_cpu],             [CPU usage statistics])
6494 AC_PLUGIN([cpufreq],             [$plugin_cpufreq],         [CPU frequency statistics])
6495 AC_PLUGIN([cpusleep],            [$plugin_cpusleep],        [CPU sleep statistics])
6496 AC_PLUGIN([csv],                 [yes],                     [CSV output plugin])
6497 AC_PLUGIN([curl],                [$with_libcurl],           [CURL generic web statistics])
6498 AC_PLUGIN([curl_json],           [$plugin_curl_json],       [CouchDB statistics])
6499 AC_PLUGIN([curl_xml],            [$plugin_curl_xml],        [CURL generic xml statistics])
6500 AC_PLUGIN([dbi],                 [$with_libdbi],            [General database statistics])
6501 AC_PLUGIN([df],                  [$plugin_df],              [Filesystem usage statistics])
6502 AC_PLUGIN([disk],                [$plugin_disk],            [Disk usage statistics])
6503 AC_PLUGIN([dns],                 [$with_libpcap],           [DNS traffic analysis])
6504 AC_PLUGIN([dpdkstat],            [$plugin_dpdkstat],        [Stats & Status from DPDK])
6505 AC_PLUGIN([drbd],                [$plugin_drbd],            [DRBD statistics])
6506 AC_PLUGIN([email],               [yes],                     [EMail statistics])
6507 AC_PLUGIN([entropy],             [$plugin_entropy],         [Entropy statistics])
6508 AC_PLUGIN([ethstat],             [$plugin_ethstat],         [Stats from NIC driver])
6509 AC_PLUGIN([exec],                [yes],                     [Execution of external programs])
6510 AC_PLUGIN([fhcount],             [$plugin_fhcount],         [File handles statistics])
6511 AC_PLUGIN([filecount],           [yes],                     [Count files in directories])
6512 AC_PLUGIN([fscache],             [$plugin_fscache],         [fscache statistics])
6513 AC_PLUGIN([gmond],               [$with_libganglia],        [Ganglia plugin])
6514 AC_PLUGIN([gps],                 [$plugin_gps],             [GPS plugin])
6515 AC_PLUGIN([grpc],                [$plugin_grpc],            [gRPC plugin])
6516 AC_PLUGIN([hddtemp],             [yes],                     [Query hddtempd])
6517 AC_PLUGIN([hugepages],           [$plugin_hugepages],       [Hugepages statistics])
6518 AC_PLUGIN([intel_rdt],           [$with_libpqos],           [Intel RDT monitor plugin])
6519 AC_PLUGIN([interface],           [$plugin_interface],       [Interface traffic statistics])
6520 AC_PLUGIN([ipc],                 [$plugin_ipc],             [IPC statistics])
6521 AC_PLUGIN([ipmi],                [$plugin_ipmi],            [IPMI sensor statistics])
6522 AC_PLUGIN([iptables],            [$with_libiptc],           [IPTables rule counters])
6523 AC_PLUGIN([ipvs],                [$plugin_ipvs],            [IPVS connection statistics])
6524 AC_PLUGIN([irq],                 [$plugin_irq],             [IRQ statistics])
6525 AC_PLUGIN([java],                [$with_java],              [Embed the Java Virtual Machine])
6526 AC_PLUGIN([load],                [$plugin_load],            [System load])
6527 AC_PLUGIN([log_logstash],        [$plugin_log_logstash],    [Logstash json_event compatible logging])
6528 AC_PLUGIN([logfile],             [yes],                     [File logging plugin])
6529 AC_PLUGIN([lpar],                [$with_perfstat],          [AIX logical partitions statistics])
6530 AC_PLUGIN([lua],                 [$with_liblua],            [Lua plugin])
6531 AC_PLUGIN([lvm],                 [$with_liblvm2app],        [LVM statistics])
6532 AC_PLUGIN([madwifi],             [$have_linux_wireless_h],  [Madwifi wireless statistics])
6533 AC_PLUGIN([match_empty_counter], [yes],                     [The empty counter match])
6534 AC_PLUGIN([match_hashed],        [yes],                     [The hashed match])
6535 AC_PLUGIN([match_regex],         [yes],                     [The regex match])
6536 AC_PLUGIN([match_timediff],      [yes],                     [The timediff match])
6537 AC_PLUGIN([match_value],         [yes],                     [The value match])
6538 AC_PLUGIN([mbmon],               [yes],                     [Query mbmond])
6539 AC_PLUGIN([md],                  [$have_linux_raid_md_u_h], [md (Linux software RAID) devices])
6540 AC_PLUGIN([memcachec],           [$with_libmemcached],      [memcachec statistics])
6541 AC_PLUGIN([memcached],           [yes],                     [memcached statistics])
6542 AC_PLUGIN([memory],              [$plugin_memory],          [Memory usage])
6543 AC_PLUGIN([mic],                 [$with_mic],               [Intel Many Integrated Core stats])
6544 AC_PLUGIN([modbus],              [$with_libmodbus],         [Modbus plugin])
6545 AC_PLUGIN([mqtt],                [$with_libmosquitto],      [MQTT output plugin])
6546 AC_PLUGIN([multimeter],          [$plugin_multimeter],      [Read multimeter values])
6547 AC_PLUGIN([mysql],               [$with_libmysql],          [MySQL statistics])
6548 AC_PLUGIN([netapp],              [$with_libnetapp],         [NetApp plugin])
6549 AC_PLUGIN([netlink],             [$with_libmnl],            [Enhanced Linux network statistics])
6550 AC_PLUGIN([network],             [yes],                     [Network communication plugin])
6551 AC_PLUGIN([nfs],                 [$plugin_nfs],             [NFS statistics])
6552 AC_PLUGIN([nginx],               [$with_libcurl],           [nginx statistics])
6553 AC_PLUGIN([notify_desktop],      [$with_libnotify],         [Desktop notifications])
6554 AC_PLUGIN([notify_email],        [$with_libesmtp],          [Email notifier])
6555 AC_PLUGIN([notify_nagios],       [yes],                     [Nagios notification plugin])
6556 AC_PLUGIN([ntpd],                [yes],                     [NTPd statistics])
6557 AC_PLUGIN([numa],                [$plugin_numa],            [NUMA virtual memory statistics])
6558 AC_PLUGIN([nut],                 [$with_libupsclient],      [Network UPS tools statistics])
6559 AC_PLUGIN([olsrd],               [yes],                     [olsrd statistics])
6560 AC_PLUGIN([onewire],             [$with_libowcapi],         [OneWire sensor statistics])
6561 AC_PLUGIN([openldap],            [$with_libldap],           [OpenLDAP statistics])
6562 AC_PLUGIN([openvpn],             [yes],                     [OpenVPN client statistics])
6563 AC_PLUGIN([oracle],              [$with_oracle],            [Oracle plugin])
6564 AC_PLUGIN([perl],                [$plugin_perl],            [Embed a Perl interpreter])
6565 AC_PLUGIN([pf],                  [$have_net_pfvar_h],       [BSD packet filter (PF) statistics])
6566 # FIXME: Check for libevent, too.
6567 AC_PLUGIN([pinba],               [$plugin_pinba],           [Pinba statistics])
6568 AC_PLUGIN([ping],                [$with_liboping],          [Network latency statistics])
6569 AC_PLUGIN([postgresql],          [$with_libpq],             [PostgreSQL database statistics])
6570 AC_PLUGIN([powerdns],            [yes],                     [PowerDNS statistics])
6571 AC_PLUGIN([processes],           [$plugin_processes],       [Process statistics])
6572 AC_PLUGIN([protocols],           [$plugin_protocols],       [Protocol (IP, TCP, ...) statistics])
6573 AC_PLUGIN([python],              [$plugin_python],          [Embed a Python interpreter])
6574 AC_PLUGIN([redis],               [$with_libhiredis],        [Redis plugin])
6575 AC_PLUGIN([routeros],            [$with_librouteros],       [RouterOS plugin])
6576 AC_PLUGIN([rrdcached],           [$librrd_rrdc_update],     [RRDTool output plugin])
6577 AC_PLUGIN([rrdtool],             [$with_librrd],            [RRDTool output plugin])
6578 AC_PLUGIN([sensors],             [$with_libsensors],        [lm_sensors statistics])
6579 AC_PLUGIN([serial],              [$plugin_serial],          [serial port traffic])
6580 AC_PLUGIN([sigrok],              [$with_libsigrok],         [sigrok acquisition sources])
6581 AC_PLUGIN([smart],               [$plugin_smart],           [SMART statistics])
6582 AC_PLUGIN([snmp],                [$with_libnetsnmp],        [SNMP querying plugin])
6583 AC_PLUGIN([statsd],              [yes],                     [StatsD plugin])
6584 AC_PLUGIN([swap],                [$plugin_swap],            [Swap usage statistics])
6585 AC_PLUGIN([syslog],              [$have_syslog],            [Syslog logging plugin])
6586 AC_PLUGIN([table],               [yes],                     [Parsing of tabular data])
6587 AC_PLUGIN([tail],                [yes],                     [Parsing of logfiles])
6588 AC_PLUGIN([tail_csv],            [yes],                     [Parsing of CSV files])
6589 AC_PLUGIN([tape],                [$plugin_tape],            [Tape drive statistics])
6590 AC_PLUGIN([target_notification], [yes],                     [The notification target])
6591 AC_PLUGIN([target_replace],      [yes],                     [The replace target])
6592 AC_PLUGIN([target_scale],        [yes],                     [The scale target])
6593 AC_PLUGIN([target_set],          [yes],                     [The set target])
6594 AC_PLUGIN([target_v5upgrade],    [yes],                     [The v5upgrade target])
6595 AC_PLUGIN([tcpconns],            [$plugin_tcpconns],        [TCP connection statistics])
6596 AC_PLUGIN([teamspeak2],          [yes],                     [TeamSpeak2 server statistics])
6597 AC_PLUGIN([ted],                 [$plugin_ted],             [Read The Energy Detective values])
6598 AC_PLUGIN([thermal],             [$plugin_thermal],         [Linux ACPI thermal zone statistics])
6599 AC_PLUGIN([threshold],           [yes],                     [Threshold checking plugin])
6600 AC_PLUGIN([tokyotyrant],         [$with_libtokyotyrant],    [TokyoTyrant database statistics])
6601 AC_PLUGIN([turbostat],           [$plugin_turbostat],       [Advanced statistic on Intel cpu states])
6602 AC_PLUGIN([unixsock],            [yes],                     [Unixsock communication plugin])
6603 AC_PLUGIN([uptime],              [$plugin_uptime],          [Uptime statistics])
6604 AC_PLUGIN([users],               [$plugin_users],           [User statistics])
6605 AC_PLUGIN([uuid],                [yes],                     [UUID as hostname plugin])
6606 AC_PLUGIN([varnish],             [$with_libvarnish],        [Varnish cache statistics])
6607 AC_PLUGIN([virt],                [$plugin_virt],            [Virtual machine statistics])
6608 AC_PLUGIN([vmem],                [$plugin_vmem],            [Virtual memory statistics])
6609 AC_PLUGIN([vserver],             [$plugin_vserver],         [Linux VServer statistics])
6610 AC_PLUGIN([wireless],            [$plugin_wireless],        [Wireless statistics])
6611 AC_PLUGIN([write_graphite],      [yes],                     [Graphite / Carbon output plugin])
6612 AC_PLUGIN([write_http],          [$with_libcurl],           [HTTP output plugin])
6613 AC_PLUGIN([write_kafka],         [$with_librdkafka],        [Kafka output plugin])
6614 AC_PLUGIN([write_log],           [yes],                     [Log output plugin])
6615 AC_PLUGIN([write_mongodb],       [$with_libmongoc],         [MongoDB output plugin])
6616 AC_PLUGIN([write_prometheus],    [$plugin_write_prometheus], [Prometheus write plugin])
6617 AC_PLUGIN([write_redis],         [$with_libhiredis],        [Redis output plugin])
6618 AC_PLUGIN([write_riemann],       [$with_libriemann_client], [Riemann output plugin])
6619 AC_PLUGIN([write_sensu],         [yes],                     [Sensu output plugin])
6620 AC_PLUGIN([write_tsdb],          [yes],                     [TSDB output plugin])
6621 AC_PLUGIN([xencpu],              [$plugin_xencpu],          [Xen Host CPU usage])
6622 AC_PLUGIN([xmms],                [$with_libxmms],           [XMMS statistics])
6623 AC_PLUGIN([zfs_arc],             [$plugin_zfs_arc],         [ZFS ARC statistics])
6624 AC_PLUGIN([zone],                [$plugin_zone],            [Solaris container statistics])
6625 AC_PLUGIN([zookeeper],           [yes],                     [Zookeeper statistics])
6626
6627 dnl Default configuration file
6628 # Load either syslog or logfile
6629 LOAD_PLUGIN_SYSLOG=""
6630 LOAD_PLUGIN_LOGFILE=""
6631 LOAD_PLUGIN_LOG_LOGSTASH=""
6632
6633 AC_MSG_CHECKING([which default log plugin to load])
6634 default_log_plugin="none"
6635 if test "x$enable_syslog" = "xyes"
6636 then
6637         default_log_plugin="syslog"
6638 else
6639         LOAD_PLUGIN_SYSLOG="##"
6640 fi
6641
6642 if test "x$enable_logfile" = "xyes"
6643 then
6644         if test "x$default_log_plugin" = "xnone"
6645         then
6646                 default_log_plugin="logfile"
6647         else
6648                 LOAD_PLUGIN_LOGFILE="#"
6649         fi
6650 else
6651         LOAD_PLUGIN_LOGFILE="##"
6652 fi
6653
6654 if test "x$enable_log_logstash" = "xyes"
6655 then
6656   LOAD_PLUGIN_LOG_LOGSTASH="#"
6657 else
6658   LOAD_PLUGIN_LOG_LOGSTASH="##"
6659 fi
6660
6661
6662 AC_MSG_RESULT([$default_log_plugin])
6663
6664 AC_SUBST(LOAD_PLUGIN_SYSLOG)
6665 AC_SUBST(LOAD_PLUGIN_LOGFILE)
6666 AC_SUBST(LOAD_PLUGIN_LOG_LOGSTASH)
6667
6668 DEFAULT_LOG_LEVEL="info"
6669 if test "x$enable_debug" = "xyes"
6670 then
6671         DEFAULT_LOG_LEVEL="debug"
6672 fi
6673 AC_SUBST(DEFAULT_LOG_LEVEL)
6674
6675 # Load only one of rrdtool, network, csv in the default config.
6676 LOAD_PLUGIN_RRDTOOL=""
6677 LOAD_PLUGIN_NETWORK=""
6678 LOAD_PLUGIN_CSV=""
6679
6680 AC_MSG_CHECKING([which default write plugin to load])
6681 default_write_plugin="none"
6682 if test "x$enable_rrdtool" = "xyes"
6683 then
6684         default_write_plugin="rrdtool"
6685 else
6686         LOAD_PLUGIN_RRDTOOL="##"
6687 fi
6688
6689 if test "x$enable_network" = "xyes"
6690 then
6691         if test "x$default_write_plugin" = "xnone"
6692         then
6693                 default_write_plugin="network"
6694         else
6695                 LOAD_PLUGIN_NETWORK="#"
6696         fi
6697 else
6698         LOAD_PLUGIN_NETWORK="##"
6699 fi
6700
6701 if test "x$enable_csv" = "xyes"
6702 then
6703         if test "x$default_write_plugin" = "xnone"
6704         then
6705                 default_write_plugin="csv"
6706         else
6707                 LOAD_PLUGIN_CSV="#"
6708         fi
6709 else
6710         LOAD_PLUGIN_CSV="##"
6711 fi
6712 AC_MSG_RESULT([$default_write_plugin])
6713
6714 AC_SUBST(LOAD_PLUGIN_RRDTOOL)
6715 AC_SUBST(LOAD_PLUGIN_NETWORK)
6716 AC_SUBST(LOAD_PLUGIN_CSV)
6717
6718 dnl ip_vs.h
6719 if test "x$ac_system" = "xLinux" \
6720         && test "x$have_linux_ip_vs_h$have_net_ip_vs_h$have_ip_vs_h" = "xnonono"
6721 then
6722         enable_ipvs="$enable_ipvs (ip_vs.h not found)"
6723 fi
6724
6725 if test "x$ip_vs_h_needs_kernel_cflags" = "xyes"
6726 then
6727         enable_ipvs="$enable_ipvs (needs $KERNEL_CFLAGS)"
6728 fi
6729
6730 dnl Perl bindings
6731 PERL_BINDINGS_OPTIONS="PREFIX=${prefix}"
6732 AC_ARG_WITH(perl-bindings, [AS_HELP_STRING([--with-perl-bindings@<:@=OPTIONS@:>@], [Options passed to "perl Makefile.PL".])],
6733 [
6734         if test "x$withval" != "xno" && test "x$withval" != "xyes"
6735         then
6736                 PERL_BINDINGS_OPTIONS="$withval"
6737                 with_perl_bindings="yes"
6738         else
6739                 with_perl_bindings="$withval"
6740         fi
6741 ],
6742 [
6743         if test -n "$perl_interpreter"
6744         then
6745                 with_perl_bindings="yes"
6746         else
6747                 with_perl_bindings="no (no perl interpreter found)"
6748         fi
6749 ])
6750
6751 if test "x$with_perl_bindings" = "xyes"
6752 then
6753         AC_MSG_CHECKING([for the ExtUtils::MakeMaker module])
6754         if $PERL -MExtUtils::MakeMaker -e '' 2>/dev/null; then
6755                 AC_MSG_RESULT([yes])
6756         else
6757                 AC_MSG_RESULT([no])
6758                 with_perl_bindings="no (ExtUtils::MakeMaker not found)"
6759         fi
6760 fi
6761
6762 if test "x$with_perl_bindings" = "xyes"
6763 then
6764         PERL_BINDINGS="perl"
6765 else
6766         PERL_BINDINGS=""
6767 fi
6768 AC_SUBST(PERL_BINDINGS)
6769 AC_SUBST(PERL_BINDINGS_OPTIONS)
6770
6771 dnl libcollectdclient
6772 LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
6773 LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
6774 LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`
6775
6776 LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`
6777
6778 LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"
6779
6780 AC_SUBST(LCC_VERSION_MAJOR)
6781 AC_SUBST(LCC_VERSION_MINOR)
6782 AC_SUBST(LCC_VERSION_PATCH)
6783 AC_SUBST(LCC_VERSION_EXTRA)
6784 AC_SUBST(LCC_VERSION_STRING)
6785
6786 AC_CONFIG_FILES(src/libcollectdclient/collectd/lcc_features.h)
6787
6788 AM_CFLAGS="-Wall"
6789 AM_CXXFLAGS="-Wall"
6790 if test "x$enable_werror" != "xno"
6791 then
6792         AM_CFLAGS="$AM_CFLAGS -Werror"
6793         AM_CXXFLAGS="$AM_CXXFLAGS -Werror"
6794 fi
6795 AC_SUBST([AM_CFLAGS])
6796 AC_SUBST([AM_CXXFLAGS])
6797
6798 AC_CONFIG_FILES([Makefile proto/Makefile src/Makefile src/daemon/Makefile src/collectd.conf src/libcollectdclient/Makefile src/libcollectdclient/libcollectdclient.pc src/liboconfig/Makefile bindings/Makefile bindings/java/Makefile])
6799 AC_OUTPUT
6800
6801 if test "x$with_librrd" = "xyes" \
6802         && test "x$librrd_threadsafe" != "xyes"
6803 then
6804         with_librrd="yes (warning: librrd is not thread-safe)"
6805 fi
6806
6807 if test "x$with_libperl" = "xyes"
6808 then
6809         with_libperl="yes (version `$perl_interpreter -MConfig -e 'print $Config{version};'`)"
6810 else
6811         enable_perl="no (needs libperl)"
6812 fi
6813
6814 if test "x$enable_perl" = "xno" && test "x$c_cv_have_perl_ithreads" = "xno"
6815 then
6816         enable_perl="no (libperl doesn't support ithreads)"
6817 fi
6818
6819 if test "x$with_perl_bindings" = "xyes" \
6820         && test "x$PERL_BINDINGS_OPTIONS" != "x"
6821 then
6822         with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)"
6823 fi
6824
6825 AC_MSG_RESULT()
6826 AC_MSG_RESULT([Configuration:])
6827 AC_MSG_RESULT([  Build:])
6828 AC_MSG_RESULT([    Platform  . . . . . . $ac_system])
6829 AC_MSG_RESULT([    CC  . . . . . . . . . $CC])
6830 AC_MSG_RESULT([    CFLAGS  . . . . . . . $AM_CFLAGS $CFLAGS])
6831 AC_MSG_RESULT([    CXXFLAGS  . . . . . . $AM_CXXFLAGS $CXXFLAGS])
6832 AC_MSG_RESULT([    CPP . . . . . . . . . $CPP])
6833 AC_MSG_RESULT([    CPPFLAGS  . . . . . . $CPPFLAGS])
6834 AC_MSG_RESULT([    GRPC_CPP_PLUGIN . . . $GRPC_CPP_PLUGIN])
6835 AC_MSG_RESULT([    LD  . . . . . . . . . $LD])
6836 AC_MSG_RESULT([    LDFLAGS . . . . . . . $LDFLAGS])
6837 AC_MSG_RESULT([    PROTOC  . . . . . . . $PROTOC])
6838 AC_MSG_RESULT([    YACC  . . . . . . . . $YACC])
6839 AC_MSG_RESULT([    YFLAGS  . . . . . . . $YFLAGS])
6840 AC_MSG_RESULT()
6841 AC_MSG_RESULT([  Libraries:])
6842 AC_MSG_RESULT([    intel mic . . . . . . $with_mic])
6843 AC_MSG_RESULT([    libaquaero5 . . . . . $with_libaquaero5])
6844 AC_MSG_RESULT([    libatasmart . . . . . $with_libatasmart])
6845 AC_MSG_RESULT([    libcurl . . . . . . . $with_libcurl])
6846 AC_MSG_RESULT([    libdbi  . . . . . . . $with_libdbi])
6847 AC_MSG_RESULT([    libdpdk . . . . . . . $with_libdpdk])
6848 AC_MSG_RESULT([    libesmtp  . . . . . . $with_libesmtp])
6849 AC_MSG_RESULT([    libganglia  . . . . . $with_libganglia])
6850 AC_MSG_RESULT([    libgcrypt . . . . . . $with_libgcrypt])
6851 AC_MSG_RESULT([    libgps  . . . . . . . $with_libgps])
6852 AC_MSG_RESULT([    libgrpc++ . . . . . . $with_libgrpcpp])
6853 AC_MSG_RESULT([    libhal  . . . . . . . $with_libhal])
6854 AC_MSG_RESULT([    libhiredis  . . . . . $with_libhiredis])
6855 AC_MSG_RESULT([    libi2c-dev  . . . . . $with_libi2c])
6856 AC_MSG_RESULT([    libiokit  . . . . . . $with_libiokit])
6857 AC_MSG_RESULT([    libiptc . . . . . . . $with_libiptc])
6858 AC_MSG_RESULT([    libjvm  . . . . . . . $with_java])
6859 AC_MSG_RESULT([    libkstat  . . . . . . $with_kstat])
6860 AC_MSG_RESULT([    libkvm  . . . . . . . $with_libkvm])
6861 AC_MSG_RESULT([    libldap . . . . . . . $with_libldap])
6862 AC_MSG_RESULT([    liblua  . . . . . . . $with_liblua])
6863 AC_MSG_RESULT([    liblvm2app  . . . . . $with_liblvm2app])
6864 AC_MSG_RESULT([    libmemcached  . . . . $with_libmemcached])
6865 AC_MSG_RESULT([    libmicrohttpd . . . . $with_libmicrohttpd])
6866 AC_MSG_RESULT([    libmnl  . . . . . . . $with_libmnl])
6867 AC_MSG_RESULT([    libmodbus . . . . . . $with_libmodbus])
6868 AC_MSG_RESULT([    libmongoc . . . . . . $with_libmongoc])
6869 AC_MSG_RESULT([    libmosquitto  . . . . $with_libmosquitto])
6870 AC_MSG_RESULT([    libmysql  . . . . . . $with_libmysql])
6871 AC_MSG_RESULT([    libnetapp . . . . . . $with_libnetapp])
6872 AC_MSG_RESULT([    libnetsnmp  . . . . . $with_libnetsnmp])
6873 AC_MSG_RESULT([    libnotify . . . . . . $with_libnotify])
6874 AC_MSG_RESULT([    liboconfig  . . . . . $with_liboconfig])
6875 AC_MSG_RESULT([    libopenipmi . . . . . $with_libopenipmipthread])
6876 AC_MSG_RESULT([    liboping  . . . . . . $with_liboping])
6877 AC_MSG_RESULT([    libowcapi . . . . . . $with_libowcapi])
6878 AC_MSG_RESULT([    libpcap . . . . . . . $with_libpcap])
6879 AC_MSG_RESULT([    libperfstat . . . . . $with_perfstat])
6880 AC_MSG_RESULT([    libperl . . . . . . . $with_libperl])
6881 AC_MSG_RESULT([    libpq . . . . . . . . $with_libpq])
6882 AC_MSG_RESULT([    libpqos . . . . . . . $with_libpqos])
6883 AC_MSG_RESULT([    libprotobuf . . . . . $with_libprotobuf])
6884 AC_MSG_RESULT([    libprotobuf-c . . . . $with_libprotobuf_c])
6885 AC_MSG_RESULT([    libpython . . . . . . $with_libpython])
6886 AC_MSG_RESULT([    librabbitmq . . . . . $with_librabbitmq])
6887 AC_MSG_RESULT([    libriemann-client . . $with_libriemann_client])
6888 AC_MSG_RESULT([    librdkafka  . . . . . $with_librdkafka])
6889 AC_MSG_RESULT([    librouteros . . . . . $with_librouteros])
6890 AC_MSG_RESULT([    librrd  . . . . . . . $with_librrd])
6891 AC_MSG_RESULT([    libsensors  . . . . . $with_libsensors])
6892 AC_MSG_RESULT([    libsigrok   . . . . . $with_libsigrok])
6893 AC_MSG_RESULT([    libstatgrab . . . . . $with_libstatgrab])
6894 AC_MSG_RESULT([    libtokyotyrant  . . . $with_libtokyotyrant])
6895 AC_MSG_RESULT([    libudev . . . . . . . $with_libudev])
6896 AC_MSG_RESULT([    libupsclient  . . . . $with_libupsclient])
6897 AC_MSG_RESULT([    libvarnish  . . . . . $with_libvarnish])
6898 AC_MSG_RESULT([    libvirt . . . . . . . $with_libvirt])
6899 AC_MSG_RESULT([    libxenctrl  . . . . . $with_libxenctrl])
6900 AC_MSG_RESULT([    libxml2 . . . . . . . $with_libxml2])
6901 AC_MSG_RESULT([    libxmms . . . . . . . $with_libxmms])
6902 AC_MSG_RESULT([    libyajl . . . . . . . $with_libyajl])
6903 AC_MSG_RESULT([    oracle  . . . . . . . $with_oracle])
6904 AC_MSG_RESULT([    protobuf-c  . . . . . $have_protoc_c])
6905 AC_MSG_RESULT([    protoc 3  . . . . . . $have_protoc3])
6906 AC_MSG_RESULT()
6907 AC_MSG_RESULT([  Features:])
6908 AC_MSG_RESULT([    daemon mode . . . . . $enable_daemon])
6909 AC_MSG_RESULT([    debug . . . . . . . . $enable_debug])
6910 AC_MSG_RESULT()
6911 AC_MSG_RESULT([  Bindings:])
6912 AC_MSG_RESULT([    perl  . . . . . . . . $with_perl_bindings])
6913 AC_MSG_RESULT()
6914 AC_MSG_RESULT([  Modules:])
6915 AC_MSG_RESULT([    aggregation . . . . . $enable_aggregation])
6916 AC_MSG_RESULT([    amqp    . . . . . . . $enable_amqp])
6917 AC_MSG_RESULT([    apache  . . . . . . . $enable_apache])
6918 AC_MSG_RESULT([    apcups  . . . . . . . $enable_apcups])
6919 AC_MSG_RESULT([    apple_sensors . . . . $enable_apple_sensors])
6920 AC_MSG_RESULT([    aquaero . . . . . . . $enable_aquaero])
6921 AC_MSG_RESULT([    ascent  . . . . . . . $enable_ascent])
6922 AC_MSG_RESULT([    barometer . . . . . . $enable_barometer])
6923 AC_MSG_RESULT([    battery . . . . . . . $enable_battery])
6924 AC_MSG_RESULT([    bind  . . . . . . . . $enable_bind])
6925 AC_MSG_RESULT([    ceph  . . . . . . . . $enable_ceph])
6926 AC_MSG_RESULT([    cgroups . . . . . . . $enable_cgroups])
6927 AC_MSG_RESULT([    chrony. . . . . . . . $enable_chrony])
6928 AC_MSG_RESULT([    conntrack . . . . . . $enable_conntrack])
6929 AC_MSG_RESULT([    contextswitch . . . . $enable_contextswitch])
6930 AC_MSG_RESULT([    cpu . . . . . . . . . $enable_cpu])
6931 AC_MSG_RESULT([    cpufreq . . . . . . . $enable_cpufreq])
6932 AC_MSG_RESULT([    cpusleep  . . . . . . $enable_cpusleep])
6933 AC_MSG_RESULT([    csv . . . . . . . . . $enable_csv])
6934 AC_MSG_RESULT([    curl  . . . . . . . . $enable_curl])
6935 AC_MSG_RESULT([    curl_json . . . . . . $enable_curl_json])
6936 AC_MSG_RESULT([    curl_xml  . . . . . . $enable_curl_xml])
6937 AC_MSG_RESULT([    dbi . . . . . . . . . $enable_dbi])
6938 AC_MSG_RESULT([    df  . . . . . . . . . $enable_df])
6939 AC_MSG_RESULT([    disk  . . . . . . . . $enable_disk])
6940 AC_MSG_RESULT([    dns . . . . . . . . . $enable_dns])
6941 AC_MSG_RESULT([    dpdkstat  . . . . . . $enable_dpdkstat])
6942 AC_MSG_RESULT([    drbd  . . . . . . . . $enable_drbd])
6943 AC_MSG_RESULT([    email . . . . . . . . $enable_email])
6944 AC_MSG_RESULT([    entropy . . . . . . . $enable_entropy])
6945 AC_MSG_RESULT([    ethstat . . . . . . . $enable_ethstat])
6946 AC_MSG_RESULT([    exec  . . . . . . . . $enable_exec])
6947 AC_MSG_RESULT([    fhcount . . . . . . . $enable_fhcount])
6948 AC_MSG_RESULT([    filecount . . . . . . $enable_filecount])
6949 AC_MSG_RESULT([    fscache . . . . . . . $enable_fscache])
6950 AC_MSG_RESULT([    gmond . . . . . . . . $enable_gmond])
6951 AC_MSG_RESULT([    gps . . . . . . . . . $enable_gps])
6952 AC_MSG_RESULT([    grpc  . . . . . . . . $enable_grpc])
6953 AC_MSG_RESULT([    hddtemp . . . . . . . $enable_hddtemp])
6954 AC_MSG_RESULT([    hugepages . . . . . . $enable_hugepages])
6955 AC_MSG_RESULT([    intel_rdt. . . . .  . $enable_intel_rdt])
6956 AC_MSG_RESULT([    interface . . . . . . $enable_interface])
6957 AC_MSG_RESULT([    ipc . . . . . . . . . $enable_ipc])
6958 AC_MSG_RESULT([    ipmi  . . . . . . . . $enable_ipmi])
6959 AC_MSG_RESULT([    iptables  . . . . . . $enable_iptables])
6960 AC_MSG_RESULT([    ipvs  . . . . . . . . $enable_ipvs])
6961 AC_MSG_RESULT([    irq . . . . . . . . . $enable_irq])
6962 AC_MSG_RESULT([    java  . . . . . . . . $enable_java])
6963 AC_MSG_RESULT([    load  . . . . . . . . $enable_load])
6964 AC_MSG_RESULT([    logfile . . . . . . . $enable_logfile])
6965 AC_MSG_RESULT([    log_logstash  . . . . $enable_log_logstash])
6966 AC_MSG_RESULT([    lpar  . . . . . . . . $enable_lpar])
6967 AC_MSG_RESULT([    lua . . . . . . . . . $enable_lua])
6968 AC_MSG_RESULT([    lvm . . . . . . . . . $enable_lvm])
6969 AC_MSG_RESULT([    madwifi . . . . . . . $enable_madwifi])
6970 AC_MSG_RESULT([    match_empty_counter . $enable_match_empty_counter])
6971 AC_MSG_RESULT([    match_hashed  . . . . $enable_match_hashed])
6972 AC_MSG_RESULT([    match_regex . . . . . $enable_match_regex])
6973 AC_MSG_RESULT([    match_timediff  . . . $enable_match_timediff])
6974 AC_MSG_RESULT([    match_value . . . . . $enable_match_value])
6975 AC_MSG_RESULT([    mbmon . . . . . . . . $enable_mbmon])
6976 AC_MSG_RESULT([    md  . . . . . . . . . $enable_md])
6977 AC_MSG_RESULT([    memcachec . . . . . . $enable_memcachec])
6978 AC_MSG_RESULT([    memcached . . . . . . $enable_memcached])
6979 AC_MSG_RESULT([    memory  . . . . . . . $enable_memory])
6980 AC_MSG_RESULT([    mic . . . . . . . . . $enable_mic])
6981 AC_MSG_RESULT([    modbus  . . . . . . . $enable_modbus])
6982 AC_MSG_RESULT([    mqtt  . . . . . . . . $enable_mqtt])
6983 AC_MSG_RESULT([    multimeter  . . . . . $enable_multimeter])
6984 AC_MSG_RESULT([    mysql . . . . . . . . $enable_mysql])
6985 AC_MSG_RESULT([    netapp  . . . . . . . $enable_netapp])
6986 AC_MSG_RESULT([    netlink . . . . . . . $enable_netlink])
6987 AC_MSG_RESULT([    network . . . . . . . $enable_network])
6988 AC_MSG_RESULT([    nfs . . . . . . . . . $enable_nfs])
6989 AC_MSG_RESULT([    nginx . . . . . . . . $enable_nginx])
6990 AC_MSG_RESULT([    notify_desktop  . . . $enable_notify_desktop])
6991 AC_MSG_RESULT([    notify_email  . . . . $enable_notify_email])
6992 AC_MSG_RESULT([    notify_nagios . . . . $enable_notify_nagios])
6993 AC_MSG_RESULT([    ntpd  . . . . . . . . $enable_ntpd])
6994 AC_MSG_RESULT([    numa  . . . . . . . . $enable_numa])
6995 AC_MSG_RESULT([    nut . . . . . . . . . $enable_nut])
6996 AC_MSG_RESULT([    olsrd . . . . . . . . $enable_olsrd])
6997 AC_MSG_RESULT([    onewire . . . . . . . $enable_onewire])
6998 AC_MSG_RESULT([    openldap  . . . . . . $enable_openldap])
6999 AC_MSG_RESULT([    openvpn . . . . . . . $enable_openvpn])
7000 AC_MSG_RESULT([    oracle  . . . . . . . $enable_oracle])
7001 AC_MSG_RESULT([    perl  . . . . . . . . $enable_perl])
7002 AC_MSG_RESULT([    pf  . . . . . . . . . $enable_pf])
7003 AC_MSG_RESULT([    pinba . . . . . . . . $enable_pinba])
7004 AC_MSG_RESULT([    ping  . . . . . . . . $enable_ping])
7005 AC_MSG_RESULT([    postgresql  . . . . . $enable_postgresql])
7006 AC_MSG_RESULT([    powerdns  . . . . . . $enable_powerdns])
7007 AC_MSG_RESULT([    processes . . . . . . $enable_processes])
7008 AC_MSG_RESULT([    protocols . . . . . . $enable_protocols])
7009 AC_MSG_RESULT([    python  . . . . . . . $enable_python])
7010 AC_MSG_RESULT([    redis . . . . . . . . $enable_redis])
7011 AC_MSG_RESULT([    routeros  . . . . . . $enable_routeros])
7012 AC_MSG_RESULT([    rrdcached . . . . . . $enable_rrdcached])
7013 AC_MSG_RESULT([    rrdtool . . . . . . . $enable_rrdtool])
7014 AC_MSG_RESULT([    sensors . . . . . . . $enable_sensors])
7015 AC_MSG_RESULT([    serial  . . . . . . . $enable_serial])
7016 AC_MSG_RESULT([    sigrok  . . . . . . . $enable_sigrok])
7017 AC_MSG_RESULT([    smart . . . . . . . . $enable_smart])
7018 AC_MSG_RESULT([    snmp  . . . . . . . . $enable_snmp])
7019 AC_MSG_RESULT([    statsd  . . . . . . . $enable_statsd])
7020 AC_MSG_RESULT([    swap  . . . . . . . . $enable_swap])
7021 AC_MSG_RESULT([    syslog  . . . . . . . $enable_syslog])
7022 AC_MSG_RESULT([    table . . . . . . . . $enable_table])
7023 AC_MSG_RESULT([    tail_csv  . . . . . . $enable_tail_csv])
7024 AC_MSG_RESULT([    tail  . . . . . . . . $enable_tail])
7025 AC_MSG_RESULT([    tape  . . . . . . . . $enable_tape])
7026 AC_MSG_RESULT([    target_notification . $enable_target_notification])
7027 AC_MSG_RESULT([    target_replace  . . . $enable_target_replace])
7028 AC_MSG_RESULT([    target_scale  . . . . $enable_target_scale])
7029 AC_MSG_RESULT([    target_set  . . . . . $enable_target_set])
7030 AC_MSG_RESULT([    target_v5upgrade  . . $enable_target_v5upgrade])
7031 AC_MSG_RESULT([    tcpconns  . . . . . . $enable_tcpconns])
7032 AC_MSG_RESULT([    teamspeak2  . . . . . $enable_teamspeak2])
7033 AC_MSG_RESULT([    ted . . . . . . . . . $enable_ted])
7034 AC_MSG_RESULT([    thermal . . . . . . . $enable_thermal])
7035 AC_MSG_RESULT([    threshold . . . . . . $enable_threshold])
7036 AC_MSG_RESULT([    tokyotyrant . . . . . $enable_tokyotyrant])
7037 AC_MSG_RESULT([    turbostat . . . . . . $enable_turbostat])
7038 AC_MSG_RESULT([    unixsock  . . . . . . $enable_unixsock])
7039 AC_MSG_RESULT([    uptime  . . . . . . . $enable_uptime])
7040 AC_MSG_RESULT([    users . . . . . . . . $enable_users])
7041 AC_MSG_RESULT([    uuid  . . . . . . . . $enable_uuid])
7042 AC_MSG_RESULT([    varnish . . . . . . . $enable_varnish])
7043 AC_MSG_RESULT([    virt  . . . . . . . . $enable_virt])
7044 AC_MSG_RESULT([    vmem  . . . . . . . . $enable_vmem])
7045 AC_MSG_RESULT([    vserver . . . . . . . $enable_vserver])
7046 AC_MSG_RESULT([    wireless  . . . . . . $enable_wireless])
7047 AC_MSG_RESULT([    write_graphite  . . . $enable_write_graphite])
7048 AC_MSG_RESULT([    write_http  . . . . . $enable_write_http])
7049 AC_MSG_RESULT([    write_kafka . . . . . $enable_write_kafka])
7050 AC_MSG_RESULT([    write_log . . . . . . $enable_write_log])
7051 AC_MSG_RESULT([    write_mongodb . . . . $enable_write_mongodb])
7052 AC_MSG_RESULT([    write_prometheus. . . $enable_write_prometheus])
7053 AC_MSG_RESULT([    write_redis . . . . . $enable_write_redis])
7054 AC_MSG_RESULT([    write_riemann . . . . $enable_write_riemann])
7055 AC_MSG_RESULT([    write_sensu . . . . . $enable_write_sensu])
7056 AC_MSG_RESULT([    write_tsdb  . . . . . $enable_write_tsdb])
7057 AC_MSG_RESULT([    xencpu  . . . . . . . $enable_xencpu])
7058 AC_MSG_RESULT([    xmms  . . . . . . . . $enable_xmms])
7059 AC_MSG_RESULT([    zfs_arc . . . . . . . $enable_zfs_arc])
7060 AC_MSG_RESULT([    zone  . . . . . . . . $enable_zone])
7061 AC_MSG_RESULT([    zookeeper . . . . . . $enable_zookeeper])
7062 AC_MSG_RESULT()
7063
7064 if test "x$dependency_error" = "xyes"; then
7065         AC_MSG_ERROR("Some plugins are missing dependencies - see the summary above for details")
7066 fi
7067
7068 if test "x$dependency_warning" = "xyes"; then
7069         AC_MSG_WARN("Some plugins seem to have missing dependencies but have been enabled forcibly - see the summary above for details")
7070 fi
7071
7072 # vim: set fdm=marker :