Code

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