Code

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