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