Code

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