Code

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