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