Code

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