Code

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