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