Code

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